diff options
author | Rachel Powers <508861+Ryex@users.noreply.github.com> | 2023-02-09 22:07:07 -0800 |
---|---|---|
committer | Rachel Powers <508861+Ryex@users.noreply.github.com> | 2023-03-20 14:56:32 -0700 |
commit | 3a0e4546c2a1914c18f71622727997a2a7518ad2 (patch) | |
tree | 83caefca044c8ac0ede5316ee1652cdaff9416b4 /tests | |
parent | cd2419137d68781354325d77c0392ab0ee1b65de (diff) | |
download | PrismLauncher-3a0e4546c2a1914c18f71622727997a2a7518ad2.tar.gz PrismLauncher-3a0e4546c2a1914c18f71622727997a2a7518ad2.tar.bz2 PrismLauncher-3a0e4546c2a1914c18f71622727997a2a7518ad2.zip |
fix: windows test compat
fix: compiler warning on int qint32 compare
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/FileSystem_test.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/tests/FileSystem_test.cpp b/tests/FileSystem_test.cpp index ab78c150..169f0669 100644 --- a/tests/FileSystem_test.cpp +++ b/tests/FileSystem_test.cpp @@ -1,4 +1,5 @@ #include <QTest> +#include <QDir> #include <QTemporaryDir> #include <QStandardPaths> @@ -769,14 +770,17 @@ slots: } void test_path_trunc() { - QCOMPARE(FS::PathTruncate("", 0), ""); - QCOMPARE(FS::PathTruncate("foo.txt", 0), ""); - QCOMPARE(FS::PathTruncate("foo.txt", 1), ""); - QCOMPARE(FS::PathTruncate("./bar/foo.txt", 0), "./bar"); - QCOMPARE(FS::PathTruncate("./bar/foo.txt", 1), "./bar"); - QCOMPARE(FS::PathTruncate("/bar/foo.txt", 1), "/bar"); - QCOMPARE(FS::PathTruncate("bar/foo.txt", 1), "bar"); - QCOMPARE(FS::PathTruncate("baz/bar/foo.txt", 2), "baz/bar"); + QCOMPARE(FS::PathTruncate("", 0), QDir::toNativeSeparators("")); + QCOMPARE(FS::PathTruncate("foo.txt", 0), QDir::toNativeSeparators("")); + QCOMPARE(FS::PathTruncate("foo.txt", 1), QDir::toNativeSeparators("")); + QCOMPARE(FS::PathTruncate("./bar/foo.txt", 0), QDir::toNativeSeparators("./bar")); + QCOMPARE(FS::PathTruncate("./bar/foo.txt", 1), QDir::toNativeSeparators("./bar")); + QCOMPARE(FS::PathTruncate("/bar/foo.txt", 1), QDir::toNativeSeparators("/bar")); + QCOMPARE(FS::PathTruncate("bar/foo.txt", 1), QDir::toNativeSeparators("bar")); + QCOMPARE(FS::PathTruncate("baz/bar/foo.txt", 2), QDir::toNativeSeparators("baz/bar")); +#if defined(Q_OS_WIN) + QCOMPARE(FS::PathTruncate("C:\\bar\\foo.txt", 1), QDir::toNativeSeparators("C:\\bar")); +#endif } }; |