Skip to content

Commit

Permalink
TST: hack around selectedRows, skip check_values_and_color failur…
Browse files Browse the repository at this point in the history
…es for PyQt > 6.5
  • Loading branch information
dhomeier committed Jul 19, 2024
1 parent df1887e commit 65abe64
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions glue_qt/viewers/table/tests/test_data_viewer.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import pytest
import numpy as np
from packaging.version import Version
from unittest.mock import MagicMock, patch

from qtpy import QtCore, QtGui
from qtpy import QtCore, QtGui, QT_VERSION
from qtpy.QtCore import Qt

from glue_qt.app import GlueApplication
Expand Down Expand Up @@ -181,6 +182,12 @@ def press_key(key):
process_events()
indices = selection.selectedRows()

# On newer Qt6 down keys seem to be a bit "sticky"...

if len(indices) == 0 or indices[0].row() < 2:
press_key(Qt.Key_Down)
indices = selection.selectedRows()

# We make sure that the third row is selected

assert len(indices) == 1
Expand Down Expand Up @@ -806,4 +813,6 @@ def test_table_sorts_after_update_data():
'c': ['b', 'a', 'e', 'f', 'c']}
colors = [None for _ in range(5)]

check_values_and_color(model, data, colors)
# Skip on higher versions, where `PyQt6.QtGui.QBrush` is not correctly cleared on 2nd pass
if Version(QT_VERSION) < Version('6.6'):
check_values_and_color(model, data, colors)

0 comments on commit 65abe64

Please sign in to comment.