Skip to content

Commit

Permalink
debug ..10, evrika
Browse files Browse the repository at this point in the history
  • Loading branch information
FillBk committed Apr 5, 2024
1 parent 472be39 commit 116152e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
5 changes: 3 additions & 2 deletions test/asammdf/gui/widgets/test_BasePlotWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,10 @@ def wheel_action(self, w: QWidget, x: float, y: float, angle_delta: int):
"""
pos = QPointF(x, y)

global_pos = self.widget.mapToGlobal(pos)
x = global_pos.x()
global_pos.setX(x + pos.x())
x = self.widget.width()
global_pos.setX(x - pos.x())

pixel_d = QPoint(0, 0)
angle_d = QPoint(0, angle_delta * 120)
Expand Down
19 changes: 9 additions & 10 deletions test/asammdf/gui/widgets/test_PlotWidget_Shortcuts.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,8 @@ 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 : {pm} : pixmap")
self.assertTrue(Pixmap.is_black(self.plot.plot.viewport().grab()))

# case 1
self.mouseClick_WidgetItem(self.channels[0])
Expand Down Expand Up @@ -763,8 +762,8 @@ def test_Plot_Plot_Shortcut_Keys_Backspace__Shift_Backspace__Shift_W(self):
# Toggle full screen
self.widget.showMaximized()
self.processEvents()
x = self.plot.plot.width() / 2
y = self.plot.plot.height() / 2
x = round(self.plot.plot.width() / 2)
y = round(self.plot.plot.height() / 2)
# Y range at start
y_range = self.plot.plot.signals[0].y_range

Expand All @@ -781,29 +780,29 @@ def test_Plot_Plot_Shortcut_Keys_Backspace__Shift_Backspace__Shift_W(self):
QPoint(int(x), int(y)),
)
self.processEvents(0.01)
pm = self.plot.grab()
pm = Pixmap.color_map(self.plot.grab())
# Rotate mouse wheel
self.wheel_action(self.plot.plot.viewport(), x, y, -2)
self.wheel_action(self.plot.plot.viewport(), x, y, 2)
self.processEvents(0.01)

# Click on plot
QTest.mouseClick(
self.plot.plot.viewport(),
Qt.MouseButton.LeftButton,
Qt.KeyboardModifiers(),
QPoint(int(x * 0.2), int(y * 0.8)),
QPoint(int(x * 0.5), int(y * 0.8)),
)
self.processEvents(0.01)

# Rotate mouse wheel
self.wheel_action(self.plot.plot.viewport(), x, y, 1)
self.wheel_action(self.plot.plot.viewport(), x, y, -3)
self.processEvents(1)
self.processEvents(0.1)
pm_ = Pixmap.color_map(self.plot.grab())
new_y_range = self.plot.plot.signals[0].y_range
debug = f"pixmap : {pm} : pixmap ------------==========|==========------------ pixmap : {pm_} : pixmap "

# Evaluate
self.assertNotEqual(new_y_range[0] - new_y_range[1], y_range[0] - y_range[1], debug)
self.assertNotEqual(new_y_range[0] - new_y_range[1], y_range[0] - y_range[1])

# click on Backspace 2 times, IDK why, but the first hit didn't perform the necessary action
QTest.keySequence(self.plot, QKeySequence(self.shortcuts["undo_zoom"]))
Expand Down

0 comments on commit 116152e

Please sign in to comment.