summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/cmake/RunCMake/CMakeLists.txt4
-rw-r--r--tests/auto/cmake/RunCMake/StandaloneToolsPackage/CMakeLists.txt3
-rw-r--r--tests/auto/cmake/RunCMake/StandaloneToolsPackage/Qt6GarageToolsConfigExtras.cmake.in1
-rw-r--r--tests/auto/cmake/RunCMake/StandaloneToolsPackage/Qt6GarageToolsExtraInclude.cmake1
-rw-r--r--tests/auto/cmake/RunCMake/StandaloneToolsPackage/RunCMakeTest.cmake56
-rw-r--r--tests/auto/cmake/RunCMake/StandaloneToolsPackage/build_and_install_tools_package.cmake48
-rw-r--r--tests/auto/cmake/RunCMake/StandaloneToolsPackage/cmake/FindWrapScrewdriver.cmake2
-rw-r--r--tests/auto/cmake/RunCMake/StandaloneToolsPackage/consume_tools_package.cmake16
-rw-r--r--tests/auto/cmake/RunCMake/StandaloneToolsPackage/consume_tools_package_via_module.cmake16
-rw-r--r--tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp21
-rw-r--r--tests/auto/corelib/text/qlocaledata/tst_qlocaledata.cpp2
-rw-r--r--tests/auto/gui/image/qimagereader/images/image16.pgm260
-rw-r--r--tests/auto/gui/image/qimagereader/tst_qimagereader.cpp1
13 files changed, 430 insertions, 1 deletions
diff --git a/tests/auto/cmake/RunCMake/CMakeLists.txt b/tests/auto/cmake/RunCMake/CMakeLists.txt
index ec182debccd..aac9b43bac7 100644
--- a/tests/auto/cmake/RunCMake/CMakeLists.txt
+++ b/tests/auto/cmake/RunCMake/CMakeLists.txt
@@ -30,3 +30,7 @@ if(TARGET Qt6::Platform)
qt_internal_add_RunCMake_test(Sbom ${extra_run_cmake_args})
endif()
endif()
+
+list(APPEND extra_run_cmake_args "-DQT_WILL_INSTALL=${QT_WILL_INSTALL}")
+list(APPEND extra_run_cmake_args "-DQT_REPO_MODULE_VERSION=${QT_REPO_MODULE_VERSION}")
+qt_internal_add_RunCMake_test(StandaloneToolsPackage ${extra_run_cmake_args})
diff --git a/tests/auto/cmake/RunCMake/StandaloneToolsPackage/CMakeLists.txt b/tests/auto/cmake/RunCMake/StandaloneToolsPackage/CMakeLists.txt
new file mode 100644
index 00000000000..d490ae0713c
--- /dev/null
+++ b/tests/auto/cmake/RunCMake/StandaloneToolsPackage/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.16)
+project(${RunCMake_TEST} LANGUAGES CXX VERSION "${QT_REPO_MODULE_VERSION}")
+include(${RunCMake_TEST}.cmake)
diff --git a/tests/auto/cmake/RunCMake/StandaloneToolsPackage/Qt6GarageToolsConfigExtras.cmake.in b/tests/auto/cmake/RunCMake/StandaloneToolsPackage/Qt6GarageToolsConfigExtras.cmake.in
new file mode 100644
index 00000000000..35271634fde
--- /dev/null
+++ b/tests/auto/cmake/RunCMake/StandaloneToolsPackage/Qt6GarageToolsConfigExtras.cmake.in
@@ -0,0 +1 @@
+set(QT_GARAGE_TOOLS_CONFIG_EXTRAS_LOADED TRUE)
diff --git a/tests/auto/cmake/RunCMake/StandaloneToolsPackage/Qt6GarageToolsExtraInclude.cmake b/tests/auto/cmake/RunCMake/StandaloneToolsPackage/Qt6GarageToolsExtraInclude.cmake
new file mode 100644
index 00000000000..4997381e6f4
--- /dev/null
+++ b/tests/auto/cmake/RunCMake/StandaloneToolsPackage/Qt6GarageToolsExtraInclude.cmake
@@ -0,0 +1 @@
+set(QT_GARAGE_TOOLS_EXTRA_INCLUDE_LOADED TRUE)
diff --git a/tests/auto/cmake/RunCMake/StandaloneToolsPackage/RunCMakeTest.cmake b/tests/auto/cmake/RunCMake/StandaloneToolsPackage/RunCMakeTest.cmake
new file mode 100644
index 00000000000..4581f694f5a
--- /dev/null
+++ b/tests/auto/cmake/RunCMake/StandaloneToolsPackage/RunCMakeTest.cmake
@@ -0,0 +1,56 @@
+# Copyright (C) 2025 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+include(QtRunCMake)
+
+set(build_case "build_and_install_tools_package")
+set(consume_case "consume_tools_package")
+set(consume_case_via_module "consume_tools_package_via_module")
+
+function(run_cmake_and_build case)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${case}-build)
+
+ # Set an install prefix that is common to both projects.
+ set(cmake_install_prefix ${RunCMake_BINARY_DIR}/installed)
+
+ set(options
+ "-DQt6_DIR=${Qt6_DIR}"
+ "-DQT_REPO_MODULE_VERSION=${QT_REPO_MODULE_VERSION}"
+ )
+
+ # For prefix builds, install into a separate dir rather than the Qt one.
+ # For non-prefix, files will end up being copied to the Qt dir.
+ if(QT_WILL_INSTALL)
+ list(APPEND options
+ "-DCMAKE_INSTALL_PREFIX=${cmake_install_prefix}"
+ "-DQT_ADDITIONAL_PACKAGES_PREFIX_PATH=${cmake_install_prefix}"
+ "-DQT_ADDITIONAL_HOST_PACKAGES_PREFIX_PATH=${cmake_install_prefix}"
+ )
+ endif()
+
+ # Merge output, because some of configure also outputs some stuff to stderr even when
+ # everything is fine and CMake treats it as an error.
+ set(RunCMake_TEST_OUTPUT_MERGE 1)
+
+ # Configure.
+ run_cmake_with_options(${case} ${options})
+
+ # Do not remove the current RunCMake_TEST_BINARY_DIR for the next operations.
+ set(RunCMake_TEST_NO_CLEAN 1)
+
+ # Build and install
+ run_cmake_command(${case}-build "${CMAKE_COMMAND}" --build .)
+
+ if(QT_WILL_INSTALL)
+ run_cmake_command(${case}-install "${CMAKE_COMMAND}" --install .)
+ endif()
+endfunction()
+
+# Build and install the tools package.
+run_cmake_and_build("${build_case}")
+
+# Find the tools package.
+run_cmake_and_build("${consume_case}")
+
+# Find the tools package via module.
+run_cmake_and_build("${consume_case_via_module}")
diff --git a/tests/auto/cmake/RunCMake/StandaloneToolsPackage/build_and_install_tools_package.cmake b/tests/auto/cmake/RunCMake/StandaloneToolsPackage/build_and_install_tools_package.cmake
new file mode 100644
index 00000000000..7cc9ecc38d1
--- /dev/null
+++ b/tests/auto/cmake/RunCMake/StandaloneToolsPackage/build_and_install_tools_package.cmake
@@ -0,0 +1,48 @@
+# Copyright (C) 2025 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+find_package(Qt6 REQUIRED COMPONENTS Core BuildInternals)
+
+# Avoid erorrs in CI about unsupported SDK and Xcode versions on older CI macOS versions.
+if(APPLE)
+ set(QT_NO_APPLE_SDK_AND_XCODE_CHECK ON)
+endif()
+
+qt_internal_project_setup()
+
+qt_build_repo_begin()
+
+set(base_name "Garage")
+set(extra_file_base_path "${CMAKE_CURRENT_SOURCE_DIR}/${QT_CMAKE_EXPORT_NAMESPACE}${base_name}")
+
+# Add a standalone tools package.
+qt_internal_add_tools_package(
+ PACKAGE_BASE_NAME ${base_name}
+ EXTRA_CMAKE_FILES
+ "${extra_file_base_path}ToolsExtraInclude.cmake"
+ EXTRA_CMAKE_INCLUDES
+ "${QT_CMAKE_EXPORT_NAMESPACE}${base_name}ToolsExtraInclude.cmake"
+)
+
+# Check that we can add third party dependencies to the tools package.
+qt_internal_record_tools_package_extra_third_party_dependency(
+ PACKAGE_BASE_NAME ${base_name}
+ DEPENDENCY_PACKAGE_NAME WrapScrewdriver)
+
+# Add a module that should be look up the standalone tools package when the module itself is
+# looked up.
+qt_internal_add_module(Workshop
+ HEADER_MODULE
+ NO_MODULE_HEADERS
+ NO_PRIVATE_MODULE
+ NO_GENERATE_CPP_EXPORTS
+ NO_ADDITIONAL_TARGET_INFO
+ NO_GENERATE_METATYPES
+ NO_PACKAGE_CONFIG_FILE
+ NO_MODULE_JSON_FILE
+ NO_QMAKE_SUPPORT_FILES
+)
+qt_record_extra_qt_main_tools_package_dependency(Workshop GarageTools "6")
+
+qt_build_repo_post_process()
+qt_build_repo_end()
diff --git a/tests/auto/cmake/RunCMake/StandaloneToolsPackage/cmake/FindWrapScrewdriver.cmake b/tests/auto/cmake/RunCMake/StandaloneToolsPackage/cmake/FindWrapScrewdriver.cmake
new file mode 100644
index 00000000000..484dc8f35d8
--- /dev/null
+++ b/tests/auto/cmake/RunCMake/StandaloneToolsPackage/cmake/FindWrapScrewdriver.cmake
@@ -0,0 +1,2 @@
+set(WrapScrewdriver_FOUND TRUE)
+set(QT_SCREW_DRIVER_LOADED TRUE)
diff --git a/tests/auto/cmake/RunCMake/StandaloneToolsPackage/consume_tools_package.cmake b/tests/auto/cmake/RunCMake/StandaloneToolsPackage/consume_tools_package.cmake
new file mode 100644
index 00000000000..9b37905d569
--- /dev/null
+++ b/tests/auto/cmake/RunCMake/StandaloneToolsPackage/consume_tools_package.cmake
@@ -0,0 +1,16 @@
+# Copyright (C) 2025 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+find_package(Qt6 REQUIRED COMPONENTS GarageTools)
+
+if(NOT QT_GARAGE_TOOLS_CONFIG_EXTRAS_LOADED)
+ message(FATAL_ERROR "Qt6GarageToolsConfigExtras.cmake was not loaded.")
+endif()
+
+if(NOT QT_GARAGE_TOOLS_EXTRA_INCLUDE_LOADED)
+ message(FATAL_ERROR "Qt6GarageToolsExtraInclude.cmake was not loaded.")
+endif()
+
+if(NOT QT_SCREW_DRIVER_LOADED)
+ message(FATAL_ERROR "FindWrapScrewdriver.cmake was not loaded.")
+endif()
diff --git a/tests/auto/cmake/RunCMake/StandaloneToolsPackage/consume_tools_package_via_module.cmake b/tests/auto/cmake/RunCMake/StandaloneToolsPackage/consume_tools_package_via_module.cmake
new file mode 100644
index 00000000000..4fe592a1f69
--- /dev/null
+++ b/tests/auto/cmake/RunCMake/StandaloneToolsPackage/consume_tools_package_via_module.cmake
@@ -0,0 +1,16 @@
+# Copyright (C) 2025 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+find_package(Qt6 REQUIRED COMPONENTS Workshop)
+
+if(NOT QT_GARAGE_TOOLS_CONFIG_EXTRAS_LOADED)
+ message(FATAL_ERROR "Qt6GarageToolsConfigExtras.cmake was not loaded.")
+endif()
+
+if(NOT QT_GARAGE_TOOLS_EXTRA_INCLUDE_LOADED)
+ message(FATAL_ERROR "Qt6GarageToolsExtraInclude.cmake was not loaded.")
+endif()
+
+if(NOT QT_SCREW_DRIVER_LOADED)
+ message(FATAL_ERROR "FindWrapScrewdriver.cmake was not loaded.")
+endif()
diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
index 9be046c75be..b05a055252b 100644
--- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
+++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
@@ -397,6 +397,7 @@ private slots:
void iterateAssociativeContainerElements_data();
void iterateAssociativeContainerElements() { runTestFunction(); }
void iterateContainerElements();
+ void emptyContainerInterface();
void pairElements_data();
void pairElements() { runTestFunction(); }
@@ -5324,6 +5325,26 @@ void tst_QVariant::iterateContainerElements()
}
}
+void tst_QVariant::emptyContainerInterface()
+{
+ // An empty container interface should implicitly be of invalid size
+ // and its begin and end iterators should be equal.
+
+ const QtMetaContainerPrivate::QMetaContainerInterface emptyContainerInterface {};
+ QIterable emptyIterable(QMetaContainer(&emptyContainerInterface), nullptr);
+
+ QCOMPARE(emptyIterable.size(), -1);
+ auto constBegin = emptyIterable.constBegin();
+ auto constEnd = emptyIterable.constEnd();
+ QVERIFY(constBegin == constEnd);
+ QCOMPARE(constEnd - constBegin, 0);
+
+ auto mutableBegin = emptyIterable.mutableBegin();
+ auto mutableEnd = emptyIterable.mutableEnd();
+ QVERIFY(mutableBegin == mutableEnd);
+ QCOMPARE(mutableEnd - mutableBegin, 0);
+}
+
template <typename Pair> static void testVariantPairElements()
{
QFETCH(std::function<void(void *)>, makeValue);
diff --git a/tests/auto/corelib/text/qlocaledata/tst_qlocaledata.cpp b/tests/auto/corelib/text/qlocaledata/tst_qlocaledata.cpp
index a63dea4c679..93024bb4a6c 100644
--- a/tests/auto/corelib/text/qlocaledata/tst_qlocaledata.cpp
+++ b/tests/auto/corelib/text/qlocaledata/tst_qlocaledata.cpp
@@ -260,7 +260,7 @@ void tst_QLocaleData::numericData_data()
<< u"\u00D7\u06F1\u06F0^"_s << GS(1, 3, 3) << U'\u06F0' << false;
// Grouping separator variants:
- QTest::newRow("gsw-Latn-CH/exp") // Right single quote for grouping:
+ QTest::newRow("gsw-Latn-CH/exp") // Uses apostrophe for grouping (matching C++):
<< LOCALE_DATA_PTR(SwissGerman, LatinScript, Switzerland)
<< QLocaleData::DoubleScientificMode
<< u"."_s << u"'"_s << u"\u2212"_s << u"+"_s << u"E"_s
diff --git a/tests/auto/gui/image/qimagereader/images/image16.pgm b/tests/auto/gui/image/qimagereader/images/image16.pgm
new file mode 100644
index 00000000000..4e0b55131b0
--- /dev/null
+++ b/tests/auto/gui/image/qimagereader/images/image16.pgm
@@ -0,0 +1,260 @@
+P2
+16
+16
+65535
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+65535
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
+32767
diff --git a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp
index de9fea78ea6..8ccaf435f0b 100644
--- a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp
@@ -610,6 +610,7 @@ void tst_QImageReader::imageFormat_data()
QTest::newRow("pbm") << QString("image.pbm") << QByteArray("pbm") << QImage::Format_Mono;
QTest::newRow("pgm") << QString("image.pgm") << QByteArray("pgm") << QImage::Format_Grayscale8;
+ QTest::newRow("pgm") << QString("image16.pgm") << QByteArray("pgm") << QImage::Format_Grayscale16;
QTest::newRow("ppm-1") << QString("image.ppm") << QByteArray("ppm") << QImage::Format_RGB32;
QTest::newRow("ppm-2") << QString("teapot.ppm") << QByteArray("ppm") << QImage::Format_RGB32;
QTest::newRow("ppm-3") << QString("runners.ppm") << QByteArray("ppm") << QImage::Format_RGB32;