summaryrefslogtreecommitdiffstats
path: root/src/testlib/qabstractitemmodeltester.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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>