MCPcopy Create free account
hub / github.com/FreesmTeam/FreesmLauncher / test_SaveLoadLists

Method test_SaveLoadLists

tests/INIFile_test.cpp:49–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47 }
48
49 void test_SaveLoadLists()
50 {
51 QString slist_strings = "(\"a\",\"b\",\"c\")";
52 QStringList list_strings = { "a", "b", "c" };
53
54 QString slist_numbers = "(1,2,3,10)";
55 QList<int> list_numbers = { 1, 2, 3, 10 };
56
57 QString filename = "test_SaveLoadLists.ini";
58
59 INIFile f;
60 f.set("list_strings", list_strings);
61 f.set("list_numbers", QVariantUtils::fromList(list_numbers));
62 f.saveFile(filename);
63
64 // load
65 INIFile f2;
66 f2.loadFile(filename);
67
68 QStringList out_list_strings = f2.get("list_strings", QStringList()).toStringList();
69 qDebug() << "OutStringList" << out_list_strings;
70
71 QList<int> out_list_numbers = QVariantUtils::toList<int>(f2.get("list_numbers", QVariantUtils::fromList(QList<int>())));
72 qDebug() << "OutNumbersList" << out_list_numbers;
73
74 QCOMPARE(out_list_strings, list_strings);
75 QCOMPARE(out_list_numbers, list_numbers);
76 }
77
78 void test_SaveAlreadyExistingFile()
79 {

Callers

nothing calls this directly

Calls 6

fromListFunction · 0.85
saveFileMethod · 0.80
loadFileMethod · 0.80
toStringListMethod · 0.80
setMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected