qt5base-lts/tests/auto/cmake/test_add_resource_prefix/main.cpp
Amir Masoud Abdol 2625e5f050 Make the PREFIX Parameter of the qt_add_resources Optional
The `rcc_PREFIX` will be set to `/` if it is not passed to the
function and it is not defined in `QT_RESOURCE_PREFIX`.

I also removed an unnecessary check of the `rcc_PREFIX`.

[ChangeLog][QtCore][CMake] The `PREFIX` parameter of the
`qt_add_resources` is now optional. If not passed, and
`QT_RESOURCE_PREFIX` is not defined, `/` will be used as the path
prefix.

Fixes: QTBUG-104938
Change-Id: I6524ab5dc54f035272e4c2e3154eb67591efb650
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-10-25 16:39:25 +02:00

27 lines
621 B
C++

// 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 <QFile>
#include <QtTest>
class TestAddResourcePrefix : public QObject
{
Q_OBJECT
private slots:
void resourceInDefaultPathExists();
void resourceInGivenPathExists();
};
void TestAddResourcePrefix::resourceInDefaultPathExists()
{
QVERIFY(QFile::exists(":/resource_file.txt"));
}
void TestAddResourcePrefix::resourceInGivenPathExists()
{
QVERIFY(QFile::exists(":/resources/resource_file.txt"));
}
QTEST_MAIN(TestAddResourcePrefix)
#include "main.moc"