MCPcopy Create free account
hub / github.com/MultiMC/Launcher / ModFolderModelTest

Class ModFolderModelTest

launcher/minecraft/mod/ModFolderModel_test.cpp:9–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7#include "minecraft/mod/ModFolderModel.h"
8
9class ModFolderModelTest : public QObject
10{
11 Q_OBJECT
12
13private
14slots:
15 // test for GH-1178 - install a folder with files to a mod list
16 void test_1178()
17 {
18 // source
19 QString source = QFINDTESTDATA("data/test_folder");
20
21 // sanity check
22 QVERIFY(!source.endsWith('/'));
23
24 auto verify = [](QString path)
25 {
26 QDir target_dir(FS::PathCombine(path, "test_folder"));
27 QVERIFY(target_dir.entryList().contains("pack.mcmeta"));
28 QVERIFY(target_dir.entryList().contains("assets"));
29 };
30
31 // 1. test with no trailing /
32 {
33 QString folder = source;
34 QTemporaryDir tempDir;
35 ModFolderModel m(tempDir.path());
36 m.installMod(folder);
37 verify(tempDir.path());
38 }
39
40 // 2. test with trailing /
41 {
42 QString folder = source + '/';
43 QTemporaryDir tempDir;
44 ModFolderModel m(tempDir.path());
45 m.installMod(folder);
46 verify(tempDir.path());
47 }
48 }
49};
50
51QTEST_GUILESS_MAIN(ModFolderModelTest)
52

Callers

nothing calls this directly

Calls 4

PathCombineFunction · 0.85
pathMethod · 0.80
installModMethod · 0.80
containsMethod · 0.45

Tested by

no test coverage detected