summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@qt.io>2016-12-15 11:33:58 -0800
committerGabriel de Dietrich <gabriel.dedietrich@qt.io>2016-12-23 19:23:24 +0000
commit2f797f8a9177198cc6683d3047a5a3fa807fef4a (patch)
treef7c2d0cc92be8a5c97f3f414151ca2b9b7cf695e /tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp
parent6d1d66a0429d2eb36beb192112b9a7bb8ae00b9a (diff)
QSplitterHandle: Ensure a minimum grab area
This used to work only for 0- and 1-pixel wide handles. However, and paradoxically, 2- and 3-pixel wide handles would end up with narrower grab areas. We now ensure a 4 or 5 minimum grab area, depending on the handle width parity. The patch also clears the margins and mask if the handle size is increased at some point. Change-Id: I8a16e39fb34b5452d9021dbde8c22bec79df0243 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp')
-rw-r--r--tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp b/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp
index c4cd771f92..72e6ffdeb5 100644
--- a/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp
+++ b/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp
@@ -81,6 +81,7 @@ private slots:
void replaceWidget();
void replaceWidgetWithSplitterChild_data();
void replaceWidgetWithSplitterChild();
+ void handleMinimumWidth();
// task-specific tests below me:
void task187373_addAbstractScrollAreas();
@@ -820,6 +821,29 @@ void tst_QSplitter::replaceWidgetWithSplitterChild()
}
}
+void tst_QSplitter::handleMinimumWidth()
+{
+ MyFriendlySplitter split;
+ split.addWidget(new QLabel("Number Wan"));
+ split.addWidget(new QLabel("Number Too"));
+
+ split.show();
+ QTest::qWaitForWindowExposed(&split);
+ for (int i = 0; i < 10; i++) {
+ split.setHandleWidth(i);
+ QTest::qWait(100); // resizing
+ QCOMPARE(split.handle(1)->width(), qMax(4 + (i & 1), i));
+ }
+
+ split.setOrientation(Qt::Vertical);
+ QTest::qWait(100);
+ for (int i = 0; i < 10; i++) {
+ split.setHandleWidth(i);
+ QTest::qWait(100); // resizing
+ QCOMPARE(split.handle(1)->height(), qMax(4 + (i & 1), i));
+ }
+}
+
void tst_QSplitter::rubberBandNotInSplitter()
{
MyFriendlySplitter split;