From dfc8d59a999167e5ca41fae16741e3d0fda2e9cd Mon Sep 17 00:00:00 2001 From: tov101 Date: Wed, 11 Oct 2023 13:46:13 +0300 Subject: [PATCH] Add test. --- .../widgets/test_PlotWidget_ContextMenu.py | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/test/asammdf/gui/widgets/test_PlotWidget_ContextMenu.py b/test/asammdf/gui/widgets/test_PlotWidget_ContextMenu.py index b8c165d06..b9adaeee5 100644 --- a/test/asammdf/gui/widgets/test_PlotWidget_ContextMenu.py +++ b/test/asammdf/gui/widgets/test_PlotWidget_ContextMenu.py @@ -956,3 +956,39 @@ def test_Menu_ShowHide_Action_HideDisabledItems(self): ) # Evaluate self.assertTrue(self.plot_channel_b.isHidden()) + + def test_Menu_ShowHide_Action_ShowDisabledItems(self): + """ + Test Scope: + - Ensure that item is showed on channel selection when is disabled. + Events: + - Disable 1 channel by key Space + - Disable 1 channel by mouseClick on item CheckBox + Evaluate: + - Evaluate that items that are unchecked are not present anymore on channel selection + """ + + with self.subTest("DisableBySpace"): + self.context_menu(action_text="Hide disabled items") + # Select one channel + self.mouseClick_WidgetItem(self.plot_channel_a) + # Event + QtTest.QTest.keyClick(self.plot.channel_selection, QtCore.Qt.Key_Space) + # Evaluate + self.assertTrue(self.plot_channel_a.isHidden()) + self.context_menu(action_text="Show disabled items") + self.assertFalse(self.plot_channel_a.isHidden()) + + with self.subTest("DisableByClick"): + self.context_menu(action_text="Hide disabled items") + pos = self.plot.channel_selection.visualItemRect(self.plot_channel_b).center() + # Magic Number to detect center of checkbox + pos = QtCore.QPoint(28, pos.y()) + # Event + QtTest.QTest.mouseClick( + self.plot.channel_selection.viewport(), QtCore.Qt.LeftButton, QtCore.Qt.KeyboardModifiers(), pos + ) + # Evaluate + self.assertTrue(self.plot_channel_b.isHidden()) + self.context_menu(action_text="Show disabled items") + self.assertFalse(self.plot_channel_b.isHidden())