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

Method doTest

tests/MetaComponentParse_test.cpp:47–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45
46class MetaComponentParseTest : public QObject {
47 Q_OBJECT
48
49 void doTest(QString name)
50 {
51 QString source = QFINDTESTDATA("testdata/MetaComponentParse");
52
53 QString comp_rp = FS::PathCombine(source, name);
54
55 QFile file;
56 file.setFileName(comp_rp);
57 QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text));
58 QString data = file.readAll();
59 file.close();
60
61 QJsonDocument doc = QJsonDocument::fromJson(data.toUtf8());
62 QJsonObject obj = doc.object();
63
64 QJsonValue description_json = obj.value("description");
65 QJsonValue expected_json = obj.value("expected_output");
66
67 QVERIFY(!description_json.isUndefined());
68 QVERIFY(expected_json.isString());
69
70 QString expected = expected_json.toString();
71
72 QString processed = ResourcePackUtils::processComponent(description_json);
73
74 QCOMPARE(processed, expected);
75 }
76
77 private slots:
78 void test_parseComponentBasic() { doTest("component_basic.json"); }

Callers

nothing calls this directly

Calls 7

PathCombineFunction · 0.85
processComponentFunction · 0.85
openMethod · 0.80
closeMethod · 0.80
objectMethod · 0.80
valueMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected