2022-08-09 22:25:49 +03:00
|
|
|
//#
|
2023-01-04 00:48:14 +03:00
|
|
|
//# Copyright (C) 2020-2023 QuasarApp.
|
2022-08-09 22:25:49 +03:00
|
|
|
//# Distributed under the GPLv3 software license, see the accompanying
|
|
|
|
//# Everyone is permitted to copy and distribute verbatim copies
|
|
|
|
//# of this license document, but changing it is not allowed.
|
|
|
|
//#
|
|
|
|
|
|
|
|
|
|
|
|
#include "qmlscanertest.h"
|
2022-10-26 10:26:40 +03:00
|
|
|
#include "qmlqt6.h"
|
2022-08-09 22:25:49 +03:00
|
|
|
#include <configparser.h>
|
|
|
|
#include <dependenciesscanner.h>
|
|
|
|
#include <filemanager.h>
|
|
|
|
#include <packing.h>
|
|
|
|
#include <pluginsparser.h>
|
|
|
|
|
|
|
|
|
|
|
|
void QmlScanerTest::test() {
|
|
|
|
// qt5
|
|
|
|
auto qmlRoot = QFileInfo(TestQtDir + "/qml").absoluteFilePath();
|
2022-10-26 10:26:40 +03:00
|
|
|
QMLQt6 scaner6(qmlRoot);
|
2022-08-09 22:25:49 +03:00
|
|
|
|
|
|
|
// qt6
|
|
|
|
|
2022-10-26 10:26:40 +03:00
|
|
|
QSet<QString> results = {
|
2022-08-09 22:25:49 +03:00
|
|
|
{qmlRoot + "/QtQuick"},
|
|
|
|
{qmlRoot + "/QtQuick/Controls"},
|
|
|
|
{qmlRoot + "/QtQuick/Controls/Material"},
|
|
|
|
{qmlRoot + "/QtQuick/Layouts"},
|
|
|
|
};
|
|
|
|
|
2022-10-26 10:26:40 +03:00
|
|
|
auto imports = scaner6.extractImportsFromFile(":/qmlFileQt6.qml");
|
2022-08-09 22:25:49 +03:00
|
|
|
|
|
|
|
QVERIFY(results.size() == imports.size());
|
|
|
|
|
2023-11-04 23:58:04 +01:00
|
|
|
for (const auto &import: std::as_const(imports)) {
|
2022-10-26 10:26:40 +03:00
|
|
|
auto path = scaner6.getPathFromImport(import);
|
2022-08-09 22:25:49 +03:00
|
|
|
QVERIFY(results.contains(path));
|
|
|
|
}
|
|
|
|
|
2022-10-26 10:26:40 +03:00
|
|
|
imports = scaner6.extractImportsFromFile(":/qmlFile.qml");
|
2022-08-09 22:25:49 +03:00
|
|
|
|
|
|
|
QVERIFY(results.size() == imports.size());
|
|
|
|
|
2023-11-04 23:58:04 +01:00
|
|
|
for (const auto & import: std::as_const(imports)) {
|
2022-10-26 10:26:40 +03:00
|
|
|
auto path = scaner6.getPathFromImport(import);
|
2022-08-09 22:25:49 +03:00
|
|
|
QVERIFY(results.contains(path));
|
|
|
|
}
|
|
|
|
|
|
|
|
// qt6
|
|
|
|
|
|
|
|
results = {
|
|
|
|
{qmlRoot + "/QtQuick"},
|
|
|
|
{qmlRoot + "/QtQuick/Window"},
|
|
|
|
{qmlRoot + "/QtQuick/Layouts"},
|
|
|
|
{qmlRoot + "/Qt/labs/folderlistmodel"},
|
|
|
|
{qmlRoot + "/QtQuick/VirtualKeyboard/Settings"},
|
|
|
|
{qmlRoot + "/QtQuick/VirtualKeyboard/Styles"},
|
|
|
|
};
|
|
|
|
|
2022-10-26 10:26:40 +03:00
|
|
|
imports = scaner6.extractImportsFromQmlModule(":/qmlDir");
|
2022-08-09 22:25:49 +03:00
|
|
|
|
|
|
|
QVERIFY(results.size() == imports.size());
|
|
|
|
|
2023-11-04 23:58:04 +01:00
|
|
|
for (const auto &import: std::as_const(imports)) {
|
2022-10-26 10:26:40 +03:00
|
|
|
auto path = scaner6.getPathFromImport(import);
|
2022-08-09 22:25:49 +03:00
|
|
|
QVERIFY(results.contains(path));
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|