mirror of
https://github.com/crystalidea/qt6windows7.git
synced 2025-07-05 00:35:27 +08:00
qt 6.5.1 original
This commit is contained in:
23
tests/auto/cmake/test_QT_TESTCASE_BUILDDIR/CMakeLists.txt
Normal file
23
tests/auto/cmake/test_QT_TESTCASE_BUILDDIR/CMakeLists.txt
Normal file
@ -0,0 +1,23 @@
|
||||
# Copyright (C) 2022 The Qt Company Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
# The test is simply testing that manual specification of QT_TESTCASE_BUILDDIR works,
|
||||
# despite the weird paths.
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(test_qt_testcase_builddir)
|
||||
|
||||
find_package(Qt6Test REQUIRED)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
add_executable(test_qt_testcase_builddir WIN32 main.cpp)
|
||||
|
||||
target_link_libraries(test_qt_testcase_builddir Qt::Test)
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/testdata.txt"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/level1/level2/testdata_build.txt"
|
||||
COPYONLY
|
||||
)
|
||||
set_target_properties(test_qt_testcase_builddir PROPERTIES
|
||||
QT_TESTCASE_BUILDDIR "${CMAKE_CURRENT_BINARY_DIR}/level1/level2"
|
||||
)
|
@ -0,0 +1 @@
|
||||
This is the test data found in QT_TESTCASE_SOURCEDIR.
|
32
tests/auto/cmake/test_QT_TESTCASE_BUILDDIR/main.cpp
Normal file
32
tests/auto/cmake/test_QT_TESTCASE_BUILDDIR/main.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
// Copyright (C) 2021 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QtTest/QTest>
|
||||
#include <QDebug>
|
||||
|
||||
class TestClass : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TestClass(QObject *parent = nullptr) { }
|
||||
|
||||
private slots:
|
||||
void doTest();
|
||||
};
|
||||
|
||||
void TestClass::doTest()
|
||||
{
|
||||
QFile fsrc(QFINDTESTDATA("data/testdata.txt"));
|
||||
QVERIFY(fsrc.open(QFile::ReadOnly));
|
||||
QCOMPARE(fsrc.readAll().trimmed(),
|
||||
QByteArrayLiteral("This is the test data found in QT_TESTCASE_SOURCEDIR."));
|
||||
|
||||
QFile fbuild(QFINDTESTDATA("level2/testdata_build.txt"));
|
||||
QVERIFY(fbuild.open(QFile::ReadOnly));
|
||||
QCOMPARE(fbuild.readAll().trimmed(),
|
||||
QByteArrayLiteral("This is the test data found in custom QT_TESTCASE_BUILDDIR."));
|
||||
}
|
||||
|
||||
QTEST_MAIN(TestClass)
|
||||
#include "main.moc"
|
1
tests/auto/cmake/test_QT_TESTCASE_BUILDDIR/testdata.txt
Normal file
1
tests/auto/cmake/test_QT_TESTCASE_BUILDDIR/testdata.txt
Normal file
@ -0,0 +1 @@
|
||||
This is the test data found in custom QT_TESTCASE_BUILDDIR.
|
Reference in New Issue
Block a user