From 2dcedcfde336d181e28d7884fe5b584e2527f0f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Tue, 26 May 2015 08:29:43 +0200 Subject: GH-997 add unit test for ini file save/load passthrough --- tests/tst_inifile.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/tests/tst_inifile.cpp b/tests/tst_inifile.cpp index 94b5e559..2c3d8103 100644 --- a/tests/tst_inifile.cpp +++ b/tests/tst_inifile.cpp @@ -17,7 +17,7 @@ slots: } - void test_PathCombine1_data() + void test_Escape_data() { QTest::addColumn("through"); @@ -27,7 +27,7 @@ slots: QTest::newRow("Escape sequences") << "Lorem\n\t\n\\n\\tAAZ\nipsum dolor\n\nsit amet."; QTest::newRow("Escape sequences 2") << "\"\n\n\""; } - void test_PathCombine1() + void test_Escape() { QFETCH(QString, through); @@ -36,6 +36,25 @@ slots: QCOMPARE(back, through); } + + void test_SaveLoad() + { + QString a = "a"; + QString b = "a\nb\t\n\\\\\\C:\\Program files\\terrible\\name\\of something\\"; + QString filename = "test_SaveLoad.ini"; + + // save + INIFile f; + f.set("a", a); + f.set("b", b); + f.saveFile(filename); + + // load + INIFile f2; + f2.loadFile(filename); + QCOMPARE(a, f2.get("a","NOT SET").toString()); + QCOMPARE(b, f2.get("b","NOT SET").toString()); + } }; QTEST_GUILESS_MAIN(IniFileTest) -- cgit v1.2.3