summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/kernel/qformlayout
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2017-02-07 21:21:59 +0100
committerMarc Mutz <marc.mutz@kdab.com>2017-02-08 11:01:31 +0000
commit626a4d89c2aec6354db9602ad1816e7f7e13d9b1 (patch)
tree7c5caecc65196ae178f59189a0e1b32c9c86f90a /tests/auto/widgets/kernel/qformlayout
parentb6bf2a33f4c33a212da7b58a049b3b5b20b3f327 (diff)
QFormLayout: take the correct row in takeRow()
I didn't even try to understand what the old code was trying to do; once you're told by a user that the code is wrong, you see that it is. Fixed by just using the row as passed to takeRow() instead of trying to do some storage-index calculations. The m_matrix indexing operator does it all for us. Added a test that checks that the expected field widget gets returned. Fixed expected test data that was wrong, and just checking that the implementation behaves as implemented, instead of as documented. Amends change 8fbae648db3bc51bafacfe1f88e40561d357e60a. [ChangeLog][QtWidget][QFormLayout] The functions takeRow() and removeRow(), new in 5.8.0, now take and remove the correct row. Task-number: QTBUG-58693 Task-number: QTBUG-15990 Change-Id: I7185ccbc6c03e2579741cad5c0c821d3ed165474 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'tests/auto/widgets/kernel/qformlayout')
-rw-r--r--tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
index d8239b5a28..c324a4bd56 100644
--- a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
+++ b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
@@ -757,13 +757,14 @@ void tst_QFormLayout::removeRow()
layout->removeRow(1);
- QVERIFY(!w1);
- QCOMPARE(layout->count(), 1);
+ QVERIFY(w1);
+ QVERIFY(!w2);
+ QCOMPARE(layout->count(), 2);
QCOMPARE(layout->rowCount(), 1);
layout->removeRow(0);
- QVERIFY(!w2);
+ QVERIFY(!w1);
QCOMPARE(layout->count(), 0);
QCOMPARE(layout->rowCount(), 0);
}
@@ -863,17 +864,19 @@ void tst_QFormLayout::takeRow()
QVERIFY(w2);
QVERIFY(result.fieldItem);
- QVERIFY(result.labelItem);
- QCOMPARE(layout->count(), 1);
+ QVERIFY(!result.labelItem);
+ QCOMPARE(layout->count(), 2);
QCOMPARE(layout->rowCount(), 1);
+ QCOMPARE(result.fieldItem->widget(), w2.data());
result = layout->takeRow(0);
QVERIFY(w1);
QVERIFY(result.fieldItem);
- QVERIFY(!result.labelItem);
+ QVERIFY(result.labelItem);
QCOMPARE(layout->count(), 0);
QCOMPARE(layout->rowCount(), 0);
+ QCOMPARE(result.fieldItem->widget(), w1.data());
result = layout->takeRow(0);