summaryrefslogtreecommitdiffstats
path: root/src/testlib/qabstractitemmodeltester.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix typo in QAbstractItemModelTesterAndreas Buhr2021-12-081-1/+1
| | | | | | | | | | When recursively checking children in QAbstractItemModelTester, the currentDepth of recursion was incorrectly increased. This patch fixes it. Pick-to: 6.2 5.15 Change-Id: Ia79508f358e2fcb6b90780a79baec053522e871c Reviewed-by: David Faure <david.faure@kdab.com>
* Update QAbstractItemModelTester::FailureReportingMode documentationTor Arne Vestbø2021-08-011-2/+1
| | | | | | | | | | The key part of FailureReportingMode::QtTest is that it will result in a test failure (via QTest::qVerify); not that it's using the QtTest logging machinery. Pick-to: 6.2 Change-Id: I18472fba173ce1323748f1f87301a4defa87020e Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Fix QAbstractItemModelTester false positiveLuca Beldi2021-04-261-1/+1
| | | | | | | | | When inserting rows to a branch with no columns the tester should not complain about indexes being invalid Pick-to: 6.1 6.0 5.15 Change-Id: I466f4e5140b10f6dcf65a71f109c2d3be7336507 Reviewed-by: David Faure <david.faure@kdab.com>
* Fix QAbstractItemModelTester false positiveLuca Beldi2021-04-191-2/+2
| | | | | | | | | | When rows are removed from a model with no columns, the test should not report a problem if indexes are invalid Fixes: QTBUG-92886 Pick-to: 6.1 6.0 5.15 Change-Id: I7a042dfdb2575f87208a00cbed13db3869807f84 Reviewed-by: David Faure <david.faure@kdab.com>
* QAbstractItemModelTester: fix false positive when model has zero columnsDavid Faure2021-03-301-1/+1
| | | | | | | | | | Regression introduced by me in commit 72e0d699cec09458ca9325035d477d4899e8e47b Fixes: QTBUG-92220 Change-Id: Ic7dd4eda0a1993f9763933882baf928bfc83b08b Pick-to: 6.1 6.0 5.15 Reviewed-by: Luca Beldi <v.ronin@yahoo.it> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Replace QtTest headers with QTestDavid Skoland2020-12-221-1/+2
| | | | | | | | | | | Complete search and replace of QtTest and QtTest/QtTest with QTest, as QtTest includes the whole module. Replace all such instances with correct header includes. See Jira task for more discussion. Fixes: QTBUG-88831 Change-Id: I981cfae18a1cabcabcabee376016b086d9d01f44 Pick-to: 6.0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QAbstractItemModelTester: don't rely on hasChildren()David Faure2020-10-271-4/+5
| | | | | | | | | | | | | | | | | | | Dynamic models which use fetchMore to asynchronously fill subdirs (like KDirModel) return true in hasChildren() for dirs that are expected to have children (so that the "+" shows in the treeview) but do not actually have children readily available. They will be inserted later on once the async listing job is done (as a result of fetchMore triggering that job). So QAbstractItemModelTester should use rowCount instead, to find out if there are children present. This detected a bug in QConcatenateTablesProxyModel: it returned a non-zero rowCount for its items, while it's flat. Change-Id: Idcdc86159f1fc79ed5297075dfcf30c09896287a Pick-to: 5.15 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix gcc warning about possible call of printf with nullptrVolker Hilsheimer2020-09-021-2/+6
| | | | | | | | | | Amends fe4794f70ecc4a302b22ad26614203a70c049a13 Depending on the types, the generic QTest::toString version might be used, which returns nullptr. Change-Id: Ic60675057181629d1cf9cb22e7508d57c026a0ad Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Close memory leak in QTestLib support for item model testingVolker Hilsheimer2020-05-121-4/+14
| | | | | | | | | | | | QTest::toString allocates memory by calling qstrdup; that memory must be freed by the caller. Change-Id: I218bc57b3312fdd9195fb49eaed7d20df4bf717c Fixes: QTBUG-84081 Coverity-Id: 186979 Covierty-Id: 186980 Pick-to: 5.15 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge remote-tracking branch 'origin/5.14' into 5.15Liang Qi2020-03-311-0/+6
|\ | | | | | | | | | | | | Conflicts: tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp Change-Id: Ifaa56153f5f0d687a6b4d94f84fcfa1e1751afd2
| * testlib: add QAbstractItemModelTester::verify()Liang Qi2020-03-301-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This amends b3e4be2d8b9debf217657436139da0152f6f8797. When building testlib with QtGui linked:(use "QT = core-private gui" in src/testlib/testlib.pro) Undefined symbols for architecture x86_64: "QAbstractItemModelTester::verify(bool, char const*, char const*, char const*, int)", referenced from: QTestPrivate::testDataGuiRoles(QAbstractItemModelTester*) in qabstractitemmodeltester.o Change-Id: Ideb10ddd6717fed8d9f91f75bbfc9d5a22104730 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* | Replace usages of QVariant::value by qvariant_castOlivier Goffart2019-12-151-1/+1
|/ | | | | | | This is done automatically with a clazy check Change-Id: I3b59511d3d36d416c8eda74858ead611d327b116 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix ICE on QNX 6.6Sergio Martins2018-10-051-1/+1
| | | | | | | qabstractitemmodeltester.cpp:223:31: internal compiler error: in expand_expr_real_1, at expr.c:9170 Change-Id: I098c1bdf706512c91c649205f4675de0ca374227 Reviewed-by: David Faure <david.faure@kdab.com>
* QAbstractItemModelTester: don't call match(QModelIndex(), ...)David Faure2018-06-271-2/+3
| | | | | | | | | The documentation for match() indicates that the index has to be valid since it determines which column to search in (in addition to "from which row"). So call match with a valid index, if the model isn't empty. Change-Id: I5f3754cf14d053bf04d207cefe7dcc938e0f4a5a Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QAbstractItemModelTester: fix out-of-bounds index() callsDavid Faure2018-06-271-4/+15
| | | | | | | | | | | | | | When removing rows, the tester is looking at the data of the row "just before" and the row "just after" the removed rows, to see if they are still the same at the end of the removal operation. Guard this with bounds check, in case there is no row just before or just after. This is the opportunity to use modeltester in tst_qidentityproxymodel, which was already a testcase for removing the only row in a given parent. Change-Id: Iec8228c16b9c670b794e2665356d153679178494 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* TestLib: Fix license headers in qabstractitemmodeltester.*Kai Koehne2018-05-071-5/+16
| | | | | Change-Id: Ide05bcdd30cd5f672949aacd5564a4a73c38366d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* doc: Fix remaining clang parsing errors in QtTestMartin Smith2018-01-181-14/+14
| | | | | | | | This update also corrects all the remaining qdoc warnings in the mnodule. Change-Id: I1cea2cb1dd515d075a1e49a52ca78fc407c3a324 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Long live QAbstractItemModelTester!Giuseppe D'Angelo2018-01-091-0/+807
AKA the model tester, living in QtTestLib now. Underwent some significant refactoring from the original modeltester: in particular, it will stop testing illegal indices. [ChangeLog][QtTestLib] Added QAbstractItemModelTester, a class to help testing item models. Change-Id: I0e5efed7217330be11465ce3abb3590f3f2601a4 Reviewed-by: David Faure <david.faure@kdab.com>