From 7d53defbb369f73df97c28761f17887fc5391eca Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Wed, 23 Oct 2024 16:23:05 +0200 Subject: [PATCH] Clean up tst_QGraphicsView::scrollBarRanges MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge the two translation units into one, there's no reason for moving the code populating the test data away from the test function code. Remove some unnecessary QString<->QByteArray conversions in the test data. Task-number: QTBUG-114987 Change-Id: I20dc858c6dab683e19e35e5be4ecd4ff6d283164 Reviewed-by: Tor Arne Vestbø (cherry picked from commit ce0a92549e7a4164d60f3b7c723b9f0a8cf28f55) Reviewed-by: Qt Cherry-pick Bot --- .../graphicsview/qgraphicsview/CMakeLists.txt | 1 - .../qgraphicsview/tst_qgraphicsview.cpp | 1216 +++++++++++++++- .../qgraphicsview/tst_qgraphicsview_2.cpp | 1230 ----------------- 3 files changed, 1206 insertions(+), 1241 deletions(-) delete mode 100644 tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview_2.cpp diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/CMakeLists.txt b/tests/auto/widgets/graphicsview/qgraphicsview/CMakeLists.txt index cf33de0b334..7dfc6014840 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsview/CMakeLists.txt +++ b/tests/auto/widgets/graphicsview/qgraphicsview/CMakeLists.txt @@ -14,7 +14,6 @@ endif() qt_internal_add_test(tst_qgraphicsview SOURCES tst_qgraphicsview.cpp tst_qgraphicsview.h - tst_qgraphicsview_2.cpp DEFINES QT_NO_CAST_TO_ASCII LIBRARIES diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp index 7599afd6e0d..d6929f49577 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp @@ -2864,14 +2864,6 @@ void tst_QGraphicsView::levelOfDetail() QTRY_COMPARE(item->lastLod, lod); } -// Moved to tst_qgraphicsview_2.cpp -extern void _scrollBarRanges_data(); - -void tst_QGraphicsView::scrollBarRanges_data() -{ - _scrollBarRanges_data(); -} - // Simulates motif scrollbar for range tests class FauxMotifStyle : public QCommonStyle { public: @@ -2890,12 +2882,1216 @@ public: } }; +static void scrollBarRanges_addTestData(const QString &style, bool styled) +{ + const int viewWidth = 250; + const int viewHeight = 100; + + static constexpr struct Data { + const char *name; + QRectF sceneRect; + ScrollBarCount sceneRectOffsetFactors; + int scale; + Qt::ScrollBarPolicy hbarpolicy, vbarpolicy; + ExpectedValueDescription hmin, hmax, vmin, vmax; + } data [] = { + { + "1", + QRectF(0, 0, viewWidth, viewHeight), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAsNeeded, + Qt::ScrollBarAsNeeded, + ExpectedValueDescription(), + ExpectedValueDescription(), + ExpectedValueDescription(), + ExpectedValueDescription(), + }, + { + "2", + QRectF(0, 0, viewWidth + 50, viewHeight), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAsNeeded, + Qt::ScrollBarAsNeeded, + ExpectedValueDescription(), + ExpectedValueDescription(50, 1, 1), + ExpectedValueDescription(), + ExpectedValueDescription(0, 1, 1), + }, + { + "3", + QRectF(0, 0, viewWidth + 50, viewHeight + 100), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAsNeeded, + Qt::ScrollBarAsNeeded, + ExpectedValueDescription(), + ExpectedValueDescription(50, 1, 1), + ExpectedValueDescription(0, 0), + ExpectedValueDescription(100, 1, 1), + }, + { + "4", + QRectF(-100, -100, viewWidth, viewHeight), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAsNeeded, + Qt::ScrollBarAsNeeded, + ExpectedValueDescription(), + ExpectedValueDescription(), + ExpectedValueDescription(), + ExpectedValueDescription(), + }, + { + "5", + QRectF(-100, -100, viewWidth + 50, viewHeight), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAsNeeded, + Qt::ScrollBarAsNeeded, + ExpectedValueDescription(-100), + ExpectedValueDescription(-50, 1, 1), + ExpectedValueDescription(-100), + ExpectedValueDescription(-100, 1, 1), + }, + { + "6", + QRectF(-100, -100, viewWidth + 50, viewHeight + 100), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAsNeeded, + Qt::ScrollBarAsNeeded, + ExpectedValueDescription(-100), + ExpectedValueDescription(-50, 1, 1), + ExpectedValueDescription(-100), + ExpectedValueDescription(0, 1, 1), + }, + { + "7", + QRectF(0, 0, viewWidth + 1, viewHeight + 1), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAsNeeded, + Qt::ScrollBarAsNeeded, + ExpectedValueDescription(), + ExpectedValueDescription(1, 1, 1), + ExpectedValueDescription(), + ExpectedValueDescription(1, 1, 1), + }, + { + "8", + QRectF(0, 0, viewWidth + 51, viewHeight + 1), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAsNeeded, + Qt::ScrollBarAsNeeded, + ExpectedValueDescription(), + ExpectedValueDescription(51, 1, 1), + ExpectedValueDescription(), + ExpectedValueDescription(1, 1, 1), + }, + { + "9", + QRectF(0, 0, viewWidth + 51, viewHeight + 101), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAsNeeded, + Qt::ScrollBarAsNeeded, + ExpectedValueDescription(), + ExpectedValueDescription(51, 1, 1), + ExpectedValueDescription(), + ExpectedValueDescription(101, 1, 1), + }, + { + "10", + QRectF(-101, -101, viewWidth + 1, viewHeight + 1), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAsNeeded, + Qt::ScrollBarAsNeeded, + ExpectedValueDescription(-101), + ExpectedValueDescription(-100, 1, 1), + ExpectedValueDescription(-101), + ExpectedValueDescription(-100, 1, 1), + }, + { + "11", + QRectF(-101, -101, viewWidth + 51, viewHeight + 1), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAsNeeded, + Qt::ScrollBarAsNeeded, + ExpectedValueDescription(-101), + ExpectedValueDescription(-50, 1, 1), + ExpectedValueDescription(-101), + ExpectedValueDescription(-100, 1, 1), + }, + { + "12", + QRectF(-101, -101, viewWidth + 51, viewHeight + 101), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAsNeeded, + Qt::ScrollBarAsNeeded, + ExpectedValueDescription(-101), + ExpectedValueDescription(-50, 1, 1), + ExpectedValueDescription(-101), + ExpectedValueDescription(0, 1, 1), + }, + { + "13", + QRectF(0, 0, viewWidth, viewHeight), + ScrollBarCount(0, 0, 1, 1), + 1, + Qt::ScrollBarAsNeeded, + Qt::ScrollBarAsNeeded, + ExpectedValueDescription(), + ExpectedValueDescription(0, 2, 1), + ExpectedValueDescription(), + ExpectedValueDescription(0, 2, 1), + }, + { + "14", + QRectF(0, 0, viewWidth + 50, viewHeight), + ScrollBarCount(0, 0, 1, 1), + 1, + Qt::ScrollBarAsNeeded, + Qt::ScrollBarAsNeeded, + ExpectedValueDescription(), + ExpectedValueDescription(50, 2, 1), + ExpectedValueDescription(), + ExpectedValueDescription(0, 2, 1), + }, + { + "15", + QRectF(0, 0, viewWidth + 50, viewHeight + 100), + ScrollBarCount(0, 0, 1, 1), + 1, + Qt::ScrollBarAsNeeded, + Qt::ScrollBarAsNeeded, + ExpectedValueDescription(), + ExpectedValueDescription(50, 2, 1), + ExpectedValueDescription(), + ExpectedValueDescription(100, 2, 1), + }, + { + "16", + QRectF(-100, -100, viewWidth, viewHeight), + ScrollBarCount(-1, -1, 1, 1), + 1, + Qt::ScrollBarAsNeeded, + Qt::ScrollBarAsNeeded, + ExpectedValueDescription(-100, -1), + ExpectedValueDescription(-100, 1, 1), + ExpectedValueDescription(-100, -1), + ExpectedValueDescription(-100, 1, 1), + }, + { + "17", + QRectF(-100, -100, viewWidth + 50, viewHeight), + ScrollBarCount(-1, -1, 1, 1), + 1, + Qt::ScrollBarAsNeeded, + Qt::ScrollBarAsNeeded, + ExpectedValueDescription(-100, -1), + ExpectedValueDescription(-50, 1, 1), + ExpectedValueDescription(-100, -1), + ExpectedValueDescription(-100, 1, 1), + }, + { + "18", + QRectF(-100, -100, viewWidth + 50, viewHeight + 100), + ScrollBarCount(-1, -1, 1, 1), + 1, + Qt::ScrollBarAsNeeded, + Qt::ScrollBarAsNeeded, + ExpectedValueDescription(-100, -1), + ExpectedValueDescription(-50, 1, 1), + ExpectedValueDescription(-100, -1), + ExpectedValueDescription(0, 1, 1), + }, + { + "1 x2", + QRectF(0, 0, viewWidth, viewHeight), + ScrollBarCount(0, 0, 0, 0), + 2, + Qt::ScrollBarAsNeeded, + Qt::ScrollBarAsNeeded, + ExpectedValueDescription(), + ExpectedValueDescription(viewWidth, 1, 1), + ExpectedValueDescription(), + ExpectedValueDescription(viewHeight, 1, 1), + }, + { + "2 x2", + QRectF(0, 0, viewWidth + 50, viewHeight), + ScrollBarCount(0, 0, 0, 0), + 2, + Qt::ScrollBarAsNeeded, + Qt::ScrollBarAsNeeded, + ExpectedValueDescription(), + ExpectedValueDescription(viewWidth + 100, 1, 1), + ExpectedValueDescription(), + ExpectedValueDescription(viewHeight, 1, 1), + }, + { + "3 x2", + QRectF(0, 0, viewWidth + 50, viewHeight + 100), + ScrollBarCount(0, 0, 0, 0), + 2, + Qt::ScrollBarAsNeeded, + Qt::ScrollBarAsNeeded, + ExpectedValueDescription(), + ExpectedValueDescription(viewWidth + 100, 1, 1), + ExpectedValueDescription(), + ExpectedValueDescription(viewHeight + 200, 1, 1), + }, + { + "4 x2", + QRectF(-100, -100, viewWidth, viewHeight), + ScrollBarCount(0, 0, 0, 0), + 2, + Qt::ScrollBarAsNeeded, + Qt::ScrollBarAsNeeded, + ExpectedValueDescription(-200), + ExpectedValueDescription(viewWidth - 200, 1, 1), + ExpectedValueDescription(-200), + ExpectedValueDescription(viewHeight - 200, 1, 1), + }, + { + "5 x2", + QRectF(-100, -100, viewWidth + 50, viewHeight), + ScrollBarCount(0, 0, 0, 0), + 2, + Qt::ScrollBarAsNeeded, + Qt::ScrollBarAsNeeded, + ExpectedValueDescription(-200), + ExpectedValueDescription(viewWidth - 100, 1, 1), + ExpectedValueDescription(-200), + ExpectedValueDescription(viewHeight - 200, 1, 1), + }, + { + "6 x2", + QRectF(-100, -100, viewWidth + 50, viewHeight + 100), + ScrollBarCount(0, 0, 0, 0), + 2, + Qt::ScrollBarAsNeeded, + Qt::ScrollBarAsNeeded, + ExpectedValueDescription(-200), + ExpectedValueDescription(viewWidth - 100, 1, 1), + ExpectedValueDescription(-200), + ExpectedValueDescription(viewHeight, 1, 1), + }, + { + "1 No ScrollBars", + QRectF(0, 0, viewWidth, viewHeight), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOff, + ExpectedValueDescription(), + ExpectedValueDescription(), + ExpectedValueDescription(), + ExpectedValueDescription(), + }, + { + "2 No ScrollBars", + QRectF(0, 0, viewWidth + 50, viewHeight), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOff, + ExpectedValueDescription(), + ExpectedValueDescription(50), + ExpectedValueDescription(), + ExpectedValueDescription(), + }, + { + "3 No ScrollBars", + QRectF(0, 0, viewWidth + 50, viewHeight + 100), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOff, + ExpectedValueDescription(), + ExpectedValueDescription(50), + ExpectedValueDescription(), + ExpectedValueDescription(100), + }, + { + "4 No ScrollBars", + QRectF(-100, -100, viewWidth, viewHeight), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOff, + ExpectedValueDescription(), + ExpectedValueDescription(), + ExpectedValueDescription(), + ExpectedValueDescription(), + }, + { + "5 No ScrollBars", + QRectF(-100, -100, viewWidth + 50, viewHeight), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOff, + ExpectedValueDescription(-100), + ExpectedValueDescription(-50), + ExpectedValueDescription(), + ExpectedValueDescription(), + }, + { + "6 No ScrollBars", + QRectF(-100, -100, viewWidth + 50, viewHeight + 100), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOff, + ExpectedValueDescription(-100), + ExpectedValueDescription(-50), + ExpectedValueDescription(-100), + ExpectedValueDescription(), + }, + { + "7 No ScrollBars", + QRectF(0, 0, viewWidth + 1, viewHeight + 1), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOff, + ExpectedValueDescription(), + ExpectedValueDescription(1), + ExpectedValueDescription(), + ExpectedValueDescription(1), + }, + { + "8 No ScrollBars", + QRectF(0, 0, viewWidth + 51, viewHeight + 1), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOff, + ExpectedValueDescription(), + ExpectedValueDescription(51), + ExpectedValueDescription(), + ExpectedValueDescription(1), + }, + { + "9 No ScrollBars", + QRectF(0, 0, viewWidth + 51, viewHeight + 101), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOff, + ExpectedValueDescription(), + ExpectedValueDescription(51), + ExpectedValueDescription(), + ExpectedValueDescription(101), + }, + { + "10 No ScrollBars", + QRectF(-101, -101, viewWidth + 1, viewHeight + 1), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOff, + ExpectedValueDescription(-101), + ExpectedValueDescription(-100), + ExpectedValueDescription(-101), + ExpectedValueDescription(-100), + }, + { + "11 No ScrollBars", + QRectF(-101, -101, viewWidth + 51, viewHeight + 1), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOff, + ExpectedValueDescription(-101), + ExpectedValueDescription(-50), + ExpectedValueDescription(-101), + ExpectedValueDescription(-100), + }, + { + "12 No ScrollBars", + QRectF(-101, -101, viewWidth + 51, viewHeight + 101), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOff, + ExpectedValueDescription(-101), + ExpectedValueDescription(-50), + ExpectedValueDescription(-101), + ExpectedValueDescription(), + }, + { + "13 No ScrollBars", + QRectF(0, 0, viewWidth, viewHeight), + ScrollBarCount(0, 0, 1, 1), + 1, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOff, + ExpectedValueDescription(), + ExpectedValueDescription(0, 1), + ExpectedValueDescription(), + ExpectedValueDescription(0, 1), + }, + { + "14 No ScrollBars", + QRectF(0, 0, viewWidth + 50, viewHeight), + ScrollBarCount(0, 0, 1, 1), + 1, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOff, + ExpectedValueDescription(), + ExpectedValueDescription(50, 1), + ExpectedValueDescription(), + ExpectedValueDescription(0, 1), + }, + { + "15 No ScrollBars", + QRectF(0, 0, viewWidth + 50, viewHeight + 100), + ScrollBarCount(0, 0, 1, 1), + 1, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOff, + ExpectedValueDescription(), + ExpectedValueDescription(50, 1), + ExpectedValueDescription(), + ExpectedValueDescription(100, 1), + }, + { + "16 No ScrollBars", + QRectF(-100, -100, viewWidth, viewHeight), + ScrollBarCount(-1, -1, 1, 1), + 1, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOff, + ExpectedValueDescription(-100, -1), + ExpectedValueDescription(-100), + ExpectedValueDescription(-100, -1), + ExpectedValueDescription(-100), + }, + { + "17 No ScrollBars", + QRectF(-100, -100, viewWidth + 50, viewHeight), + ScrollBarCount(-1, -1, 1, 1), + 1, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOff, + ExpectedValueDescription(-100, -1), + ExpectedValueDescription(-50), + ExpectedValueDescription(-100, -1), + ExpectedValueDescription(-100), + }, + { + "18 No ScrollBars", + QRectF(-100, -100, viewWidth + 50, viewHeight + 100), + ScrollBarCount(-1, -1, 1, 1), + 1, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOff, + ExpectedValueDescription(-100, -1), + ExpectedValueDescription(-50), + ExpectedValueDescription(-100, -1), + ExpectedValueDescription(), + }, + { + "1 x2 No ScrollBars", + QRectF(0, 0, viewWidth, viewHeight), + ScrollBarCount(0, 0, 0, 0), + 2, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOff, + ExpectedValueDescription(), + ExpectedValueDescription(viewWidth), + ExpectedValueDescription(), + ExpectedValueDescription(viewHeight), + }, + { + "2 x2 No ScrollBars", + QRectF(0, 0, viewWidth + 50, viewHeight), + ScrollBarCount(0, 0, 0, 0), + 2, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOff, + ExpectedValueDescription(), + ExpectedValueDescription(viewWidth + 100), + ExpectedValueDescription(), + ExpectedValueDescription(viewHeight), + }, + { + "3 x2 No ScrollBars", + QRectF(0, 0, viewWidth + 50, viewHeight + 100), + ScrollBarCount(0, 0, 0, 0), + 2, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOff, + ExpectedValueDescription(), + ExpectedValueDescription(viewWidth + 100), + ExpectedValueDescription(), + ExpectedValueDescription(viewHeight + 200), + }, + { + "4 x2 No ScrollBars", + QRectF(-100, -100, viewWidth, viewHeight), + ScrollBarCount(0, 0, 0, 0), + 2, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOff, + ExpectedValueDescription(-200), + ExpectedValueDescription(viewWidth - 200), + ExpectedValueDescription(-200), + ExpectedValueDescription(viewHeight - 200), + }, + { + "5 x2 No ScrollBars", + QRectF(-100, -100, viewWidth + 50, viewHeight), + ScrollBarCount(0, 0, 0, 0), + 2, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOff, + ExpectedValueDescription(-200), + ExpectedValueDescription(viewWidth - 100), + ExpectedValueDescription(-200), + ExpectedValueDescription(viewHeight - 200), + }, + { + "6 x2 No ScrollBars", + QRectF(-100, -100, viewWidth + 50, viewHeight + 100), + ScrollBarCount(0, 0, 0, 0), + 2, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOff, + ExpectedValueDescription(-200), + ExpectedValueDescription(viewWidth - 100), + ExpectedValueDescription(-200), + ExpectedValueDescription(viewHeight), + }, + { + "1 Always ScrollBars", + QRectF(0, 0, viewWidth, viewHeight), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAlwaysOn, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(), + ExpectedValueDescription(0, 1, 1), + ExpectedValueDescription(), + ExpectedValueDescription(0, 1, 1), + }, + { + "2 Always ScrollBars", + QRectF(0, 0, viewWidth + 50, viewHeight), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAlwaysOn, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(), + ExpectedValueDescription(50, 1, 1), + ExpectedValueDescription(), + ExpectedValueDescription(0, 1, 1), + }, + { + "3 Always ScrollBars", + QRectF(0, 0, viewWidth + 50, viewHeight + 100), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAlwaysOn, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(), + ExpectedValueDescription(50, 1, 1), + ExpectedValueDescription(), + ExpectedValueDescription(100, 1, 1), + }, + { + "4 Always ScrollBars", + QRectF(-100, -100, viewWidth, viewHeight), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAlwaysOn, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(-100), + ExpectedValueDescription(-100, 1, 1), + ExpectedValueDescription(-100), + ExpectedValueDescription(-100, 1, 1), + }, + { + "5 Always ScrollBars", + QRectF(-100, -100, viewWidth + 50, viewHeight), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAlwaysOn, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(-100), + ExpectedValueDescription(-50, 1, 1), + ExpectedValueDescription(-100), + ExpectedValueDescription(-100, 1, 1), + }, + { + "6 Always ScrollBars", + QRectF(-100, -100, viewWidth + 50, viewHeight + 100), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAlwaysOn, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(-100), + ExpectedValueDescription(-50, 1, 1), + ExpectedValueDescription(-100), + ExpectedValueDescription(0, 1, 1), + }, + { + "7 Always ScrollBars", + QRectF(0, 0, viewWidth + 1, viewHeight + 1), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAlwaysOn, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(), + ExpectedValueDescription(1, 1, 1), + ExpectedValueDescription(), + ExpectedValueDescription(1, 1, 1), + }, + { + "8 Always ScrollBars", + QRectF(0, 0, viewWidth + 51, viewHeight + 1), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAlwaysOn, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(), + ExpectedValueDescription(51, 1, 1), + ExpectedValueDescription(), + ExpectedValueDescription(1, 1, 1), + }, + { + "9 Always ScrollBars", + QRectF(0, 0, viewWidth + 51, viewHeight + 101), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAlwaysOn, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(), + ExpectedValueDescription(51, 1, 1), + ExpectedValueDescription(), + ExpectedValueDescription(101, 1, 1), + }, + { + "10 Always ScrollBars", + QRectF(-101, -101, viewWidth + 1, viewHeight + 1), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAlwaysOn, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(-101), + ExpectedValueDescription(-100, 1, 1), + ExpectedValueDescription(-101), + ExpectedValueDescription(-100, 1, 1), + }, + { + "11 Always ScrollBars", + QRectF(-101, -101, viewWidth + 51, viewHeight + 1), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAlwaysOn, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(-101), + ExpectedValueDescription(-50, 1, 1), + ExpectedValueDescription(-101), + ExpectedValueDescription(-100, 1, 1), + }, + { + "12 Always ScrollBars", + QRectF(-101, -101, viewWidth + 51, viewHeight + 101), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAlwaysOn, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(-101), + ExpectedValueDescription(-50, 1, 1), + ExpectedValueDescription(-101), + ExpectedValueDescription(0, 1, 1), + }, + { + "13 Always ScrollBars", + QRectF(0, 0, viewWidth, viewHeight), + ScrollBarCount(0, 0, 1, 1), + 1, + Qt::ScrollBarAlwaysOn, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(), + ExpectedValueDescription(0, 2, 1), + ExpectedValueDescription(), + ExpectedValueDescription(0, 2, 1), + }, + { + "14 Always ScrollBars", + QRectF(0, 0, viewWidth + 50, viewHeight), + ScrollBarCount(0, 0, 1, 1), + 1, + Qt::ScrollBarAlwaysOn, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(), + ExpectedValueDescription(50, 2, 1), + ExpectedValueDescription(), + ExpectedValueDescription(0, 2, 1), + }, + { + "15 Always ScrollBars", + QRectF(0, 0, viewWidth + 50, viewHeight + 100), + ScrollBarCount(0, 0, 1, 1), + 1, + Qt::ScrollBarAlwaysOn, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(), + ExpectedValueDescription(50, 2, 1), + ExpectedValueDescription(), + ExpectedValueDescription(100, 2, 1), + }, + { + "16 Always ScrollBars", + QRectF(-100, -100, viewWidth, viewHeight), + ScrollBarCount(-1, -1, 1, 1), + 1, + Qt::ScrollBarAlwaysOn, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(-100, -1), + ExpectedValueDescription(-100, 1, 1), + ExpectedValueDescription(-100, -1), + ExpectedValueDescription(-100, 1, 1), + }, + { + "17 Always ScrollBars", + QRectF(-100, -100, viewWidth + 50, viewHeight), + ScrollBarCount(-1, -1, 1, 1), + 1, + Qt::ScrollBarAlwaysOn, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(-100, -1), + ExpectedValueDescription(-50, 1, 1), + ExpectedValueDescription(-100, -1), + ExpectedValueDescription(-100, 1, 1), + }, + { + "18 Always ScrollBars", + QRectF(-100, -100, viewWidth + 50, viewHeight + 100), + ScrollBarCount(-1, -1, 1, 1), + 1, + Qt::ScrollBarAlwaysOn, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(-100, -1), + ExpectedValueDescription(-50, 1, 1), + ExpectedValueDescription(-100, -1), + ExpectedValueDescription(0, 1, 1), + }, + { + "1 x2 Always ScrollBars", + QRectF(0, 0, viewWidth, viewHeight), + ScrollBarCount(0, 0, 0, 0), + 2, + Qt::ScrollBarAlwaysOn, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(), + ExpectedValueDescription(viewWidth, 1, 1), + ExpectedValueDescription(), + ExpectedValueDescription(viewHeight, 1, 1), + }, + { + "2 x2 Always ScrollBars", + QRectF(0, 0, viewWidth + 50, viewHeight), + ScrollBarCount(0, 0, 0, 0), + 2, + Qt::ScrollBarAlwaysOn, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(), + ExpectedValueDescription(viewWidth + 100, 1, 1), + ExpectedValueDescription(), + ExpectedValueDescription(viewHeight, 1, 1), + }, + { + "3 x2 Always ScrollBars", + QRectF(0, 0, viewWidth + 50, viewHeight + 100), + ScrollBarCount(0, 0, 0, 0), + 2, + Qt::ScrollBarAlwaysOn, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(), + ExpectedValueDescription(viewWidth + 100, 1, 1), + ExpectedValueDescription(), + ExpectedValueDescription(viewHeight + 200, 1, 1), + }, + { + "4 x2 Always ScrollBars", + QRectF(-100, -100, viewWidth, viewHeight), + ScrollBarCount(0, 0, 0, 0), + 2, + Qt::ScrollBarAlwaysOn, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(-200), + ExpectedValueDescription(viewWidth - 200, 1, 1), + ExpectedValueDescription(-200), + ExpectedValueDescription(viewHeight - 200, 1, 1), + }, + { + "5 x2 Always ScrollBars", + QRectF(-100, -100, viewWidth + 50, viewHeight), + ScrollBarCount(0, 0, 0, 0), + 2, + Qt::ScrollBarAlwaysOn, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(-200), + ExpectedValueDescription(viewWidth - 100, 1, 1), + ExpectedValueDescription(-200), + ExpectedValueDescription(viewHeight - 200, 1, 1), + }, + { + "6 x2 Always ScrollBars", + QRectF(-100, -100, viewWidth + 50, viewHeight + 100), + ScrollBarCount(0, 0, 0, 0), + 2, + Qt::ScrollBarAlwaysOn, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(-200), + ExpectedValueDescription(viewWidth - 100, 1, 1), + ExpectedValueDescription(-200), + ExpectedValueDescription(viewHeight, 1, 1), + }, + { + "1 Vertical Only", + QRectF(0, 0, viewWidth, viewHeight), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(), + ExpectedValueDescription(0, 1, 1), + ExpectedValueDescription(), + ExpectedValueDescription(), + }, + { + "2 Vertical Only", + QRectF(0, 0, viewWidth + 50, viewHeight), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(), + ExpectedValueDescription(50, 1, 1), + ExpectedValueDescription(), + ExpectedValueDescription(), + }, + { + "3 Vertical Only", + QRectF(0, 0, viewWidth + 50, viewHeight + 100), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(), + ExpectedValueDescription(50, 1, 1), + ExpectedValueDescription(), + ExpectedValueDescription(100), + }, + { + "4 Vertical Only", + QRectF(-100, -100, viewWidth, viewHeight), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(-100), + ExpectedValueDescription(-100, 1, 1), + ExpectedValueDescription(), + ExpectedValueDescription(), + }, + { + "5 Vertical Only", + QRectF(-100, -100, viewWidth + 50, viewHeight), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(-100), + ExpectedValueDescription(-50, 1, 1), + ExpectedValueDescription(), + ExpectedValueDescription(), + }, + { + "6 Vertical Only", + QRectF(-100, -100, viewWidth + 50, viewHeight + 100), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(-100), + ExpectedValueDescription(-50, 1, 1), + ExpectedValueDescription(-100), + ExpectedValueDescription(), + }, + { + "7 Vertical Only", + QRectF(0, 0, viewWidth + 1, viewHeight + 1), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(), + ExpectedValueDescription(1, 1, 1), + ExpectedValueDescription(), + ExpectedValueDescription(1), + }, + { + "8 Vertical Only", + QRectF(0, 0, viewWidth + 51, viewHeight + 1), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(), + ExpectedValueDescription(51, 1, 1), + ExpectedValueDescription(), + ExpectedValueDescription(1), + }, + { + "9 Vertical Only", + QRectF(0, 0, viewWidth + 51, viewHeight + 101), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(), + ExpectedValueDescription(51, 1, 1), + ExpectedValueDescription(), + ExpectedValueDescription(101), + }, + { + "10 Vertical Only", + QRectF(-101, -101, viewWidth + 1, viewHeight +1), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(-101), + ExpectedValueDescription(-100, 1, 1), + ExpectedValueDescription(-101), + ExpectedValueDescription(-100), + }, + { + "11 Vertical Only", + QRectF(-101, -101, viewWidth + 51, viewHeight + 1), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(-101), + ExpectedValueDescription(-50, 1, 1), + ExpectedValueDescription(-101), + ExpectedValueDescription(-100), + }, + { + "12 Vertical Only", + QRectF(-101, -101, viewWidth + 51, viewHeight + 101), + ScrollBarCount(0, 0, 0, 0), + 1, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(-101), + ExpectedValueDescription(-50, 1, 1), + ExpectedValueDescription(-101), + ExpectedValueDescription(), + }, + { + "13 Vertical Only", + QRectF(0, 0, viewWidth, viewHeight), + ScrollBarCount(0, 0, 1, 1), + 1, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(), + ExpectedValueDescription(0, 2, 1), + ExpectedValueDescription(), + ExpectedValueDescription(0, 1), + }, + { + "14 Vertical Only", + QRectF(0, 0, viewWidth + 50, viewHeight), + ScrollBarCount(0, 0, 1, 1), + 1, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(), + ExpectedValueDescription(50, 2, 1), + ExpectedValueDescription(), + ExpectedValueDescription(0, 1), + }, + { + "15 Vertical Only", + QRectF(0, 0, viewWidth + 50, viewHeight + 100), + ScrollBarCount(0, 0, 1, 1), + 1, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(), + ExpectedValueDescription(50, 2, 1), + ExpectedValueDescription(), + ExpectedValueDescription(100, 1), + }, + { + "16 Vertical Only", + QRectF(-100, -100, viewWidth, viewHeight), + ScrollBarCount(-1, -1, 1, 1), + 1, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(-100, -1), + ExpectedValueDescription(-100, 1, 1), + ExpectedValueDescription(-100, -1), + ExpectedValueDescription(-100), + }, + { + "17 Vertical Only", + QRectF(-100, -100, viewWidth + 50, viewHeight), + ScrollBarCount(-1, -1, 1, 1), + 1, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(-100, -1), + ExpectedValueDescription(-50, 1, 1), + ExpectedValueDescription(-100, -1), + ExpectedValueDescription(-100), + }, + { + "18 Vertical Only", + QRectF(-100, -100, viewWidth + 50, viewHeight + 100), + ScrollBarCount(-1, -1, 1, 1), + 1, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(-100, -1), + ExpectedValueDescription(-50, 1, 1), + ExpectedValueDescription(-100, -1), + ExpectedValueDescription(), + }, + { + "1 x2 Vertical Only", + QRectF(0, 0, viewWidth, viewHeight), + ScrollBarCount(0, 0, 0, 0), + 2, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(), + ExpectedValueDescription(viewWidth, 1, 1), + ExpectedValueDescription(), + ExpectedValueDescription(viewHeight), + }, + { + "2 x2 Vertical Only", + QRectF(0, 0, viewWidth + 50, viewHeight), + ScrollBarCount(0, 0, 0, 0), + 2, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(), + ExpectedValueDescription(viewWidth + 100, 1, 1), + ExpectedValueDescription(), + ExpectedValueDescription(viewHeight), + }, + { + "3 x2 Vertical Only", + QRectF(0, 0, viewWidth + 50, viewHeight + 100), + ScrollBarCount(0, 0, 0, 0), + 2, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(), + ExpectedValueDescription(viewWidth + 100, 1, 1), + ExpectedValueDescription(), + ExpectedValueDescription(viewHeight + 200), + }, + { + "4 x2 Vertical Only", + QRectF(-100, -100, viewWidth, viewHeight), + ScrollBarCount(0, 0, 0, 0), + 2, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(-200), + ExpectedValueDescription(viewWidth - 200, 1, 1), + ExpectedValueDescription(-200), + ExpectedValueDescription(viewHeight - 200), + }, + { + "5 x2 Vertical Only", + QRectF(-100, -100, viewWidth + 50, viewHeight), + ScrollBarCount(0, 0, 0, 0), + 2, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(-200), + ExpectedValueDescription(viewWidth - 100, 1, 1), + ExpectedValueDescription(-200), + ExpectedValueDescription(viewHeight - 200), + }, + { + "6 x2 Vertical Only", + QRectF(-100, -100, viewWidth + 50, viewHeight + 100), + ScrollBarCount(0, 0, 0, 0), + 2, + Qt::ScrollBarAlwaysOff, + Qt::ScrollBarAlwaysOn, + ExpectedValueDescription(-200), + ExpectedValueDescription(viewWidth - 100, 1, 1), + ExpectedValueDescription(-200), + ExpectedValueDescription(viewHeight), + }, + }; + + const QSize viewSize(viewWidth, viewHeight); + + for (const Data &e : data) { + QTest::addRow("%s%s, %s", style.toLatin1().data(), styled ? ", Styled" : "", e.name) + << style << viewSize + << e.sceneRect + << e.sceneRectOffsetFactors + << QTransform().scale(e.scale, e.scale) + << e.hbarpolicy + << e.vbarpolicy + << e.hmin << e.hmax << e.vmin << e.vmax + << styled; + } +} + +void tst_QGraphicsView::scrollBarRanges_data() +{ + QTest::addColumn("style"); + QTest::addColumn("viewportSize"); + QTest::addColumn("sceneRect"); + QTest::addColumn("sceneRectOffsetFactors"); + QTest::addColumn("transform"); + QTest::addColumn("hbarpolicy"); + QTest::addColumn("vbarpolicy"); + QTest::addColumn("hmin"); + QTest::addColumn("hmax"); + QTest::addColumn("vmin"); + QTest::addColumn("vmax"); + QTest::addColumn("useStyledPanel"); + + const auto styles = QStyleFactory::keys(); + for (const QString &style : styles) { + scrollBarRanges_addTestData(style, false); + scrollBarRanges_addTestData(style, true); + } +} + void tst_QGraphicsView::scrollBarRanges() { if (isPlatformEGLFS()) QSKIP("", "Resizing does not work on EGLFS on top level window", Continue); - QFETCH(QByteArray, style); + QFETCH(QString, style); QFETCH(QSize, viewportSize); QFETCH(QRectF, sceneRect); QFETCH(ScrollBarCount, sceneRectOffsetFactors); @@ -2922,7 +4118,7 @@ void tst_QGraphicsView::scrollBarRanges() if (style == "motif") stylePtr.reset(new FauxMotifStyle); else - stylePtr.reset(QStyleFactory::create(QLatin1String(style))); + stylePtr.reset(QStyleFactory::create(style)); view.setStyle(stylePtr.data()); view.setStyleSheet(" "); // enables style propagation ;-) diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview_2.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview_2.cpp deleted file mode 100644 index 1380e007e78..00000000000 --- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview_2.cpp +++ /dev/null @@ -1,1230 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "tst_qgraphicsview.h" - -Q_DECLARE_METATYPE(ExpectedValueDescription) -Q_DECLARE_METATYPE(QList) -Q_DECLARE_METATYPE(QList) -Q_DECLARE_METATYPE(QPainterPath) -Q_DECLARE_METATYPE(Qt::ScrollBarPolicy) -Q_DECLARE_METATYPE(ScrollBarCount) - -static void _scrollBarRanges_addTestData(const QByteArray &style, bool styled) -{ - const int viewWidth = 250; - const int viewHeight = 100; - - static constexpr struct Data { - const char *name; - QRectF sceneRect; - ScrollBarCount sceneRectOffsetFactors; - int scale; - Qt::ScrollBarPolicy hbarpolicy, vbarpolicy; - ExpectedValueDescription hmin, hmax, vmin, vmax; - } data [] = { - { - "1", - QRectF(0, 0, viewWidth, viewHeight), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAsNeeded, - Qt::ScrollBarAsNeeded, - ExpectedValueDescription(), - ExpectedValueDescription(), - ExpectedValueDescription(), - ExpectedValueDescription(), - }, - { - "2", - QRectF(0, 0, viewWidth + 50, viewHeight), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAsNeeded, - Qt::ScrollBarAsNeeded, - ExpectedValueDescription(), - ExpectedValueDescription(50, 1, 1), - ExpectedValueDescription(), - ExpectedValueDescription(0, 1, 1), - }, - { - "3", - QRectF(0, 0, viewWidth + 50, viewHeight + 100), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAsNeeded, - Qt::ScrollBarAsNeeded, - ExpectedValueDescription(), - ExpectedValueDescription(50, 1, 1), - ExpectedValueDescription(0, 0), - ExpectedValueDescription(100, 1, 1), - }, - { - "4", - QRectF(-100, -100, viewWidth, viewHeight), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAsNeeded, - Qt::ScrollBarAsNeeded, - ExpectedValueDescription(), - ExpectedValueDescription(), - ExpectedValueDescription(), - ExpectedValueDescription(), - }, - { - "5", - QRectF(-100, -100, viewWidth + 50, viewHeight), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAsNeeded, - Qt::ScrollBarAsNeeded, - ExpectedValueDescription(-100), - ExpectedValueDescription(-50, 1, 1), - ExpectedValueDescription(-100), - ExpectedValueDescription(-100, 1, 1), - }, - { - "6", - QRectF(-100, -100, viewWidth + 50, viewHeight + 100), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAsNeeded, - Qt::ScrollBarAsNeeded, - ExpectedValueDescription(-100), - ExpectedValueDescription(-50, 1, 1), - ExpectedValueDescription(-100), - ExpectedValueDescription(0, 1, 1), - }, - { - "7", - QRectF(0, 0, viewWidth + 1, viewHeight + 1), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAsNeeded, - Qt::ScrollBarAsNeeded, - ExpectedValueDescription(), - ExpectedValueDescription(1, 1, 1), - ExpectedValueDescription(), - ExpectedValueDescription(1, 1, 1), - }, - { - "8", - QRectF(0, 0, viewWidth + 51, viewHeight + 1), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAsNeeded, - Qt::ScrollBarAsNeeded, - ExpectedValueDescription(), - ExpectedValueDescription(51, 1, 1), - ExpectedValueDescription(), - ExpectedValueDescription(1, 1, 1), - }, - { - "9", - QRectF(0, 0, viewWidth + 51, viewHeight + 101), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAsNeeded, - Qt::ScrollBarAsNeeded, - ExpectedValueDescription(), - ExpectedValueDescription(51, 1, 1), - ExpectedValueDescription(), - ExpectedValueDescription(101, 1, 1), - }, - { - "10", - QRectF(-101, -101, viewWidth + 1, viewHeight + 1), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAsNeeded, - Qt::ScrollBarAsNeeded, - ExpectedValueDescription(-101), - ExpectedValueDescription(-100, 1, 1), - ExpectedValueDescription(-101), - ExpectedValueDescription(-100, 1, 1), - }, - { - "11", - QRectF(-101, -101, viewWidth + 51, viewHeight + 1), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAsNeeded, - Qt::ScrollBarAsNeeded, - ExpectedValueDescription(-101), - ExpectedValueDescription(-50, 1, 1), - ExpectedValueDescription(-101), - ExpectedValueDescription(-100, 1, 1), - }, - { - "12", - QRectF(-101, -101, viewWidth + 51, viewHeight + 101), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAsNeeded, - Qt::ScrollBarAsNeeded, - ExpectedValueDescription(-101), - ExpectedValueDescription(-50, 1, 1), - ExpectedValueDescription(-101), - ExpectedValueDescription(0, 1, 1), - }, - { - "13", - QRectF(0, 0, viewWidth, viewHeight), - ScrollBarCount(0, 0, 1, 1), - 1, - Qt::ScrollBarAsNeeded, - Qt::ScrollBarAsNeeded, - ExpectedValueDescription(), - ExpectedValueDescription(0, 2, 1), - ExpectedValueDescription(), - ExpectedValueDescription(0, 2, 1), - }, - { - "14", - QRectF(0, 0, viewWidth + 50, viewHeight), - ScrollBarCount(0, 0, 1, 1), - 1, - Qt::ScrollBarAsNeeded, - Qt::ScrollBarAsNeeded, - ExpectedValueDescription(), - ExpectedValueDescription(50, 2, 1), - ExpectedValueDescription(), - ExpectedValueDescription(0, 2, 1), - }, - { - "15", - QRectF(0, 0, viewWidth + 50, viewHeight + 100), - ScrollBarCount(0, 0, 1, 1), - 1, - Qt::ScrollBarAsNeeded, - Qt::ScrollBarAsNeeded, - ExpectedValueDescription(), - ExpectedValueDescription(50, 2, 1), - ExpectedValueDescription(), - ExpectedValueDescription(100, 2, 1), - }, - { - "16", - QRectF(-100, -100, viewWidth, viewHeight), - ScrollBarCount(-1, -1, 1, 1), - 1, - Qt::ScrollBarAsNeeded, - Qt::ScrollBarAsNeeded, - ExpectedValueDescription(-100, -1), - ExpectedValueDescription(-100, 1, 1), - ExpectedValueDescription(-100, -1), - ExpectedValueDescription(-100, 1, 1), - }, - { - "17", - QRectF(-100, -100, viewWidth + 50, viewHeight), - ScrollBarCount(-1, -1, 1, 1), - 1, - Qt::ScrollBarAsNeeded, - Qt::ScrollBarAsNeeded, - ExpectedValueDescription(-100, -1), - ExpectedValueDescription(-50, 1, 1), - ExpectedValueDescription(-100, -1), - ExpectedValueDescription(-100, 1, 1), - }, - { - "18", - QRectF(-100, -100, viewWidth + 50, viewHeight + 100), - ScrollBarCount(-1, -1, 1, 1), - 1, - Qt::ScrollBarAsNeeded, - Qt::ScrollBarAsNeeded, - ExpectedValueDescription(-100, -1), - ExpectedValueDescription(-50, 1, 1), - ExpectedValueDescription(-100, -1), - ExpectedValueDescription(0, 1, 1), - }, - { - "1 x2", - QRectF(0, 0, viewWidth, viewHeight), - ScrollBarCount(0, 0, 0, 0), - 2, - Qt::ScrollBarAsNeeded, - Qt::ScrollBarAsNeeded, - ExpectedValueDescription(), - ExpectedValueDescription(viewWidth, 1, 1), - ExpectedValueDescription(), - ExpectedValueDescription(viewHeight, 1, 1), - }, - { - "2 x2", - QRectF(0, 0, viewWidth + 50, viewHeight), - ScrollBarCount(0, 0, 0, 0), - 2, - Qt::ScrollBarAsNeeded, - Qt::ScrollBarAsNeeded, - ExpectedValueDescription(), - ExpectedValueDescription(viewWidth + 100, 1, 1), - ExpectedValueDescription(), - ExpectedValueDescription(viewHeight, 1, 1), - }, - { - "3 x2", - QRectF(0, 0, viewWidth + 50, viewHeight + 100), - ScrollBarCount(0, 0, 0, 0), - 2, - Qt::ScrollBarAsNeeded, - Qt::ScrollBarAsNeeded, - ExpectedValueDescription(), - ExpectedValueDescription(viewWidth + 100, 1, 1), - ExpectedValueDescription(), - ExpectedValueDescription(viewHeight + 200, 1, 1), - }, - { - "4 x2", - QRectF(-100, -100, viewWidth, viewHeight), - ScrollBarCount(0, 0, 0, 0), - 2, - Qt::ScrollBarAsNeeded, - Qt::ScrollBarAsNeeded, - ExpectedValueDescription(-200), - ExpectedValueDescription(viewWidth - 200, 1, 1), - ExpectedValueDescription(-200), - ExpectedValueDescription(viewHeight - 200, 1, 1), - }, - { - "5 x2", - QRectF(-100, -100, viewWidth + 50, viewHeight), - ScrollBarCount(0, 0, 0, 0), - 2, - Qt::ScrollBarAsNeeded, - Qt::ScrollBarAsNeeded, - ExpectedValueDescription(-200), - ExpectedValueDescription(viewWidth - 100, 1, 1), - ExpectedValueDescription(-200), - ExpectedValueDescription(viewHeight - 200, 1, 1), - }, - { - "6 x2", - QRectF(-100, -100, viewWidth + 50, viewHeight + 100), - ScrollBarCount(0, 0, 0, 0), - 2, - Qt::ScrollBarAsNeeded, - Qt::ScrollBarAsNeeded, - ExpectedValueDescription(-200), - ExpectedValueDescription(viewWidth - 100, 1, 1), - ExpectedValueDescription(-200), - ExpectedValueDescription(viewHeight, 1, 1), - }, - { - "1 No ScrollBars", - QRectF(0, 0, viewWidth, viewHeight), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOff, - ExpectedValueDescription(), - ExpectedValueDescription(), - ExpectedValueDescription(), - ExpectedValueDescription(), - }, - { - "2 No ScrollBars", - QRectF(0, 0, viewWidth + 50, viewHeight), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOff, - ExpectedValueDescription(), - ExpectedValueDescription(50), - ExpectedValueDescription(), - ExpectedValueDescription(), - }, - { - "3 No ScrollBars", - QRectF(0, 0, viewWidth + 50, viewHeight + 100), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOff, - ExpectedValueDescription(), - ExpectedValueDescription(50), - ExpectedValueDescription(), - ExpectedValueDescription(100), - }, - { - "4 No ScrollBars", - QRectF(-100, -100, viewWidth, viewHeight), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOff, - ExpectedValueDescription(), - ExpectedValueDescription(), - ExpectedValueDescription(), - ExpectedValueDescription(), - }, - { - "5 No ScrollBars", - QRectF(-100, -100, viewWidth + 50, viewHeight), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOff, - ExpectedValueDescription(-100), - ExpectedValueDescription(-50), - ExpectedValueDescription(), - ExpectedValueDescription(), - }, - { - "6 No ScrollBars", - QRectF(-100, -100, viewWidth + 50, viewHeight + 100), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOff, - ExpectedValueDescription(-100), - ExpectedValueDescription(-50), - ExpectedValueDescription(-100), - ExpectedValueDescription(), - }, - { - "7 No ScrollBars", - QRectF(0, 0, viewWidth + 1, viewHeight + 1), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOff, - ExpectedValueDescription(), - ExpectedValueDescription(1), - ExpectedValueDescription(), - ExpectedValueDescription(1), - }, - { - "8 No ScrollBars", - QRectF(0, 0, viewWidth + 51, viewHeight + 1), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOff, - ExpectedValueDescription(), - ExpectedValueDescription(51), - ExpectedValueDescription(), - ExpectedValueDescription(1), - }, - { - "9 No ScrollBars", - QRectF(0, 0, viewWidth + 51, viewHeight + 101), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOff, - ExpectedValueDescription(), - ExpectedValueDescription(51), - ExpectedValueDescription(), - ExpectedValueDescription(101), - }, - { - "10 No ScrollBars", - QRectF(-101, -101, viewWidth + 1, viewHeight + 1), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOff, - ExpectedValueDescription(-101), - ExpectedValueDescription(-100), - ExpectedValueDescription(-101), - ExpectedValueDescription(-100), - }, - { - "11 No ScrollBars", - QRectF(-101, -101, viewWidth + 51, viewHeight + 1), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOff, - ExpectedValueDescription(-101), - ExpectedValueDescription(-50), - ExpectedValueDescription(-101), - ExpectedValueDescription(-100), - }, - { - "12 No ScrollBars", - QRectF(-101, -101, viewWidth + 51, viewHeight + 101), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOff, - ExpectedValueDescription(-101), - ExpectedValueDescription(-50), - ExpectedValueDescription(-101), - ExpectedValueDescription(), - }, - { - "13 No ScrollBars", - QRectF(0, 0, viewWidth, viewHeight), - ScrollBarCount(0, 0, 1, 1), - 1, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOff, - ExpectedValueDescription(), - ExpectedValueDescription(0, 1), - ExpectedValueDescription(), - ExpectedValueDescription(0, 1), - }, - { - "14 No ScrollBars", - QRectF(0, 0, viewWidth + 50, viewHeight), - ScrollBarCount(0, 0, 1, 1), - 1, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOff, - ExpectedValueDescription(), - ExpectedValueDescription(50, 1), - ExpectedValueDescription(), - ExpectedValueDescription(0, 1), - }, - { - "15 No ScrollBars", - QRectF(0, 0, viewWidth + 50, viewHeight + 100), - ScrollBarCount(0, 0, 1, 1), - 1, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOff, - ExpectedValueDescription(), - ExpectedValueDescription(50, 1), - ExpectedValueDescription(), - ExpectedValueDescription(100, 1), - }, - { - "16 No ScrollBars", - QRectF(-100, -100, viewWidth, viewHeight), - ScrollBarCount(-1, -1, 1, 1), - 1, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOff, - ExpectedValueDescription(-100, -1), - ExpectedValueDescription(-100), - ExpectedValueDescription(-100, -1), - ExpectedValueDescription(-100), - }, - { - "17 No ScrollBars", - QRectF(-100, -100, viewWidth + 50, viewHeight), - ScrollBarCount(-1, -1, 1, 1), - 1, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOff, - ExpectedValueDescription(-100, -1), - ExpectedValueDescription(-50), - ExpectedValueDescription(-100, -1), - ExpectedValueDescription(-100), - }, - { - "18 No ScrollBars", - QRectF(-100, -100, viewWidth + 50, viewHeight + 100), - ScrollBarCount(-1, -1, 1, 1), - 1, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOff, - ExpectedValueDescription(-100, -1), - ExpectedValueDescription(-50), - ExpectedValueDescription(-100, -1), - ExpectedValueDescription(), - }, - { - "1 x2 No ScrollBars", - QRectF(0, 0, viewWidth, viewHeight), - ScrollBarCount(0, 0, 0, 0), - 2, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOff, - ExpectedValueDescription(), - ExpectedValueDescription(viewWidth), - ExpectedValueDescription(), - ExpectedValueDescription(viewHeight), - }, - { - "2 x2 No ScrollBars", - QRectF(0, 0, viewWidth + 50, viewHeight), - ScrollBarCount(0, 0, 0, 0), - 2, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOff, - ExpectedValueDescription(), - ExpectedValueDescription(viewWidth + 100), - ExpectedValueDescription(), - ExpectedValueDescription(viewHeight), - }, - { - "3 x2 No ScrollBars", - QRectF(0, 0, viewWidth + 50, viewHeight + 100), - ScrollBarCount(0, 0, 0, 0), - 2, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOff, - ExpectedValueDescription(), - ExpectedValueDescription(viewWidth + 100), - ExpectedValueDescription(), - ExpectedValueDescription(viewHeight + 200), - }, - { - "4 x2 No ScrollBars", - QRectF(-100, -100, viewWidth, viewHeight), - ScrollBarCount(0, 0, 0, 0), - 2, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOff, - ExpectedValueDescription(-200), - ExpectedValueDescription(viewWidth - 200), - ExpectedValueDescription(-200), - ExpectedValueDescription(viewHeight - 200), - }, - { - "5 x2 No ScrollBars", - QRectF(-100, -100, viewWidth + 50, viewHeight), - ScrollBarCount(0, 0, 0, 0), - 2, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOff, - ExpectedValueDescription(-200), - ExpectedValueDescription(viewWidth - 100), - ExpectedValueDescription(-200), - ExpectedValueDescription(viewHeight - 200), - }, - { - "6 x2 No ScrollBars", - QRectF(-100, -100, viewWidth + 50, viewHeight + 100), - ScrollBarCount(0, 0, 0, 0), - 2, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOff, - ExpectedValueDescription(-200), - ExpectedValueDescription(viewWidth - 100), - ExpectedValueDescription(-200), - ExpectedValueDescription(viewHeight), - }, - { - "1 Always ScrollBars", - QRectF(0, 0, viewWidth, viewHeight), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAlwaysOn, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(), - ExpectedValueDescription(0, 1, 1), - ExpectedValueDescription(), - ExpectedValueDescription(0, 1, 1), - }, - { - "2 Always ScrollBars", - QRectF(0, 0, viewWidth + 50, viewHeight), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAlwaysOn, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(), - ExpectedValueDescription(50, 1, 1), - ExpectedValueDescription(), - ExpectedValueDescription(0, 1, 1), - }, - { - "3 Always ScrollBars", - QRectF(0, 0, viewWidth + 50, viewHeight + 100), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAlwaysOn, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(), - ExpectedValueDescription(50, 1, 1), - ExpectedValueDescription(), - ExpectedValueDescription(100, 1, 1), - }, - { - "4 Always ScrollBars", - QRectF(-100, -100, viewWidth, viewHeight), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAlwaysOn, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(-100), - ExpectedValueDescription(-100, 1, 1), - ExpectedValueDescription(-100), - ExpectedValueDescription(-100, 1, 1), - }, - { - "5 Always ScrollBars", - QRectF(-100, -100, viewWidth + 50, viewHeight), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAlwaysOn, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(-100), - ExpectedValueDescription(-50, 1, 1), - ExpectedValueDescription(-100), - ExpectedValueDescription(-100, 1, 1), - }, - { - "6 Always ScrollBars", - QRectF(-100, -100, viewWidth + 50, viewHeight + 100), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAlwaysOn, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(-100), - ExpectedValueDescription(-50, 1, 1), - ExpectedValueDescription(-100), - ExpectedValueDescription(0, 1, 1), - }, - { - "7 Always ScrollBars", - QRectF(0, 0, viewWidth + 1, viewHeight + 1), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAlwaysOn, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(), - ExpectedValueDescription(1, 1, 1), - ExpectedValueDescription(), - ExpectedValueDescription(1, 1, 1), - }, - { - "8 Always ScrollBars", - QRectF(0, 0, viewWidth + 51, viewHeight + 1), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAlwaysOn, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(), - ExpectedValueDescription(51, 1, 1), - ExpectedValueDescription(), - ExpectedValueDescription(1, 1, 1), - }, - { - "9 Always ScrollBars", - QRectF(0, 0, viewWidth + 51, viewHeight + 101), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAlwaysOn, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(), - ExpectedValueDescription(51, 1, 1), - ExpectedValueDescription(), - ExpectedValueDescription(101, 1, 1), - }, - { - "10 Always ScrollBars", - QRectF(-101, -101, viewWidth + 1, viewHeight + 1), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAlwaysOn, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(-101), - ExpectedValueDescription(-100, 1, 1), - ExpectedValueDescription(-101), - ExpectedValueDescription(-100, 1, 1), - }, - { - "11 Always ScrollBars", - QRectF(-101, -101, viewWidth + 51, viewHeight + 1), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAlwaysOn, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(-101), - ExpectedValueDescription(-50, 1, 1), - ExpectedValueDescription(-101), - ExpectedValueDescription(-100, 1, 1), - }, - { - "12 Always ScrollBars", - QRectF(-101, -101, viewWidth + 51, viewHeight + 101), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAlwaysOn, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(-101), - ExpectedValueDescription(-50, 1, 1), - ExpectedValueDescription(-101), - ExpectedValueDescription(0, 1, 1), - }, - { - "13 Always ScrollBars", - QRectF(0, 0, viewWidth, viewHeight), - ScrollBarCount(0, 0, 1, 1), - 1, - Qt::ScrollBarAlwaysOn, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(), - ExpectedValueDescription(0, 2, 1), - ExpectedValueDescription(), - ExpectedValueDescription(0, 2, 1), - }, - { - "14 Always ScrollBars", - QRectF(0, 0, viewWidth + 50, viewHeight), - ScrollBarCount(0, 0, 1, 1), - 1, - Qt::ScrollBarAlwaysOn, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(), - ExpectedValueDescription(50, 2, 1), - ExpectedValueDescription(), - ExpectedValueDescription(0, 2, 1), - }, - { - "15 Always ScrollBars", - QRectF(0, 0, viewWidth + 50, viewHeight + 100), - ScrollBarCount(0, 0, 1, 1), - 1, - Qt::ScrollBarAlwaysOn, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(), - ExpectedValueDescription(50, 2, 1), - ExpectedValueDescription(), - ExpectedValueDescription(100, 2, 1), - }, - { - "16 Always ScrollBars", - QRectF(-100, -100, viewWidth, viewHeight), - ScrollBarCount(-1, -1, 1, 1), - 1, - Qt::ScrollBarAlwaysOn, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(-100, -1), - ExpectedValueDescription(-100, 1, 1), - ExpectedValueDescription(-100, -1), - ExpectedValueDescription(-100, 1, 1), - }, - { - "17 Always ScrollBars", - QRectF(-100, -100, viewWidth + 50, viewHeight), - ScrollBarCount(-1, -1, 1, 1), - 1, - Qt::ScrollBarAlwaysOn, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(-100, -1), - ExpectedValueDescription(-50, 1, 1), - ExpectedValueDescription(-100, -1), - ExpectedValueDescription(-100, 1, 1), - }, - { - "18 Always ScrollBars", - QRectF(-100, -100, viewWidth + 50, viewHeight + 100), - ScrollBarCount(-1, -1, 1, 1), - 1, - Qt::ScrollBarAlwaysOn, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(-100, -1), - ExpectedValueDescription(-50, 1, 1), - ExpectedValueDescription(-100, -1), - ExpectedValueDescription(0, 1, 1), - }, - { - "1 x2 Always ScrollBars", - QRectF(0, 0, viewWidth, viewHeight), - ScrollBarCount(0, 0, 0, 0), - 2, - Qt::ScrollBarAlwaysOn, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(), - ExpectedValueDescription(viewWidth, 1, 1), - ExpectedValueDescription(), - ExpectedValueDescription(viewHeight, 1, 1), - }, - { - "2 x2 Always ScrollBars", - QRectF(0, 0, viewWidth + 50, viewHeight), - ScrollBarCount(0, 0, 0, 0), - 2, - Qt::ScrollBarAlwaysOn, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(), - ExpectedValueDescription(viewWidth + 100, 1, 1), - ExpectedValueDescription(), - ExpectedValueDescription(viewHeight, 1, 1), - }, - { - "3 x2 Always ScrollBars", - QRectF(0, 0, viewWidth + 50, viewHeight + 100), - ScrollBarCount(0, 0, 0, 0), - 2, - Qt::ScrollBarAlwaysOn, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(), - ExpectedValueDescription(viewWidth + 100, 1, 1), - ExpectedValueDescription(), - ExpectedValueDescription(viewHeight + 200, 1, 1), - }, - { - "4 x2 Always ScrollBars", - QRectF(-100, -100, viewWidth, viewHeight), - ScrollBarCount(0, 0, 0, 0), - 2, - Qt::ScrollBarAlwaysOn, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(-200), - ExpectedValueDescription(viewWidth - 200, 1, 1), - ExpectedValueDescription(-200), - ExpectedValueDescription(viewHeight - 200, 1, 1), - }, - { - "5 x2 Always ScrollBars", - QRectF(-100, -100, viewWidth + 50, viewHeight), - ScrollBarCount(0, 0, 0, 0), - 2, - Qt::ScrollBarAlwaysOn, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(-200), - ExpectedValueDescription(viewWidth - 100, 1, 1), - ExpectedValueDescription(-200), - ExpectedValueDescription(viewHeight - 200, 1, 1), - }, - { - "6 x2 Always ScrollBars", - QRectF(-100, -100, viewWidth + 50, viewHeight + 100), - ScrollBarCount(0, 0, 0, 0), - 2, - Qt::ScrollBarAlwaysOn, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(-200), - ExpectedValueDescription(viewWidth - 100, 1, 1), - ExpectedValueDescription(-200), - ExpectedValueDescription(viewHeight, 1, 1), - }, - { - "1 Vertical Only", - QRectF(0, 0, viewWidth, viewHeight), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(), - ExpectedValueDescription(0, 1, 1), - ExpectedValueDescription(), - ExpectedValueDescription(), - }, - { - "2 Vertical Only", - QRectF(0, 0, viewWidth + 50, viewHeight), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(), - ExpectedValueDescription(50, 1, 1), - ExpectedValueDescription(), - ExpectedValueDescription(), - }, - { - "3 Vertical Only", - QRectF(0, 0, viewWidth + 50, viewHeight + 100), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(), - ExpectedValueDescription(50, 1, 1), - ExpectedValueDescription(), - ExpectedValueDescription(100), - }, - { - "4 Vertical Only", - QRectF(-100, -100, viewWidth, viewHeight), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(-100), - ExpectedValueDescription(-100, 1, 1), - ExpectedValueDescription(), - ExpectedValueDescription(), - }, - { - "5 Vertical Only", - QRectF(-100, -100, viewWidth + 50, viewHeight), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(-100), - ExpectedValueDescription(-50, 1, 1), - ExpectedValueDescription(), - ExpectedValueDescription(), - }, - { - "6 Vertical Only", - QRectF(-100, -100, viewWidth + 50, viewHeight + 100), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(-100), - ExpectedValueDescription(-50, 1, 1), - ExpectedValueDescription(-100), - ExpectedValueDescription(), - }, - { - "7 Vertical Only", - QRectF(0, 0, viewWidth + 1, viewHeight + 1), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(), - ExpectedValueDescription(1, 1, 1), - ExpectedValueDescription(), - ExpectedValueDescription(1), - }, - { - "8 Vertical Only", - QRectF(0, 0, viewWidth + 51, viewHeight + 1), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(), - ExpectedValueDescription(51, 1, 1), - ExpectedValueDescription(), - ExpectedValueDescription(1), - }, - { - "9 Vertical Only", - QRectF(0, 0, viewWidth + 51, viewHeight + 101), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(), - ExpectedValueDescription(51, 1, 1), - ExpectedValueDescription(), - ExpectedValueDescription(101), - }, - { - "10 Vertical Only", - QRectF(-101, -101, viewWidth + 1, viewHeight +1), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(-101), - ExpectedValueDescription(-100, 1, 1), - ExpectedValueDescription(-101), - ExpectedValueDescription(-100), - }, - { - "11 Vertical Only", - QRectF(-101, -101, viewWidth + 51, viewHeight + 1), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(-101), - ExpectedValueDescription(-50, 1, 1), - ExpectedValueDescription(-101), - ExpectedValueDescription(-100), - }, - { - "12 Vertical Only", - QRectF(-101, -101, viewWidth + 51, viewHeight + 101), - ScrollBarCount(0, 0, 0, 0), - 1, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(-101), - ExpectedValueDescription(-50, 1, 1), - ExpectedValueDescription(-101), - ExpectedValueDescription(), - }, - { - "13 Vertical Only", - QRectF(0, 0, viewWidth, viewHeight), - ScrollBarCount(0, 0, 1, 1), - 1, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(), - ExpectedValueDescription(0, 2, 1), - ExpectedValueDescription(), - ExpectedValueDescription(0, 1), - }, - { - "14 Vertical Only", - QRectF(0, 0, viewWidth + 50, viewHeight), - ScrollBarCount(0, 0, 1, 1), - 1, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(), - ExpectedValueDescription(50, 2, 1), - ExpectedValueDescription(), - ExpectedValueDescription(0, 1), - }, - { - "15 Vertical Only", - QRectF(0, 0, viewWidth + 50, viewHeight + 100), - ScrollBarCount(0, 0, 1, 1), - 1, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(), - ExpectedValueDescription(50, 2, 1), - ExpectedValueDescription(), - ExpectedValueDescription(100, 1), - }, - { - "16 Vertical Only", - QRectF(-100, -100, viewWidth, viewHeight), - ScrollBarCount(-1, -1, 1, 1), - 1, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(-100, -1), - ExpectedValueDescription(-100, 1, 1), - ExpectedValueDescription(-100, -1), - ExpectedValueDescription(-100), - }, - { - "17 Vertical Only", - QRectF(-100, -100, viewWidth + 50, viewHeight), - ScrollBarCount(-1, -1, 1, 1), - 1, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(-100, -1), - ExpectedValueDescription(-50, 1, 1), - ExpectedValueDescription(-100, -1), - ExpectedValueDescription(-100), - }, - { - "18 Vertical Only", - QRectF(-100, -100, viewWidth + 50, viewHeight + 100), - ScrollBarCount(-1, -1, 1, 1), - 1, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(-100, -1), - ExpectedValueDescription(-50, 1, 1), - ExpectedValueDescription(-100, -1), - ExpectedValueDescription(), - }, - { - "1 x2 Vertical Only", - QRectF(0, 0, viewWidth, viewHeight), - ScrollBarCount(0, 0, 0, 0), - 2, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(), - ExpectedValueDescription(viewWidth, 1, 1), - ExpectedValueDescription(), - ExpectedValueDescription(viewHeight), - }, - { - "2 x2 Vertical Only", - QRectF(0, 0, viewWidth + 50, viewHeight), - ScrollBarCount(0, 0, 0, 0), - 2, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(), - ExpectedValueDescription(viewWidth + 100, 1, 1), - ExpectedValueDescription(), - ExpectedValueDescription(viewHeight), - }, - { - "3 x2 Vertical Only", - QRectF(0, 0, viewWidth + 50, viewHeight + 100), - ScrollBarCount(0, 0, 0, 0), - 2, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(), - ExpectedValueDescription(viewWidth + 100, 1, 1), - ExpectedValueDescription(), - ExpectedValueDescription(viewHeight + 200), - }, - { - "4 x2 Vertical Only", - QRectF(-100, -100, viewWidth, viewHeight), - ScrollBarCount(0, 0, 0, 0), - 2, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(-200), - ExpectedValueDescription(viewWidth - 200, 1, 1), - ExpectedValueDescription(-200), - ExpectedValueDescription(viewHeight - 200), - }, - { - "5 x2 Vertical Only", - QRectF(-100, -100, viewWidth + 50, viewHeight), - ScrollBarCount(0, 0, 0, 0), - 2, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(-200), - ExpectedValueDescription(viewWidth - 100, 1, 1), - ExpectedValueDescription(-200), - ExpectedValueDescription(viewHeight - 200), - }, - { - "6 x2 Vertical Only", - QRectF(-100, -100, viewWidth + 50, viewHeight + 100), - ScrollBarCount(0, 0, 0, 0), - 2, - Qt::ScrollBarAlwaysOff, - Qt::ScrollBarAlwaysOn, - ExpectedValueDescription(-200), - ExpectedValueDescription(viewWidth - 100, 1, 1), - ExpectedValueDescription(-200), - ExpectedValueDescription(viewHeight), - }, - }; - - const QSize viewSize(viewWidth, viewHeight); - - for (const Data &e : data) { - QTest::addRow("%s%s, %s", style.data(), styled ? ", Styled" : "", e.name) - << style << viewSize - << e.sceneRect - << e.sceneRectOffsetFactors - << QTransform().scale(e.scale, e.scale) - << e.hbarpolicy - << e.vbarpolicy - << e.hmin << e.hmax << e.vmin << e.vmax - << styled; - } -} - -void _scrollBarRanges_data() -{ - QTest::addColumn("style"); - QTest::addColumn("viewportSize"); - QTest::addColumn("sceneRect"); - QTest::addColumn("sceneRectOffsetFactors"); - QTest::addColumn("transform"); - QTest::addColumn("hbarpolicy"); - QTest::addColumn("vbarpolicy"); - QTest::addColumn("hmin"); - QTest::addColumn("hmax"); - QTest::addColumn("vmin"); - QTest::addColumn("vmax"); - QTest::addColumn("useStyledPanel"); - - const auto styles = QStyleFactory::keys(); - for (const QString &style : styles) { - _scrollBarRanges_addTestData(style.toLatin1(), false); - _scrollBarRanges_addTestData(style.toLatin1(), true); - } - - const QScreen *screen = QGuiApplication::primaryScreen(); - if (screen && qFuzzyCompare((double)screen->logicalDotsPerInchX(), 96.0)) { - _scrollBarRanges_addTestData("motif", false); - _scrollBarRanges_addTestData("motif", true); - } -}