summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2014-10-23 17:44:57 +0200
committerFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2014-10-28 12:56:39 +0100
commit50bba2fbfb7e80d9aa8d6da2575e8617e9b7471c (patch)
tree229f14608bc5d3badb8bd13ed7e9adb00ac67797 /tests
parent1abcc1cd3d1a8d04ccfd711c3293d0c671af3c78 (diff)
Fix tst_QAccessibility::abstractScrollAreaTest for OS X 10.9
OS X now has a setting (General->Show scroll bars) to use only transient scroll bars. Task-number: QTBUG-41340 Change-Id: Iffe30e9d601c169d955a380002743bab518f41ea Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/other/qaccessibility/BLACKLIST2
-rw-r--r--tests/auto/other/qaccessibility/tst_qaccessibility.cpp38
2 files changed, 24 insertions, 16 deletions
diff --git a/tests/auto/other/qaccessibility/BLACKLIST b/tests/auto/other/qaccessibility/BLACKLIST
deleted file mode 100644
index 11598aece6..0000000000
--- a/tests/auto/other/qaccessibility/BLACKLIST
+++ /dev/null
@@ -1,2 +0,0 @@
-[abstractScrollAreaTest]
-osx
diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
index e6bcc33771..ef70509541 100644
--- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
+++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
@@ -2654,57 +2654,67 @@ void tst_QAccessibility::abstractScrollAreaTest()
// Horizontal scrollBar.
abstractScrollArea.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
- QCOMPARE(interface->childCount(), 2);
QWidget *horizontalScrollBar = abstractScrollArea.horizontalScrollBar();
+
+ // On OS X >= 10.9 the scrollbar will be hidden unless explicitly enabled in the preferences
+ bool scrollBarsVisible = !horizontalScrollBar->style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, horizontalScrollBar);
+ int childCount = scrollBarsVisible ? 2 : 1;
+ QCOMPARE(interface->childCount(), childCount);
QWidget *horizontalScrollBarContainer = horizontalScrollBar->parentWidget();
- QVERIFY(verifyChild(horizontalScrollBarContainer, interface, 1, globalGeometry));
+ if (scrollBarsVisible)
+ QVERIFY(verifyChild(horizontalScrollBarContainer, interface, 1, globalGeometry));
// Horizontal scrollBar widgets.
QLabel *secondLeftLabel = new QLabel(QLatin1String("L2"));
abstractScrollArea.addScrollBarWidget(secondLeftLabel, Qt::AlignLeft);
- QCOMPARE(interface->childCount(), 2);
+ QCOMPARE(interface->childCount(), childCount);
QLabel *firstLeftLabel = new QLabel(QLatin1String("L1"));
abstractScrollArea.addScrollBarWidget(firstLeftLabel, Qt::AlignLeft);
- QCOMPARE(interface->childCount(), 2);
+ QCOMPARE(interface->childCount(), childCount);
QLabel *secondRightLabel = new QLabel(QLatin1String("R2"));
abstractScrollArea.addScrollBarWidget(secondRightLabel, Qt::AlignRight);
- QCOMPARE(interface->childCount(), 2);
+ QCOMPARE(interface->childCount(), childCount);
QLabel *firstRightLabel = new QLabel(QLatin1String("R1"));
abstractScrollArea.addScrollBarWidget(firstRightLabel, Qt::AlignRight);
- QCOMPARE(interface->childCount(), 2);
+ QCOMPARE(interface->childCount(), childCount);
// Vertical scrollBar.
abstractScrollArea.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
- QCOMPARE(interface->childCount(), 3);
+ if (scrollBarsVisible)
+ ++childCount;
+ QCOMPARE(interface->childCount(), childCount);
QWidget *verticalScrollBar = abstractScrollArea.verticalScrollBar();
QWidget *verticalScrollBarContainer = verticalScrollBar->parentWidget();
- QVERIFY(verifyChild(verticalScrollBarContainer, interface, 2, globalGeometry));
+ if (scrollBarsVisible)
+ QVERIFY(verifyChild(verticalScrollBarContainer, interface, 2, globalGeometry));
// Vertical scrollBar widgets.
QLabel *secondTopLabel = new QLabel(QLatin1String("T2"));
abstractScrollArea.addScrollBarWidget(secondTopLabel, Qt::AlignTop);
- QCOMPARE(interface->childCount(), 3);
+ QCOMPARE(interface->childCount(), childCount);
QLabel *firstTopLabel = new QLabel(QLatin1String("T1"));
abstractScrollArea.addScrollBarWidget(firstTopLabel, Qt::AlignTop);
- QCOMPARE(interface->childCount(), 3);
+ QCOMPARE(interface->childCount(), childCount);
QLabel *secondBottomLabel = new QLabel(QLatin1String("B2"));
abstractScrollArea.addScrollBarWidget(secondBottomLabel, Qt::AlignBottom);
- QCOMPARE(interface->childCount(), 3);
+ QCOMPARE(interface->childCount(), childCount);
QLabel *firstBottomLabel = new QLabel(QLatin1String("B1"));
abstractScrollArea.addScrollBarWidget(firstBottomLabel, Qt::AlignBottom);
- QCOMPARE(interface->childCount(), 3);
+ QCOMPARE(interface->childCount(), childCount);
// CornerWidget.
+ ++childCount;
abstractScrollArea.setCornerWidget(new QLabel(QLatin1String("C")));
- QCOMPARE(interface->childCount(), 4);
+ QCOMPARE(interface->childCount(), childCount);
QWidget *cornerWidget = abstractScrollArea.cornerWidget();
- QVERIFY(verifyChild(cornerWidget, interface, 3, globalGeometry));
+ if (scrollBarsVisible)
+ QVERIFY(verifyChild(cornerWidget, interface, 3, globalGeometry));
QCOMPARE(verifyHierarchy(interface), 0);