summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets
diff options
context:
space:
mode:
authorAlexey Edelev <alexey.edelev@qt.io>2022-02-09 16:24:24 +0100
committerAlexey Edelev <alexey.edelev@qt.io>2022-02-11 21:54:44 +0100
commitfdf5d11ff6f3f5034d7d7f7664f4cc76deb26ef5 (patch)
tree22e1c4b93f718930b8c40c2ab68f1b2bc790f97e /tests/auto/widgets
parent52492ff7209d2c91cbd0d549282459b58fbf3b0f (diff)
CMake: Add BUILTIN_TESTDATA option to qt_internal_add_test
Multiple tests use qt_internal_add_resource that copies the functionality that is already implemented inside the qt_internal_add_test function. Simplify these test by replacing the qt_internal_add_resource call with the new BUILTIN_TESTDATA option. Change-Id: I18475b817d6f87264f0de53817d6c26c5ccab4e2 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'tests/auto/widgets')
-rw-r--r--tests/auto/widgets/dialogs/qfontdialog/CMakeLists.txt28
-rw-r--r--tests/auto/widgets/dialogs/qwizard/CMakeLists.txt23
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsscene/CMakeLists.txt44
-rw-r--r--tests/auto/widgets/kernel/qwidget/CMakeLists.txt26
-rw-r--r--tests/auto/widgets/styles/CMakeLists.txt4
-rw-r--r--tests/auto/widgets/styles/qstylesheetstyle/CMakeLists.txt26
6 files changed, 56 insertions, 95 deletions
diff --git a/tests/auto/widgets/dialogs/qfontdialog/CMakeLists.txt b/tests/auto/widgets/dialogs/qfontdialog/CMakeLists.txt
index 4e231cc6cc..cc19461d7a 100644
--- a/tests/auto/widgets/dialogs/qfontdialog/CMakeLists.txt
+++ b/tests/auto/widgets/dialogs/qfontdialog/CMakeLists.txt
@@ -4,17 +4,6 @@
## tst_qfontdialog Test:
#####################################################################
-qt_internal_add_test(tst_qfontdialog
- SOURCES
- tst_qfontdialog.cpp
- PUBLIC_LIBRARIES
- Qt::CorePrivate
- Qt::Gui
- Qt::GuiPrivate
- Qt::Widgets
- Qt::WidgetsPrivate
-)
-
# Resources:
set_source_files_properties("../../../shared/resources/test.ttf"
PROPERTIES QT_RESOURCE_ALIAS "test.ttf"
@@ -27,13 +16,18 @@ set(testfonts_resource_files
"../../../shared/resources/testfont.ttf"
)
-qt_internal_add_resource(tst_qfontdialog "testfonts"
- PREFIX
- "/"
- FILES
- ${testfonts_resource_files}
+qt_internal_add_test(tst_qfontdialog
+ SOURCES
+ tst_qfontdialog.cpp
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+ Qt::Gui
+ Qt::GuiPrivate
+ Qt::Widgets
+ Qt::WidgetsPrivate
+ TESTDATA ${testfonts_resource_files}
+ BUILTIN_TESTDATA
)
-
## Scopes:
#####################################################################
diff --git a/tests/auto/widgets/dialogs/qwizard/CMakeLists.txt b/tests/auto/widgets/dialogs/qwizard/CMakeLists.txt
index 81dc9e85b2..32fc41f5c9 100644
--- a/tests/auto/widgets/dialogs/qwizard/CMakeLists.txt
+++ b/tests/auto/widgets/dialogs/qwizard/CMakeLists.txt
@@ -4,15 +4,6 @@
## tst_qwizard Test:
#####################################################################
-qt_internal_add_test(tst_qwizard
- SOURCES
- tst_qwizard.cpp
- tst_qwizard_2.cpp
- PUBLIC_LIBRARIES
- Qt::Gui
- Qt::Widgets
-)
-
# Resources:
set(qwizard_resource_files
"images/background.png"
@@ -21,10 +12,14 @@ set(qwizard_resource_files
"images/watermark.png"
)
-qt_internal_add_resource(tst_qwizard "qwizard"
- PREFIX
- "/"
- FILES
- ${qwizard_resource_files}
+qt_internal_add_test(tst_qwizard
+ SOURCES
+ tst_qwizard.cpp
+ tst_qwizard_2.cpp
+ PUBLIC_LIBRARIES
+ Qt::Gui
+ Qt::Widgets
+ TESTDATA ${qwizard_resource_files}
+ BUILTIN_TESTDATA
)
diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/CMakeLists.txt b/tests/auto/widgets/graphicsview/qgraphicsscene/CMakeLists.txt
index 3c870e473e..ce4d6de7cd 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsscene/CMakeLists.txt
+++ b/tests/auto/widgets/graphicsview/qgraphicsscene/CMakeLists.txt
@@ -4,32 +4,10 @@
## tst_qgraphicsscene Test:
#####################################################################
-qt_internal_add_test(tst_qgraphicsscene
- LOWDPI # special case
- SOURCES
- tst_qgraphicsscene.cpp
- DEFINES
- QT_NO_CAST_TO_ASCII
- PUBLIC_LIBRARIES
- Qt::CorePrivate
- Qt::Gui
- Qt::GuiPrivate
- Qt::Widgets
- Qt::WidgetsPrivate
-)
-
# Resources:
-set(images_resource_files
- "Ash_European.jpg"
-)
-qt_internal_add_resource(tst_qgraphicsscene "images"
- PREFIX
- "/"
- FILES
- ${images_resource_files}
-)
set(testdata_resource_files
+ "Ash_European.jpg"
"testData/render/all-all-45-deg-left.png"
"testData/render/all-all-45-deg-right.png"
"testData/render/all-all-scale-2x.png"
@@ -60,14 +38,22 @@ set(testdata_resource_files
"testData/render/topright-topleft-untransformed.png"
)
-qt_internal_add_resource(tst_qgraphicsscene "testdata"
- PREFIX
- "/"
- FILES
- ${testdata_resource_files}
+qt_internal_add_test(tst_qgraphicsscene
+ LOWDPI # special case
+ SOURCES
+ tst_qgraphicsscene.cpp
+ DEFINES
+ QT_NO_CAST_TO_ASCII
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+ Qt::Gui
+ Qt::GuiPrivate
+ Qt::Widgets
+ Qt::WidgetsPrivate
+ TESTDATA ${testdata_resource_files}
+ BUILTIN_TESTDATA
)
-
## Scopes:
#####################################################################
diff --git a/tests/auto/widgets/kernel/qwidget/CMakeLists.txt b/tests/auto/widgets/kernel/qwidget/CMakeLists.txt
index d04db40e87..e2370a011a 100644
--- a/tests/auto/widgets/kernel/qwidget/CMakeLists.txt
+++ b/tests/auto/widgets/kernel/qwidget/CMakeLists.txt
@@ -4,6 +4,14 @@
## tst_qwidget Test:
#####################################################################
+# Resources:
+set(qwidget_resource_files
+ "geometry-fullscreen.dat"
+ "geometry-maximized.dat"
+ "geometry.dat"
+ "hellotr_la.qm"
+)
+
qt_internal_add_test(tst_qwidget
SOURCES
tst_qwidget.cpp
@@ -14,24 +22,10 @@ qt_internal_add_test(tst_qwidget
Qt::TestPrivate
Qt::Widgets
Qt::WidgetsPrivate
+ TESTDATA ${qwidget_resource_files}
+ BUILTIN_TESTDATA
)
-# Resources:
-set(qwidget_resource_files
- "geometry-fullscreen.dat"
- "geometry-maximized.dat"
- "geometry.dat"
- "hellotr_la.qm"
-)
-
-qt_internal_add_resource(tst_qwidget "qwidget"
- PREFIX
- "/"
- FILES
- ${qwidget_resource_files}
-)
-
-
#### Keys ignored in scope 1:.:.:qwidget.pro:<TRUE>:
# testcase.timeout = "600"
diff --git a/tests/auto/widgets/styles/CMakeLists.txt b/tests/auto/widgets/styles/CMakeLists.txt
index b1c9d1fce3..5d84d5e08a 100644
--- a/tests/auto/widgets/styles/CMakeLists.txt
+++ b/tests/auto/widgets/styles/CMakeLists.txt
@@ -3,7 +3,9 @@
if(APPLE)
add_subdirectory(qmacstyle)
endif()
-add_subdirectory(qstyle)
+if(QT_FEATURE_private_tests)
+ add_subdirectory(qstyle)
+endif()
add_subdirectory(qstyleoption)
if(QT_FEATURE_private_tests AND NOT ANDROID AND NOT QNX AND NOT UIKIT)
add_subdirectory(qstylesheetstyle)
diff --git a/tests/auto/widgets/styles/qstylesheetstyle/CMakeLists.txt b/tests/auto/widgets/styles/qstylesheetstyle/CMakeLists.txt
index bf4e52862c..fd66ed2a2c 100644
--- a/tests/auto/widgets/styles/qstylesheetstyle/CMakeLists.txt
+++ b/tests/auto/widgets/styles/qstylesheetstyle/CMakeLists.txt
@@ -1,13 +1,15 @@
# Generated from qstylesheetstyle.pro.
-if(NOT QT_FEATURE_private_tests)
- return()
-endif()
-
#####################################################################
## tst_qstylesheetstyle Test:
#####################################################################
+# Resources:
+set(resources_resource_files
+ "images/testimage.png"
+ "images/testimage@2x.png"
+)
+
qt_internal_add_test(tst_qstylesheetstyle
SOURCES
tst_qstylesheetstyle.cpp
@@ -17,21 +19,9 @@ qt_internal_add_test(tst_qstylesheetstyle
Qt::TestPrivate
Qt::Widgets
Qt::WidgetsPrivate
+ TESTDATA ${resources_resource_files}
+ BUILTIN_TESTDATA
)
-# Resources:
-set(resources_resource_files
- "images/testimage.png"
- "images/testimage@2x.png"
-)
-
-qt_internal_add_resource(tst_qstylesheetstyle "resources"
- PREFIX
- "/"
- FILES
- ${resources_resource_files}
-)
-
-
#### Keys ignored in scope 1:.:.:qstylesheetstyle.pro:<TRUE>:
# _REQUIREMENTS = "qtConfig(private_tests)"