diff options
author | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2020-05-05 16:08:42 +0200 |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2020-05-07 13:25:13 +0200 |
commit | adfff7ec77223dfdd8c29327dc0f0181972516ef (patch) | |
tree | dfb22d932f25cf52a99f40e6f6ea68c070e286a0 /tests | |
parent | 150cd0570d28291d6727c6e42ab83b746ac2e578 (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
Pick-to: 5.15
Change-Id: I3be9d58ac8c43142e26e75165274e41872e878f4
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/quick/qquicktableview/tst_qquicktableview.cpp | 15 |
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 6e13044390..26360c3443 100644 --- a/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp +++ b/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp @@ -1326,15 +1326,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() |