test fixes
tests / windows (push) Skipped
tests / macos (push) Skipped
tests / package-smoke-linux (push) Skipped
tests / package-smoke-windows (push) Skipped
tests / package-smoke-macos (push) Skipped
tests / linux (push) Successful in 1m59s

Signed-off-by: galeon <dertiellis@gmail.com>
This commit is contained in:
galeon committed 2026-10-13 08:51:07 +03:00
1 parent 41599fa82f
commit 0dd6bef715
12 files changed
+161 -64

No files matched your search

+5 -1
View File
@@ -99,7 +99,11 @@ class TestGameLauncher : public QObject
Fixtures::makeZip(m_game + "/libraries/org/lwjgl/lwjgl-3.3.1-natives.jar",
{{QStringLiteral("META-INF/MANIFEST.MF"), "x"},
{QStringLiteral("linux/x64/org/lwjgl/") + kNativeName, "native-bytes"},
{QStringLiteral("skip/") + kNativeName + ".sha1", "hash"}});
{QStringLiteral("skip/") + kNativeName + ".sha1", "hash"},
// Служебные файлы LWJGL рядом с .so: не должны приниматься
// за версионированную библиотеку (libfoo.so.1) ни на одной ОС.
{QStringLiteral("skip/liblwjgl.so.sha1"), "hash"},
{QStringLiteral("skip/liblwjgl.so.git"), "git"}});
Fixtures::write(m_game + "/assets/indexes/5.json", "{}");
QDir().mkpath(m_game + "/assets/objects");
}
+23 -1
View File
@@ -6,6 +6,7 @@
#include <QDir>
#include <QFile>
#include <QFileInfo>
#include <QScopeGuard>
class TestLauncherPaths : public QObject
{
@@ -22,7 +23,9 @@ private slots:
void containerPerPlatform()
{
const QString home = QDir::homePath();
// Не QDir::homePath(): на Windows он смотрит в настоящий профиль, а пути
// лаунчера в тестах идут от BILAUNCHER_HOME (песочницы).
const QString home = QDir::cleanPath(TestEnv::homeDir());
#if defined(Q_OS_WIN)
QCOMPARE(LauncherPaths::containerDir(), home + QStringLiteral("/AppData/Roaming"));
QCOMPARE(LauncherPaths::defaultMinecraftDir(), LauncherPaths::containerDir() + "/.minecraft");
@@ -35,6 +38,25 @@ private slots:
#endif
}
void homeOverrideFromEnvironment()
{
const QString saved = qEnvironmentVariable("BILAUNCHER_HOME");
const auto restore = qScopeGuard([&] { TestEnv::setEnvPath("BILAUNCHER_HOME", saved); });
QCOMPARE(LauncherPaths::homeOverride(), QDir::cleanPath(TestEnv::homeDir()));
const QString other = TestEnv::freshDir("other-home");
TestEnv::setEnvPath("BILAUNCHER_HOME", QDir::toNativeSeparators(other));
QCOMPARE(LauncherPaths::homeOverride(), QDir::cleanPath(other));
QVERIFY(LauncherPaths::rootDir().startsWith(QDir::cleanPath(other) + u'/'));
// Относительный путь зависел бы от текущей папки — игнорируется, как и пустой.
for (const char *ignored : {"relative/home", ""}) {
qputenv("BILAUNCHER_HOME", ignored);
QVERIFY2(LauncherPaths::homeOverride().isEmpty(), ignored);
}
}
void filesLayout_data()
{
QTest::addColumn<QString>("actual");