mirror of
https://github.com/crystalidea/qt6windows7.git
synced 2025-07-03 07:45:30 +08:00
qt 6.5.1 original
This commit is contained in:
@ -0,0 +1,45 @@
|
||||
# Copyright (C) 2022 The Qt Company Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(test_add_resources_big_resources)
|
||||
|
||||
if (EXISTS "${CMAKE_CURRENT_LIST_DIR}/FindPackageHints.cmake")
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHints.cmake")
|
||||
endif()
|
||||
|
||||
find_package(Qt6 REQUIRED
|
||||
COMPONENTS Core Test
|
||||
HINTS ${Qt6Tests_PREFIX_PATH}
|
||||
)
|
||||
|
||||
qt6_add_library(leaf_lib STATIC leaf_lib.cpp)
|
||||
qt6_add_resources(leaf_lib resources2
|
||||
FILES resource2.txt PREFIX "/" BIG_RESOURCES)
|
||||
target_link_libraries(leaf_lib PRIVATE Qt6::Core)
|
||||
|
||||
if(NOT TARGET leaf_lib_resources2_obj)
|
||||
message(FATAL_ERROR "Object library for resources2 was not created.")
|
||||
endif()
|
||||
|
||||
qt6_add_library(intermediate_lib STATIC intermediate_lib.cpp)
|
||||
qt6_add_resources(intermediate_lib resources3
|
||||
FILES resource3.txt PREFIX "/" BIG_RESOURCES
|
||||
)
|
||||
target_link_libraries(intermediate_lib PRIVATE Qt6::Core leaf_lib)
|
||||
|
||||
if(NOT TARGET intermediate_lib_resources3_obj)
|
||||
message(FATAL_ERROR "Object library for resources3 was not created.")
|
||||
endif()
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
|
||||
qt6_add_executable(test_add_resources_big_resources main.cpp)
|
||||
qt6_add_resources(test_add_resources_big_resources resources1
|
||||
FILES resource1.txt PREFIX "/" BIG_RESOURCES)
|
||||
target_link_libraries(test_add_resources_big_resources PRIVATE Qt6::Test intermediate_lib)
|
||||
|
||||
if(NOT TARGET test_add_resources_big_resources_resources1_obj)
|
||||
message(FATAL_ERROR "Object library for resources1 was not created.")
|
||||
endif()
|
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2022 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "leaf_lib.h"
|
||||
|
||||
#include <QtCore/qfile.h>
|
||||
|
||||
namespace intermediate_lib {
|
||||
|
||||
bool isLeafLibResourceAvailable()
|
||||
{
|
||||
return leaf_lib::isResourceAvailable();
|
||||
}
|
||||
|
||||
bool isResourceAvailable()
|
||||
{
|
||||
return QFile::exists(u":/resource3.txt"_qs);
|
||||
}
|
||||
|
||||
} // namespace
|
@ -0,0 +1,9 @@
|
||||
// Copyright (C) 2022 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace intermediate_lib {
|
||||
bool isLeafLibResourceAvailable();
|
||||
bool isResourceAvailable();
|
||||
} //namespace
|
@ -0,0 +1,13 @@
|
||||
// Copyright (C) 2022 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include <QtCore/qfile.h>
|
||||
|
||||
namespace leaf_lib {
|
||||
|
||||
bool isResourceAvailable()
|
||||
{
|
||||
return QFile::exists(u":/resource2.txt"_qs);
|
||||
}
|
||||
|
||||
} // namespace
|
@ -0,0 +1,8 @@
|
||||
// Copyright (C) 2022 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace leaf_lib {
|
||||
bool isResourceAvailable();
|
||||
} // namespace
|
35
tests/auto/cmake/test_add_resources_big_resources/main.cpp
Normal file
35
tests/auto/cmake/test_add_resources_big_resources/main.cpp
Normal file
@ -0,0 +1,35 @@
|
||||
// Copyright (C) 2020 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "intermediate_lib.h"
|
||||
|
||||
#include <QtCore/qfile.h>
|
||||
#include <QtTest/QtTest>
|
||||
|
||||
class TestAddResourcesBigResources : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
void resourceInApplicationExists();
|
||||
void resourceInIntermediateLibExists();
|
||||
void resourceInLeafLibExists();
|
||||
};
|
||||
|
||||
void TestAddResourcesBigResources::resourceInApplicationExists()
|
||||
{
|
||||
QVERIFY(QFile::exists(":/resource1.txt"));
|
||||
}
|
||||
|
||||
void TestAddResourcesBigResources::resourceInIntermediateLibExists()
|
||||
{
|
||||
QVERIFY(intermediate_lib::isResourceAvailable());
|
||||
}
|
||||
|
||||
void TestAddResourcesBigResources::resourceInLeafLibExists()
|
||||
{
|
||||
QVERIFY(intermediate_lib::isLeafLibResourceAvailable());
|
||||
}
|
||||
|
||||
QTEST_MAIN(TestAddResourcesBigResources)
|
||||
#include "main.moc"
|
||||
|
@ -0,0 +1 @@
|
||||
Test resource1
|
@ -0,0 +1 @@
|
||||
Test resource2
|
@ -0,0 +1 @@
|
||||
Test resource3
|
Reference in New Issue
Block a user