@@ -248,16 +248,16 @@ def setUp(self):
248248 self ._registered_editors = {}
249249 self .creator = EditorCreator (self ._register )
250250 self .creator .register_editors ()
251-
251+ """
252252 for ridx, rdata in enumerate(DATA):
253253 for cidx, cdata in enumerate(rdata):
254254 self._grid.kweditor.write_cell(ridx, cidx, cdata, update_history=False)
255-
255+ """
256256 # Uncomment next line (and MainLoop in tests) if you want to see the app
257- self .frame .Show ()
257+ # self.frame.Show()
258258 self .SHOWING = True
259259 self .frame .Center ()
260- wx .CallLater (1000 , self .app .MainLoop )
260+ # wx.CallLater(1000, self.app.MainLoop)
261261
262262 def _register (self , iclass , eclass ):
263263 self ._registered_editors [iclass ] = eclass
@@ -294,6 +294,11 @@ def tearDown(self):
294294 if os .path .exists (DATADIR ):
295295 shutil .rmtree (DATADIR , ignore_errors = True )
296296
297+ def setup_data (self ):
298+ for ridx , rdata in enumerate (DATA ):
299+ for cidx , cdata in enumerate (rdata ):
300+ self ._grid .kweditor .write_cell (ridx , cidx , cdata , update_history = False )
301+
297302 """
298303 def test_enable(self):
299304 self.plugin.enable()
@@ -315,6 +320,8 @@ def test_disable(self):
315320 """
316321
317322 def test_show (self ):
323+ self .setup_data ()
324+ self .frame .Show ()
318325 # show = self.frame.Children
319326 # print(f"DEBUG: test_show is children={[n.Name for n in show]}")
320327 # tabs = self._grid.kweditor.GetParent().GetName()
@@ -323,10 +330,12 @@ def test_show(self):
323330 show = self ._grid .kweditor .has_focus ()
324331 assert show # is not None
325332 # Uncomment next lines if you want to see the app
326- # wx.CallLater(5000, self.app.ExitMainLoop)
333+ wx .CallLater (5000 , self .app .ExitMainLoop )
327334 # self.app.MainLoop()
328335
329336 def test_on_comment_cells (self ):
337+ self .setup_data ()
338+ self .frame .Show ()
330339 # self.creator.editor_for(self.app.plugin, self._panel, self.frame.tree)
331340 self ._grid .kweditor .SelectBlock (2 , 2 , 2 , 2 )
332341 sel = self ._grid .kweditor .selection
@@ -342,6 +351,8 @@ def test_on_comment_cells(self):
342351 """ Clipboard tests moved from test_grid.py to here """
343352 @pytest .mark .skip ()
344353 def test_copy_one_cell (self ):
354+ self .setup_data ()
355+ self .frame .Show ()
345356 print ("" )
346357 for row in range (3 ):
347358 text = f"{ row } : "
@@ -363,6 +374,8 @@ def test_copy_row(self):
363374
364375 @pytest .mark .skip ()
365376 def test_copy_block (self ):
377+ self .setup_data ()
378+ self .frame .Show ()
366379 self ._copy_block_and_verify ((0 , 0 , 2 , 2 ), DATA )
367380 # Uncomment next lines if you want to see the app
368381 # wx.CallLater(5000, self.app.ExitMainLoop)
@@ -376,22 +389,28 @@ def _copy_block_and_verify(self, block, exp_content):
376389 self ._verify_grid_content (DATA )
377390
378391 def test_cut_one_cell (self ):
392+ self .setup_data ()
393+ self .frame .Show ()
379394 self ._cut_block_and_verify ((0 , 0 , 0 , 0 ), [['kw1' ]],
380395 [['' , '' , '' ]] + DATA [1 :])
381396 # Uncomment next lines if you want to see the app
382397 # wx.CallLater(5000, self.app.ExitMainLoop)
383398 # self.app.MainLoop()
384399
385400 def test_cut_row (self ):
401+ self .setup_data ()
402+ self .frame .Show ()
386403 self ._cut_block_and_verify ((2 , 0 , 2 , 2 ), [DATA [2 ]], DATA [:2 ])
387404 # Uncomment next lines if you want to see the app
388405 # wx.CallLater(5000, self.app.ExitMainLoop)
389406 # self.app.MainLoop()
390407
391408 def test_cut_block (self ):
409+ self .setup_data ()
410+ self .frame .Show ()
392411 self ._cut_block_and_verify ((0 , 0 , 2 , 2 ), DATA , [])
393412 # Uncomment next lines if you want to see the app
394- # wx.CallLater(5000, self.app.ExitMainLoop)
413+ wx .CallLater (5000 , self .app .ExitMainLoop )
395414 # self.app.MainLoop()
396415
397416 def _cut_block_and_verify (self , block , exp_clipboard , exp_grid ):
@@ -401,6 +420,8 @@ def _cut_block_and_verify(self, block, exp_clipboard, exp_grid):
401420 self ._verify_grid_content (exp_grid )
402421
403422 def test_undo_with_cut (self ):
423+ self .setup_data ()
424+ self .frame .Show ()
404425 self ._cut_block ((0 , 0 , 0 , 0 ))
405426 self ._grid .kweditor .undo ()
406427 self ._verify_grid_content (DATA )
@@ -418,6 +439,8 @@ def test_undo_with_cut(self):
418439 # self.app.MainLoop()
419440
420441 def test_multiple_levels_of_undo (self ):
442+ self .setup_data ()
443+ self .frame .Show ()
421444 self ._cut_block ((0 , 0 , 0 , 0 ))
422445 self ._cut_block ((2 , 0 , 2 , 2 ))
423446 # We have problems here. We need undo for each cell removed
@@ -436,6 +459,8 @@ def _cut_block(self, block):
436459 self ._grid .kweditor .cut ()
437460
438461 def test_paste_one_cell (self ):
462+ self .setup_data ()
463+ self .frame .Show ()
439464 self ._copy_and_paste_block ((1 , 0 , 1 , 0 ), (3 , 0 , 3 , 0 ), DATA + [['kw2' ]])
440465 # These tests are not independent
441466 self ._copy_and_paste_block ((1 , 0 , 1 , 0 ), (0 , 3 , 0 , 3 ),
@@ -445,19 +470,25 @@ def test_paste_one_cell(self):
445470 # self.app.MainLoop()
446471
447472 def test_paste_row (self ):
473+ self .setup_data ()
474+ self .frame .Show ()
448475 self ._copy_and_paste_block ((2 , 0 , 2 , 2 ), (3 , 1 , 3 , 1 ), DATA + [['' ] + DATA [2 ]])
449476 # Uncomment next lines if you want to see the app
450477 # wx.CallLater(5000, self.app.ExitMainLoop)
451478 # self.app.MainLoop()
452479
453480 def test_paste_block (self ):
481+ self .setup_data ()
482+ self .frame .Show ()
454483 self ._copy_and_paste_block ((0 , 0 , 2 , 2 ), (4 , 0 , 4 , 0 ), DATA + [['' ]] + DATA )
455484 # Uncomment next lines if you want to see the app
456485 # wx.CallLater(5000, self.app.ExitMainLoop)
457486 # self.app.MainLoop()
458487
459488 # @pytest.mark.skip()
460489 def test_paste_over (self ):
490+ self .setup_data ()
491+ self .frame .Show ()
461492 self ._copy_and_paste_block ((1 , 0 , 1 , 1 ), (0 , 0 , 0 , 0 ), [DATA [1 ]] + DATA [1 :])
462493 # Uncomment next lines if you want to see the app
463494 # wx.CallLater(5000, self.app.ExitMainLoop)
@@ -480,6 +511,8 @@ def _verify_grid_content(self, data):
480511 assert value == ''
481512
482513 def test_simple_undo (self ):
514+ self .setup_data ()
515+ self .frame .Show ()
483516 self ._grid .kweditor .SelectBlock (* (0 , 0 , 0 , 0 ))
484517 self ._grid .kweditor .cut ()
485518 self ._grid .kweditor .undo ()
@@ -490,7 +523,8 @@ def test_simple_undo(self):
490523
491524 # @pytest.mark.skip()
492525 def test_contentassist_dialog (self ):
493- suggestions = SuggestionSource (None , self .app .project .controller )
526+ suggestions = SuggestionSource (None , self .test_case )
527+ suggestions .update_from_local (['No Operation' , 'Log Many' , 'Log' , '${CURDIR}' ], 'en' )
494528 dlg = ContentAssistPopup (self ._grid .kweditor , suggestions )
495529 dlg .show (600 , 400 , 20 )
496530 result = dlg .content_assist_for ('Log Many' )
@@ -500,6 +534,10 @@ def test_contentassist_dialog(self):
500534 dlg ._move_x_where_room (800 )
501535 dlg ._move_y_where_room (400 , 20 )
502536 # dlg.reset()
537+ value = dlg .content_assist_value ('${CUR' )
538+ dlg .select_and_scroll (wx .WXK_DOWN )
539+ dlg .dismiss ()
540+ dlg .hide ()
503541 # wx.CallLater(4000, dlg.hide)
504542 # Uncomment next lines if you want to see the app
505543 # wx.CallLater(5000, self.app.ExitMainLoop)
0 commit comments