Skip to content

Commit

Permalink
debug ..8, 0_0 -_- 0_0 -_- 0_0 -_- 0_0
Browse files Browse the repository at this point in the history
  • Loading branch information
FillBk committed Apr 5, 2024
1 parent f9d4381 commit c929764
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
16 changes: 8 additions & 8 deletions test/asammdf/gui/widgets/test_FileWidget_Shortcuts.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,33 +390,33 @@ def test_FileWidget_Shortcut_Key_Period(self):
)[0]
rect = QRect(x - 4, y - 4, 11, 10)
# One dot + 1 pixel surface
pm = Pixmap.color_map(plot.plot.grab(rect))
pm_with_dots = Pixmap.color_map(plot.plot.grab(rect))
# Black coverage
with_dots_black_coverage = 0
for cov in pm.values():
for cov in pm_with_dots.values():
with_dots_black_coverage += cov.count(Pixmap.COLOR_BACKGROUND)

# Event
QTest.keySequence(self.widget, QKeySequence(self.shortcuts["set_line_style"]))
self.processEvents(0.1)
# Gat new pixmap
pm = Pixmap.color_map(plot.plot.grab(rect))
pm_without_dots = Pixmap.color_map(plot.plot.grab(rect))
# New black coverage
without_dots_black_coverage = 0
for cov in pm.values():
for cov in pm_without_dots.values():
without_dots_black_coverage += cov.count(Pixmap.COLOR_BACKGROUND)

debug = f"pixmap : {pm_with_dots} : pixmap || pixmap : {pm_without_dots} : pixmap"
# Evaluate
self.assertGreater(without_dots_black_coverage, with_dots_black_coverage)
self.assertGreater(without_dots_black_coverage, with_dots_black_coverage, debug)

# Event
QTest.keySequence(self.widget, QKeySequence(self.shortcuts["set_line_style"]))
self.processEvents(0.1)
# Gat new pixmap
pm = Pixmap.color_map(plot.plot.grab(rect))
pm_with_dots = Pixmap.color_map(plot.plot.grab(rect))
# New black coverage
new_with_dots_black_coverage = 0
for cov in pm.values():
for cov in pm_with_dots.values():
new_with_dots_black_coverage += cov.count(Pixmap.COLOR_BACKGROUND)

# Evaluate
Expand Down
12 changes: 9 additions & 3 deletions test/asammdf/gui/widgets/test_PlotWidget_Shortcuts.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ def test_Plot_Plot_Shortcut_Key_2(self):
self.processEvents(1)
for _ in range(100):
self.processEvents(0.01)

pm = Pixmap.color_map(self.widget.grab())
# Evaluate
self.assertTrue(Pixmap.is_black(self.plot.plot.viewport().grab()), f"pixmap : {self.widget.grab()} : pixmap")
self.assertTrue(Pixmap.is_black(self.plot.plot.viewport().grab()), f"pixmap : {pm} : pixmap")

# case 1
self.mouseClick_WidgetItem(self.channels[0])
Expand Down Expand Up @@ -748,11 +748,13 @@ def test_Plot_Plot_Shortcut_Keys_Backspace__Shift_Backspace__Shift_W(self):
- Evaluate that after pressing key "Backspace", y_range isn't equal with previous ranges
"""
# Setup
self.widget.showMaximized()
if not self.plot.focused_mode_btn.isFlat():
QTest.mouseClick(self.plot.focused_mode_btn, Qt.MouseButton.LeftButton)
self.plot.plot.viewbox.menu.set_x_zoom_mode(True)
self.plot.plot.viewbox.menu.set_y_zoom_mode(True)
self.plot.plot.viewbox.setMouseMode(3)
self.plot.plot.setFocus()
self.processEvents(0.1)
# add channel to plot
self.assertIsNotNone(self.add_channels([35]))
# Toggle full screen
Expand All @@ -764,6 +766,10 @@ def test_Plot_Plot_Shortcut_Keys_Backspace__Shift_Backspace__Shift_W(self):
y_range = self.plot.plot.signals[0].y_range

# Events
self.mouseClick_WidgetItem(self.channels[0])
self.processEvents(1)
for _ in range(100):
self.processEvents(0.01)
# Click in the center of the plot
QTest.mouseClick(
self.plot.plot.viewport(),
Expand Down

0 comments on commit c929764

Please sign in to comment.