Skip to content

Commit 8b0a4e1

Browse files
fix test cases in kweditor
1 parent 470c192 commit 8b0a4e1

File tree

1 file changed

+29
-30
lines changed

1 file changed

+29
-30
lines changed

utest/editor/test_z_kweditor_plugin.py

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@
9999
app.settings = FakeSettings()
100100
app.register_editor()
101101
"""
102-
generic_app = wx.App()
103102

104103
DATA = [['kw1', '', ''],
105104
['kw2', 'arg1', ''],
@@ -302,7 +301,7 @@ def test_enable(self):
302301
def test_is_focused(self):
303302
focused = self.plugin.is_focused()
304303
assert focused is True
305-
wx.CallLater(5000, self.app.ExitMainLoop)
304+
# wx.CallLater(5000, self.app.ExitMainLoop)
306305
# self.app.MainLoop()
307306
"""
308307

@@ -324,7 +323,7 @@ def test_show(self):
324323
show = self._grid.kweditor.has_focus()
325324
assert show # is not None
326325
# Uncomment next lines if you want to see the app
327-
wx.CallLater(5000, self.app.ExitMainLoop)
326+
# wx.CallLater(5000, self.app.ExitMainLoop)
328327
# self.app.MainLoop()
329328

330329
def test_on_comment_cells(self):
@@ -336,7 +335,7 @@ def test_on_comment_cells(self):
336335
self._grid.kweditor.on_comment_cells(None) # THIS IS NOT WORKING
337336
data = self._grid.kweditor.get_selected_content()
338337
print(f"DEBUG: After Sharp Comment Data Cell is {data}")
339-
wx.CallLater(5000, self.app.ExitMainLoop)
338+
# wx.CallLater(5000, self.app.ExitMainLoop)
340339
# self.app.MainLoop()
341340

342341

@@ -352,21 +351,21 @@ def test_copy_one_cell(self):
352351
print(f"{text}")
353352
self._copy_block_and_verify((0, 0, 0, 0), [['kw1']])
354353
# Uncomment next lines if you want to see the app
355-
wx.CallLater(5000, self.app.ExitMainLoop)
354+
# wx.CallLater(5000, self.app.ExitMainLoop)
356355
# self.app.MainLoop()
357356

358357
@pytest.mark.skip()
359358
def test_copy_row(self):
360359
self._copy_block_and_verify((1, 0, 1, 1), [[val for val in DATA[1] if val]])
361360
# Uncomment next lines if you want to see the app
362-
wx.CallLater(5000, self.app.ExitMainLoop)
361+
# wx.CallLater(5000, self.app.ExitMainLoop)
363362
# self.app.MainLoop()
364363

365364
@pytest.mark.skip()
366365
def test_copy_block(self):
367366
self._copy_block_and_verify((0, 0, 2, 2), DATA)
368367
# Uncomment next lines if you want to see the app
369-
wx.CallLater(5000, self.app.ExitMainLoop)
368+
# wx.CallLater(5000, self.app.ExitMainLoop)
370369
# self.app.MainLoop()
371370

372371
def _copy_block_and_verify(self, block, exp_content):
@@ -380,19 +379,19 @@ def test_cut_one_cell(self):
380379
self._cut_block_and_verify((0, 0, 0, 0), [['kw1']],
381380
[['', '', '']] + DATA[1:])
382381
# Uncomment next lines if you want to see the app
383-
wx.CallLater(5000, self.app.ExitMainLoop)
382+
# wx.CallLater(5000, self.app.ExitMainLoop)
384383
# self.app.MainLoop()
385384

386385
def test_cut_row(self):
387386
self._cut_block_and_verify((2, 0, 2, 2), [DATA[2]], DATA[:2])
388387
# Uncomment next lines if you want to see the app
389-
wx.CallLater(5000, self.app.ExitMainLoop)
388+
# wx.CallLater(5000, self.app.ExitMainLoop)
390389
# self.app.MainLoop()
391390

392391
def test_cut_block(self):
393392
self._cut_block_and_verify((0, 0, 2, 2), DATA, [])
394393
# Uncomment next lines if you want to see the app
395-
wx.CallLater(5000, self.app.ExitMainLoop)
394+
# wx.CallLater(5000, self.app.ExitMainLoop)
396395
# self.app.MainLoop()
397396

398397
def _cut_block_and_verify(self, block, exp_clipboard, exp_grid):
@@ -415,7 +414,7 @@ def test_undo_with_cut(self):
415414
self._grid.kweditor.undo()
416415
self._verify_grid_content(DATA)
417416
# Uncomment next lines if you want to see the app
418-
wx.CallLater(5000, self.app.ExitMainLoop)
417+
# wx.CallLater(5000, self.app.ExitMainLoop)
419418
# self.app.MainLoop()
420419

421420
def test_multiple_levels_of_undo(self):
@@ -429,7 +428,7 @@ def test_multiple_levels_of_undo(self):
429428
self._grid.kweditor.undo()
430429
self._verify_grid_content(DATA)
431430
# Uncomment next lines if you want to see the app
432-
wx.CallLater(5000, self.app.ExitMainLoop)
431+
# wx.CallLater(5000, self.app.ExitMainLoop)
433432
# self.app.MainLoop()
434433

435434
def _cut_block(self, block):
@@ -442,26 +441,26 @@ def test_paste_one_cell(self):
442441
self._copy_and_paste_block((1, 0, 1, 0), (0, 3, 0, 3),
443442
[DATA[0] + ['kw2']] + DATA[1:] + [['kw2']])
444443
# Uncomment next lines if you want to see the app
445-
wx.CallLater(5000, self.app.ExitMainLoop)
444+
# wx.CallLater(5000, self.app.ExitMainLoop)
446445
# self.app.MainLoop()
447446

448447
def test_paste_row(self):
449448
self._copy_and_paste_block((2, 0, 2, 2), (3, 1, 3, 1), DATA + [[''] + DATA[2]])
450449
# Uncomment next lines if you want to see the app
451-
wx.CallLater(5000, self.app.ExitMainLoop)
450+
# wx.CallLater(5000, self.app.ExitMainLoop)
452451
# self.app.MainLoop()
453452

454453
def test_paste_block(self):
455454
self._copy_and_paste_block((0, 0, 2, 2), (4, 0, 4, 0), DATA + [['']] + DATA)
456455
# Uncomment next lines if you want to see the app
457-
wx.CallLater(5000, self.app.ExitMainLoop)
456+
# wx.CallLater(5000, self.app.ExitMainLoop)
458457
# self.app.MainLoop()
459458

460459
# @pytest.mark.skip()
461460
def test_paste_over(self):
462461
self._copy_and_paste_block((1, 0, 1, 1), (0, 0, 0, 0), [DATA[1]] + DATA[1:])
463462
# Uncomment next lines if you want to see the app
464-
wx.CallLater(5000, self.app.ExitMainLoop)
463+
# wx.CallLater(5000, self.app.ExitMainLoop)
465464
# self.app.MainLoop()
466465

467466
def _copy_and_paste_block(self, sourceblock, targetblock, exp_content):
@@ -486,7 +485,7 @@ def test_simple_undo(self):
486485
self._grid.kweditor.undo()
487486
self._verify_grid_content(DATA)
488487
# Uncomment next lines if you want to see the app
489-
wx.CallLater(5000, self.app.ExitMainLoop)
488+
# wx.CallLater(5000, self.app.ExitMainLoop)
490489
# self.app.MainLoop()
491490

492491
# @pytest.mark.skip()
@@ -500,10 +499,10 @@ def test_contentassist_dialog(self):
500499
assert shown is True
501500
dlg._move_x_where_room(800)
502501
dlg._move_y_where_room(400, 20)
503-
dlg.reset()
504-
wx.CallLater(4000, dlg.hide)
502+
# dlg.reset()
503+
# wx.CallLater(4000, dlg.hide)
505504
# Uncomment next lines if you want to see the app
506-
wx.CallLater(5000, self.app.ExitMainLoop)
505+
# wx.CallLater(5000, self.app.ExitMainLoop)
507506
# self.app.MainLoop()
508507

509508
def test_htmlpopupwindow_dialog_simple(self):
@@ -513,9 +512,9 @@ def test_htmlpopupwindow_dialog_simple(self):
513512
shown=dlg.IsShown()
514513
print(f"DEBUG: test_z_kweditor.py: test_htmlpopupwindow_dialog_simple shown={shown}")
515514
assert shown is True
516-
wx.CallLater(4000, dlg.hide)
515+
# wx.CallLater(4000, dlg.hide)
517516
# Uncomment next lines if you want to see the app
518-
wx.CallLater(5000, self.app.ExitMainLoop)
517+
# wx.CallLater(5000, self.app.ExitMainLoop)
519518
# self.app.MainLoop()
520519

521520
def test_htmlpopupwindow_dialog_title(self):
@@ -531,9 +530,9 @@ def test_htmlpopupwindow_dialog_title(self):
531530
dlg._detach(event)
532531
title = dlg._detached_title
533532
print(f"DEBUG: test_z_kweditor.py: test_htmlpopupwindow_dialog_title title={title}")
534-
wx.CallLater(4000, dlg.hide)
533+
# wx.CallLater(4000, dlg.hide)
535534
# Uncomment next lines if you want to see the app
536-
wx.CallLater(5000, self.app.ExitMainLoop)
535+
# wx.CallLater(5000, self.app.ExitMainLoop)
537536
# self.app.MainLoop()
538537

539538
def test_contentassist_text_editor(self):
@@ -545,7 +544,7 @@ def test_contentassist_text_editor(self):
545544
print(f"DEBUG: test_z_kweditor.py: test_contentassist_text_editor result={result} shown={shown}")
546545
# assert shown is True
547546
# Uncomment next lines if you want to see the app
548-
wx.CallLater(5000, self.app.ExitMainLoop)
547+
# wx.CallLater(5000, self.app.ExitMainLoop)
549548
# self.app.MainLoop()
550549

551550
def test_contentassist_text_ctrl(self):
@@ -557,7 +556,7 @@ def test_contentassist_text_ctrl(self):
557556
print(f"DEBUG: test_z_kweditor.py: test_contentassist_text_ctrl result={result} shown={shown}")
558557
# assert shown is True
559558
# Uncomment next lines if you want to see the app
560-
wx.CallLater(5000, self.app.ExitMainLoop)
559+
# wx.CallLater(5000, self.app.ExitMainLoop)
561560
# self.app.MainLoop()
562561

563562
# @pytest.mark.skip()
@@ -570,7 +569,7 @@ def test_contentassist_expandotextctrl(self):
570569
print(f"DEBUG: test_z_kweditor.py: test_contentassist_text_ctrl result={result} shown={shown}")
571570
# assert shown is True
572571
# Uncomment next lines if you want to see the app
573-
wx.CallLater(5000, self.app.ExitMainLoop)
572+
# wx.CallLater(5000, self.app.ExitMainLoop)
574573
# self.app.MainLoop()
575574

576575
def test_contentassist_file_button(self):
@@ -582,14 +581,14 @@ def test_contentassist_file_button(self):
582581
print(f"DEBUG: test_z_kweditor.py: test_contentassist_text_editor result={result} shown={shown}")
583582
# assert shown is True
584583
# Uncomment next lines if you want to see the app
585-
wx.CallLater(5000, self.app.ExitMainLoop)
584+
# wx.CallLater(5000, self.app.ExitMainLoop)
586585
# self.app.MainLoop()
587586

588587
def test_get_resources(self):
589588
res = self.creator._only_resource_files(self.app.tree)
590589
print(f"DEBUG: test_edit_creator.py EditorCreatorTest test_get_resources res={res}")
591590
# Uncomment next lines if you want to see the app
592-
wx.CallLater(5000, self.app.ExitMainLoop)
591+
# wx.CallLater(5000, self.app.ExitMainLoop)
593592
# self.app.MainLoop()
594593

595594
# @pytest.mark.skip()
@@ -609,7 +608,7 @@ def test_miscellanous(self):
609608
self._grid.kweditor._resize_grid()
610609

611610
# Uncomment next lines if you want to see the app
612-
wx.CallLater(5000, self.app.ExitMainLoop)
611+
# wx.CallLater(5000, self.app.ExitMainLoop)
613612
# self.app.MainLoop()
614613

615614
if __name__ == '__main__':

0 commit comments

Comments
 (0)