@@ -39,27 +39,27 @@ public void AllowEdits_Edits_ApplyEdits ()
39
39
// Needed because HexView relies on LayoutComplete to calc sizes
40
40
hv . LayoutSubviews ( ) ;
41
41
42
- Assert . True ( Application . OnKeyDown ( Key . Tab ) ) ; // Move to left side
42
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . Tab ) ) ; // Move to left side
43
43
44
44
Assert . Empty ( hv . Edits ) ;
45
45
hv . AllowEdits = false ;
46
- Assert . True ( Application . OnKeyDown ( Key . Home ) ) ;
47
- Assert . False ( Application . OnKeyDown ( Key . A ) ) ;
46
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . Home ) ) ;
47
+ Assert . False ( Application . RaiseKeyDownEvent ( Key . A ) ) ;
48
48
Assert . Empty ( hv . Edits ) ;
49
49
Assert . Equal ( 126 , hv . Source ! . Length ) ;
50
50
51
51
hv . AllowEdits = true ;
52
- Assert . True ( Application . OnKeyDown ( Key . D4 ) ) ;
53
- Assert . True ( Application . OnKeyDown ( Key . D1 ) ) ;
52
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . D4 ) ) ;
53
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . D1 ) ) ;
54
54
Assert . Single ( hv . Edits ) ;
55
55
Assert . Equal ( 65 , hv . Edits . ToList ( ) [ 0 ] . Value ) ;
56
56
Assert . Equal ( 'A' , ( char ) hv . Edits . ToList ( ) [ 0 ] . Value ) ;
57
57
Assert . Equal ( 126 , hv . Source . Length ) ;
58
58
59
59
// Appends byte
60
- Assert . True ( Application . OnKeyDown ( Key . End ) ) ;
61
- Assert . True ( Application . OnKeyDown ( Key . D4 ) ) ;
62
- Assert . True ( Application . OnKeyDown ( Key . D2 ) ) ;
60
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . End ) ) ;
61
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . D4 ) ) ;
62
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . D2 ) ) ;
63
63
Assert . Equal ( 2 , hv . Edits . Count ) ;
64
64
Assert . Equal ( 66 , hv . Edits . ToList ( ) [ 1 ] . Value ) ;
65
65
Assert . Equal ( 'B' , ( char ) hv . Edits . ToList ( ) [ 1 ] . Value ) ;
@@ -100,15 +100,15 @@ public void ApplyEdits_With_Argument ()
100
100
hv . Source . Read ( readBuffer ) ;
101
101
Assert . Equal ( "Fest" , Encoding . Default . GetString ( readBuffer ) ) ;
102
102
103
- Assert . True ( Application . OnKeyDown ( Key . Tab ) ) ; // Move to left side
104
- Assert . True ( Application . OnKeyDown ( Key . D5 ) ) ;
105
- Assert . True ( Application . OnKeyDown ( Key . D4 ) ) ;
103
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . Tab ) ) ; // Move to left side
104
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . D5 ) ) ;
105
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . D4 ) ) ;
106
106
readBuffer [ hv . Edits . ToList ( ) [ 0 ] . Key ] = hv . Edits . ToList ( ) [ 0 ] . Value ;
107
107
Assert . Equal ( "Test" , Encoding . Default . GetString ( readBuffer ) ) ;
108
108
109
- Assert . True ( Application . OnKeyDown ( Key . Tab ) ) ; // Move to right side
110
- Assert . True ( Application . OnKeyDown ( Key . CursorLeft ) ) ;
111
- Assert . True ( Application . OnKeyDown ( Key . Z . WithShift ) ) ;
109
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . Tab ) ) ; // Move to right side
110
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . CursorLeft ) ) ;
111
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . Z . WithShift ) ) ;
112
112
readBuffer [ hv . Edits . ToList ( ) [ 0 ] . Key ] = hv . Edits . ToList ( ) [ 0 ] . Value ;
113
113
Assert . Equal ( "Zest" , Encoding . Default . GetString ( readBuffer ) ) ;
114
114
@@ -157,21 +157,21 @@ public void Position_Encoding_Default ()
157
157
158
158
Assert . Equal ( new ( 0 , 0 ) , hv . Position ) ;
159
159
160
- Assert . True ( Application . OnKeyDown ( Key . Tab ) ) ;
160
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . Tab ) ) ;
161
161
Assert . Equal ( new ( 0 , 0 ) , hv . Position ) ;
162
162
163
- Assert . True ( Application . OnKeyDown ( Key . CursorRight . WithCtrl ) ) ;
163
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . CursorRight . WithCtrl ) ) ;
164
164
Assert . Equal ( hv . BytesPerLine - 1 , hv . Position . X ) ;
165
165
166
- Assert . True ( Application . OnKeyDown ( Key . Home ) ) ;
166
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . Home ) ) ;
167
167
168
- Assert . True ( Application . OnKeyDown ( Key . CursorRight ) ) ;
168
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . CursorRight ) ) ;
169
169
Assert . Equal ( new ( 1 , 0 ) , hv . Position ) ;
170
170
171
- Assert . True ( Application . OnKeyDown ( Key . CursorDown ) ) ;
171
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . CursorDown ) ) ;
172
172
Assert . Equal ( new ( 1 , 1 ) , hv . Position ) ;
173
173
174
- Assert . True ( Application . OnKeyDown ( Key . End ) ) ;
174
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . End ) ) ;
175
175
Assert . Equal ( new ( 3 , 3 ) , hv . Position ) ;
176
176
177
177
Assert . Equal ( hv . Source ! . Length , hv . Address ) ;
@@ -195,20 +195,20 @@ public void Position_Encoding_Unicode ()
195
195
196
196
Assert . Equal ( new ( 0 , 0 ) , hv . Position ) ;
197
197
198
- Assert . True ( Application . OnKeyDown ( Key . Tab ) ) ;
198
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . Tab ) ) ;
199
199
200
- Assert . True ( Application . OnKeyDown ( Key . CursorRight . WithCtrl ) ) ;
200
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . CursorRight . WithCtrl ) ) ;
201
201
Assert . Equal ( hv . BytesPerLine - 1 , hv . Position . X ) ;
202
202
203
- Assert . True ( Application . OnKeyDown ( Key . Home ) ) ;
203
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . Home ) ) ;
204
204
205
- Assert . True ( Application . OnKeyDown ( Key . CursorRight ) ) ;
205
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . CursorRight ) ) ;
206
206
Assert . Equal ( new ( 1 , 0 ) , hv . Position ) ;
207
207
208
- Assert . True ( Application . OnKeyDown ( Key . CursorDown ) ) ;
208
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . CursorDown ) ) ;
209
209
Assert . Equal ( new ( 1 , 1 ) , hv . Position ) ;
210
210
211
- Assert . True ( Application . OnKeyDown ( Key . End ) ) ;
211
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . End ) ) ;
212
212
Assert . Equal ( new ( 6 , 6 ) , hv . Position ) ;
213
213
214
214
Assert . Equal ( hv . Source ! . Length , hv . Address ) ;
@@ -297,42 +297,42 @@ public void KeyBindings_Test_Movement_LeftSide ()
297
297
Assert . Equal ( 4 , hv . BytesPerLine ) ;
298
298
299
299
// Default internal focus is on right side. Move back to left.
300
- Assert . True ( Application . OnKeyDown ( Key . Tab . WithShift ) ) ;
300
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . Tab . WithShift ) ) ;
301
301
302
- Assert . True ( Application . OnKeyDown ( Key . CursorRight ) ) ;
302
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . CursorRight ) ) ;
303
303
Assert . Equal ( 1 , hv . Address ) ;
304
304
305
- Assert . True ( Application . OnKeyDown ( Key . CursorLeft ) ) ;
305
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . CursorLeft ) ) ;
306
306
Assert . Equal ( 0 , hv . Address ) ;
307
307
308
- Assert . True ( Application . OnKeyDown ( Key . CursorDown ) ) ;
308
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . CursorDown ) ) ;
309
309
Assert . Equal ( 4 , hv . Address ) ;
310
310
311
- Assert . True ( Application . OnKeyDown ( Key . CursorUp ) ) ;
311
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . CursorUp ) ) ;
312
312
Assert . Equal ( 0 , hv . Address ) ;
313
313
314
- Assert . True ( Application . OnKeyDown ( Key . PageDown ) ) ;
314
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . PageDown ) ) ;
315
315
Assert . Equal ( 40 , hv . Address ) ;
316
316
317
- Assert . True ( Application . OnKeyDown ( Key . PageUp ) ) ;
317
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . PageUp ) ) ;
318
318
Assert . Equal ( 0 , hv . Address ) ;
319
319
320
- Assert . True ( Application . OnKeyDown ( Key . End ) ) ;
320
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . End ) ) ;
321
321
Assert . Equal ( MEM_STRING_LENGTH , hv . Address ) ;
322
322
323
- Assert . True ( Application . OnKeyDown ( Key . Home ) ) ;
323
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . Home ) ) ;
324
324
Assert . Equal ( 0 , hv . Address ) ;
325
325
326
- Assert . True ( Application . OnKeyDown ( Key . CursorRight . WithCtrl ) ) ;
326
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . CursorRight . WithCtrl ) ) ;
327
327
Assert . Equal ( 3 , hv . Address ) ;
328
328
329
- Assert . True ( Application . OnKeyDown ( Key . CursorLeft . WithCtrl ) ) ;
329
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . CursorLeft . WithCtrl ) ) ;
330
330
Assert . Equal ( 0 , hv . Address ) ;
331
331
332
- Assert . True ( Application . OnKeyDown ( Key . CursorDown . WithCtrl ) ) ;
332
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . CursorDown . WithCtrl ) ) ;
333
333
Assert . Equal ( 36 , hv . Address ) ;
334
334
335
- Assert . True ( Application . OnKeyDown ( Key . CursorUp . WithCtrl ) ) ;
335
+ Assert . True ( Application . RaiseKeyDownEvent ( Key . CursorUp . WithCtrl ) ) ;
336
336
Assert . Equal ( 0 , hv . Address ) ;
337
337
Application . Top . Dispose ( ) ;
338
338
Application . ResetState ( true ) ;
0 commit comments