about summary refs log tree commit diff stats
path: root/main.c
Commit message (Expand)AuthorAgeFilesLines
...
* applied Jukka's patch preventing some cornercases and making the EOF error me...arg@mig292006-11-271-1/+2
* applied yet another proposal of Manuelarg@mig292006-11-261-2/+2
* applied Jukka's sizeof K&R compliance patch, applied Manuels' last-line print...arg@mig292006-11-261-6/+8
* applied Jukka's stdinread patcharg@mig292006-11-261-2/+3
* applied Manuels patch (thanks to Manuel!)arg@mig292006-11-251-14/+21
* applied Gottox patchesarg@mig292006-11-211-2/+3
* applied Gottox' windowarea patcharg@mig292006-11-161-1/+6
* code polishing, removed unnecessary newlinesAnselm R. Garbe2006-10-061-21/+9
* removed the stack position stuffAnselm R. Garbe2006-10-051-4/+1
* keep master ratio on resizecol -> arrangeAnselm R. Garbe2006-10-051-3/+3
* added symbols for different modesAnselm R. Garbe2006-09-291-2/+5
* removed useless updatemasterAnselm R. Garbe2006-09-291-1/+1
* added the new dotile as described on mlAnselm R. Garbe2006-09-291-1/+1
* first step to a more flexible dotile() algorithmAnselm R. Garbe2006-09-291-2/+2
* applied Jukkas patcharg@mmvi2006-09-251-3/+3
* implemented the maximization as I described on the mailinglist, this feels be...arg@mmvi2006-09-221-1/+0
* removed a bunch of lines through making function signatures more consistent w...Anselm R. Garbe2006-09-121-19/+11
* applied Christof Musik's multihead patch for a pathologic cornercaseAnselm R. Garbe2006-09-121-1/+2
* fixed some other comments, now also the code side seems to be at a level to b...Anselm R. Garbe2006-09-111-2/+2
* using a global stack for focus recovery on arrange() - seems to work greatAnselm R. Garbe2006-09-071-0/+1
* small fixAnselm R. Garbe2006-09-061-0/+1
* applied Sanders max_and_focus.patchAnselm R. Garbe2006-09-041-0/+1
* trying a different configurationAnselm R. Garbe2006-08-251-3/+3
* fixed typoAnselm R. Garbe2006-08-251-1/+1
* removed a bunch of lines, made mode symbols configurableAnselm R. Garbe2006-08-251-1/+1
* new color stuff/new rendering stuffAnselm R. Garbe2006-08-251-5/+9
* back to 3 colorsAnselm R. Garbe2006-08-251-4/+3
* 3->4 colorsAnselm R. Garbe2006-08-241-3/+4
* changing tag indicator through underlineAnselm R. Garbe2006-08-241-0/+1
* removed a blank lineAnselm R. Garbe2006-08-231-1/+0
* separated setup stuff into main.c:setup() - this makes main() more readableAnselm R. Garbe2006-08-231-86/+95
* rearranged getprotoAnselm R. Garbe2006-08-221-6/+5
* removed winprop (merged into getproto)Anselm R. Garbe2006-08-221-27/+7
* removed DEFTAGAnselm R. Garbe2006-08-221-1/+1
* small renamings of two static functionsAnselm R.Garbe2006-08-211-2/+2
* small changes to dwm.1, rearranged order within main event loopAnselm R.Garbe2006-08-211-4/+4
* corrected order of cleanup code Anselm R.Garbe2006-08-161-1/+1
* we close stdin as wellAnselm R.Garbe2006-08-161-3/+4
* extended cleanupAnselm R.Garbe2006-08-151-0/+7
* applied jk_to_tab patchAnselm R.Garbe2006-08-151-2/+1
* changed main event loopAnselm R.Garbe2006-08-151-10/+7
* removed NUMLOCKMASK, added dynamically calculated numlockmask insteadAnselm R.Garbe2006-08-141-7/+19
* changed order of selecting input at root windowAnselm R.Garbe2006-08-141-4/+4
* removed unneecessary crapAnselm R.Garbe2006-08-141-1/+0
* some other small fixesAnselm R.Garbe2006-08-141-8/+8
* removed ungrabkeys again (because of sander's mail)Anselm R.Garbe2006-08-141-1/+0
* implemented ungrabkeys() which is called in cleanup()Anselm R.Garbe2006-08-141-0/+1
* supplying NULL args in selectAnselm R.Garbe2006-08-141-1/+1
* reducing ConnectionNumber calls to a bare minimumAnselm R.Garbe2006-08-141-4/+5
* implemented viewextend and added M-S-C-n shortcuts for extending the current ...Anselm R.Garbe2006-08-111-3/+3
te arg to schedule_save' href='/akkartik/view.love/commit/main_tests.lua?id=b7000215d8921490cb08ed64439a02e9f69770b5'>b700021 ^
d009390 ^



















2a0a770 ^
d009390 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
                             
                                        
                                             
                               
                                                  



                                                                                
                      
                                                    




                                                                             


                                                                                
                                     
                                        
                        





                                                  
                                              
                                           
                                   
                               
                                       

   
                                                         

                                                                   













                                                                              
                                   

                               



                                                                                 

   
                         
                                                          
                                             

















                                                           



                                                        
                         

   
                                        
                                                          
                                                                                 

                                               
                             



















                                                           
                                                        
   
function test_resize_window()
  App.screen.init{width=300, height=300}
  Editor_state = edit.initialize_test_state()
  Editor_state.filename = 'foo'
  Log_browser_state = edit.initialize_test_state()
  check_eq(App.screen.width, 300, 'baseline/width')
  check_eq(App.screen.height, 300, 'baseline/height')
  check_eq(Editor_state.left, Test_margin_left, 'baseline/left_margin')
  check_eq(Editor_state.right, 300 - Test_margin_right, 'baseline/right_margin')
  App.resize(200, 400)
  -- ugly; resize switches to real, non-test margins
  check_eq(App.screen.width, 200, 'width')
  check_eq(App.screen.height, 400, 'height')
  check_eq(Editor_state.left, Margin_left, 'left_margin')
  check_eq(Editor_state.right, 200-Margin_right, 'right_margin')
  check_eq(Editor_state.width, 200-Margin_left-Margin_right, 'drawing_width')
  -- TODO: how to make assertions about when App.update got past the early exit?
end

function test_show_log_browser_side()
  App.screen.init{width=300, height=300}
  Current_app = 'source'
  Editor_state = edit.initialize_test_state()
  Editor_state.filename = 'foo'
  Text.redraw_all(Editor_state)
  Log_browser_state = edit.initialize_test_state()
  Text.redraw_all(Log_browser_state)
  log_browser.parse(Log_browser_state)
  check(not Show_log_browser_side, 'baseline')
  -- pressing ctrl+l shows log-browser side
  Current_time = Current_time + 0.1
  App.run_after_keychord('C-l')
  check(Show_log_browser_side, 'check')
end

function test_show_log_browser_side_splits_window_width()
  -- initialize screen dimensions and indicate that it is maximized
  App.screen.init{width=300, height=300}
  -- initialize source app with left side occupying more than half the display
  Current_app = 'source'
  Editor_state = edit.initialize_test_state()
  Editor_state.filename = 'foo'
  Editor_state.left = Margin_left
  Editor_state.right = 200
  Text.redraw_all(Editor_state)
  Log_browser_state = edit.initialize_test_state()
  -- log browser has some arbitrary margins
  Log_browser_state.left = 200 + Margin_left
  Log_browser_state.right = 400
  Text.redraw_all(Log_browser_state)
  log_browser.parse(Log_browser_state)
  -- display log browser
  Current_time = Current_time + 0.1
  App.run_after_keychord('C-l')
  -- margins are now adjusted
  check_eq(Editor_state.left, Margin_left, 'edit:left')
  check_eq(Editor_state.right, App.screen.width/2 - Margin_right, 'edit:right')
  check_eq(Log_browser_state.left, App.screen.width/2 + Margin_left, 'log:left')
  check_eq(Log_browser_state.right, App.screen.width - Margin_right, 'log:right')
end

function test_drop_file()
  App.screen.init{width=Editor_state.left+300, height=300}
  Editor_state = edit.initialize_test_state()
  App.filesystem['foo'] = 'abc\ndef\nghi\n'
  local fake_dropped_file = {
    opened = false,
    getFilename = function(self)
                    return 'foo'
                  end,
    open = function(self)
             self.opened = true
           end,
    lines = function(self)
              assert(self.opened)
              return App.filesystem['foo']:gmatch('[^\n]+')
            end,
    close = function(self)
              self.opened = false
            end,
  }
  App.filedropped(fake_dropped_file)
  check_eq(#Editor_state.lines, 3, '#lines')
  check_eq(Editor_state.lines[1].data, 'abc', 'lines:1')
  check_eq(Editor_state.lines[2].data, 'def', 'lines:2')
  check_eq(Editor_state.lines[3].data, 'ghi', 'lines:3')
  edit.draw(Editor_state)
end

function test_drop_file_saves_previous()
  App.screen.init{width=Editor_state.left+300, height=300}
  -- initially editing a file called foo that hasn't been saved to filesystem yet
  Editor_state.lines = load_array{'abc', 'def'}
  Editor_state.filename = 'foo'
  schedule_save(Editor_state)
  -- now drag a new file bar from the filesystem
  App.filesystem['bar'] = 'abc\ndef\nghi\n'
  local fake_dropped_file = {
    opened = false,
    getFilename = function(self)
                    return 'bar'
                  end,
    open = function(self)
             self.opened = true
           end,
    lines = function(self)
              assert(self.opened)
              return App.filesystem['bar']:gmatch('[^\n]+')
            end,
    close = function(self)
              self.opened = false
            end,
  }
  App.filedropped(fake_dropped_file)
  -- filesystem now contains a file called foo
  check_eq(App.filesystem['foo'], 'abc\ndef\n', 'check')
end