Skip to content

Commit

Permalink
Testlib: Add a feature for the item model tester
Browse files Browse the repository at this point in the history
It depends on QAbstractItemModel, so we need to switch it off if
itemmodel is unavailable.

Change-Id: I97246767a5e387b7a2cee90c34125a8411ef1c4e
Reviewed-by: Oswald Buddenhagen <[email protected]>
  • Loading branch information
Ulf Hermann committed Mar 21, 2018
1 parent 4db3819 commit 955cf40
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 3 deletions.
3 changes: 2 additions & 1 deletion configure.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"src/xml",
"src/widgets",
"src/printsupport",
"src/plugins/sqldrivers"
"src/plugins/sqldrivers",
"src/testlib"
],

"commandline": {
Expand Down
22 changes: 22 additions & 0 deletions src/testlib/configure.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"module": "testlib",
"depends": [
"core"
],

"features": {
"itemmodeltester": {
"label": "Tester for item models",
"purpose": "Provides a utility to test item models.",
"condition": "features.itemmodel",
"output": [ "publicFeature" ]
}
},

"summary": [
{
"section": "Qt Testlib",
"entries": [ "itemmodeltester" ]
}
]
}
2 changes: 2 additions & 0 deletions src/testlib/qabstractitemmodeltester.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
#include <QtGui/QIcon>
#endif

QT_REQUIRE_CONFIG(itemmodeltester);

QT_BEGIN_NAMESPACE

class QAbstractItemModel;
Expand Down
1 change: 1 addition & 0 deletions src/testlib/qttestglobal.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#define QTTESTGLOBAL_H

#include <QtCore/qglobal.h>
#include <QtTest/qttestlib-config.h>

QT_BEGIN_NAMESPACE

Expand Down
10 changes: 8 additions & 2 deletions src/testlib/testlib.pro
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ unix:!embedded:QMAKE_PKGCONFIG_DESCRIPTION = Qt \
QMAKE_DOCS = $$PWD/doc/qttestlib.qdocconf

HEADERS = \
qabstractitemmodeltester.h \
qbenchmark.h \
qbenchmark_p.h \
qbenchmarkmeasurement_p.h \
Expand Down Expand Up @@ -43,7 +42,6 @@ HEADERS = \
qttestglobal.h

SOURCES = \
qabstractitemmodeltester.cpp \
qtestcase.cpp \
qtestlog.cpp \
qtesttable.cpp \
Expand All @@ -69,6 +67,14 @@ SOURCES = \
qxunittestlogger.cpp \
qtestblacklist.cpp

qtConfig(itemmodeltester) {
HEADERS += \
qabstractitemmodeltester.h

SOURCES += \
qabstractitemmodeltester.cpp
}

DEFINES *= QT_NO_CAST_TO_ASCII \
QT_NO_CAST_FROM_ASCII \
QT_NO_FOREACH \
Expand Down

0 comments on commit 955cf40

Please sign in to comment.