aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2020-05-05 16:08:42 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2020-05-20 09:00:41 +0200
commit2c9dae7b22f9dc857715ca7da64185eed9523eb4 (patch)
treedc1fb643bd20c5b98a12ac76167bb9fd45637667 /tests
parent5592ccf7884b272b4b17354101bd20ba9012638a (diff)
TableView: allow negative spacing
There is no apparent reason why negative spacing should not be allowed. And in fact, you can use negative spacing to eliminate double edges in the grid when the delegate is e.g a rectangle with a border. Fixes: QTBUG-83956 Change-Id: I3be9d58ac8c43142e26e75165274e41872e878f4 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit adfff7ec77223dfdd8c29327dc0f0181972516ef) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/quick/qquicktableview/tst_qquicktableview.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp b/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp
index ef39a91a65..b876ead301 100644
--- a/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp
+++ b/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp
@@ -1316,15 +1316,22 @@ void tst_QQuickTableView::checkSpacingValues()
QCOMPARE(tableView->contentWidth(), expectedInitialContentWidth);
QCOMPARE(tableView->contentHeight(), expectedInitialContentHeight);
- // Invalid assignments (should ignore)
+ // Negative spacing is allowed, and can be used to eliminate double edges
+ // in the grid if the delegate is a rectangle with a border.
tableView->setRowSpacing(-1);
- tableView->setColumnSpacing(-5);
+ tableView->setColumnSpacing(-1);
+ QCOMPARE(tableView->rowSpacing(), -1);
+ QCOMPARE(tableView->columnSpacing(), -1);
+
+ tableView->setRowSpacing(10);
+ tableView->setColumnSpacing(10);
+ // Invalid assignments (should ignore)
tableView->setRowSpacing(INFINITY);
tableView->setColumnSpacing(INFINITY);
tableView->setRowSpacing(NAN);
tableView->setColumnSpacing(NAN);
- QCOMPARE(tableView->rowSpacing(), 42);
- QCOMPARE(tableView->columnSpacing(), 12);
+ QCOMPARE(tableView->rowSpacing(), 10);
+ QCOMPARE(tableView->columnSpacing(), 10);
}
void tst_QQuickTableView::checkDelegateParent()