summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGravatar jan Iversen <jani@apache.org>2018-08-08 21:11:33 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-08-13 11:49:32 -0700
commit526c1324fc716c881120c411ad13fdea7c2cdb5f (patch)
tree4f17370bf890e81831d343306e9cb4963ec2012c /tests
parentdfa3f5e0e7d2e7e0f043ad60ef5ea832319504f5 (diff)
downloadsubsurface-526c1324fc716c881120c411ad13fdea7c2cdb5f.tar.gz
tests: move Language test from testpreferences
Remove Language test in testpreferences add the same Language tests to testqPrefLanguage Signed-off-by: Jan Iversen <jani@apache.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/testpreferences.cpp37
-rw-r--r--tests/testqPrefLanguage.cpp47
-rw-r--r--tests/testqPrefLanguage.h1
3 files changed, 48 insertions, 37 deletions
diff --git a/tests/testpreferences.cpp b/tests/testpreferences.cpp
index f7912d6c0..85534ccee 100644
--- a/tests/testpreferences.cpp
+++ b/tests/testpreferences.cpp
@@ -109,43 +109,6 @@ void TestPreferences::testPreferences()
TEST(general->o2Consumption(), 1);
TEST(general->pscrRatio(), 1);
TEST(general->useDefaultFile(), false);
-
- auto language = qPrefLanguage::instance();
- language->set_lang_locale("en_US");
- language->set_language("en");
- language->set_time_format("hh:mm");
- language->set_date_format("dd/mm/yy");
- language->set_date_format_short("dd/mm");
- language->set_time_format_override(false);
- language->set_date_format_override(false);
- language->set_use_system_language(false);
-
- TEST(language->lang_locale(), QStringLiteral("en_US"));
- TEST(language->language(), QStringLiteral("en"));
- TEST(language->time_format(), QStringLiteral("hh:mm"));
- TEST(language->date_format(), QStringLiteral("dd/mm/yy"));
- TEST(language->date_format_short(), QStringLiteral("dd/mm"));
- TEST(language->time_format_override(), false);
- TEST(language->date_format_override(), false);
- TEST(language->use_system_language(), false);
-
- language->set_lang_locale("en_EN");
- language->set_language("br");
- language->set_time_format("mm:hh");
- language->set_date_format("yy/mm/dd");
- language->set_date_format_short("dd/yy");
- language->set_time_format_override(true);
- language->set_date_format_override(true);
- language->set_use_system_language(true);
-
- TEST(language->lang_locale(), QStringLiteral("en_EN"));
- TEST(language->language(), QStringLiteral("br"));
- TEST(language->time_format(), QStringLiteral("mm:hh"));
- TEST(language->date_format(), QStringLiteral("yy/mm/dd"));
- TEST(language->date_format_short(), QStringLiteral("dd/yy"));
- TEST(language->time_format_override(), true);
- TEST(language->date_format_override(), true);
- TEST(language->use_system_language(), true);
}
QTEST_MAIN(TestPreferences)
diff --git a/tests/testqPrefLanguage.cpp b/tests/testqPrefLanguage.cpp
index d2cea59e8..3f6db017e 100644
--- a/tests/testqPrefLanguage.cpp
+++ b/tests/testqPrefLanguage.cpp
@@ -151,4 +151,51 @@ void TestQPrefLanguage::test_multiple()
QCOMPARE(tst_direct->time_format_override(), true);
}
+#define TEST(METHOD, VALUE) \
+ QCOMPARE(METHOD, VALUE); \
+ language->sync(); \
+ language->load(); \
+ QCOMPARE(METHOD, VALUE);
+
+void TestQPrefLanguage::test_oldPreferences()
+{
+ auto language = qPrefLanguage::instance();
+ language->set_lang_locale("en_US");
+ language->set_language("en");
+ language->set_time_format("hh:mm");
+ language->set_date_format("dd/mm/yy");
+ language->set_date_format_short("dd/mm");
+ language->set_time_format_override(false);
+ language->set_date_format_override(false);
+ language->set_use_system_language(false);
+
+ TEST(language->lang_locale(), QStringLiteral("en_US"));
+ TEST(language->language(), QStringLiteral("en"));
+ TEST(language->time_format(), QStringLiteral("hh:mm"));
+ TEST(language->date_format(), QStringLiteral("dd/mm/yy"));
+ TEST(language->date_format_short(), QStringLiteral("dd/mm"));
+ TEST(language->time_format_override(), false);
+ TEST(language->date_format_override(), false);
+ TEST(language->use_system_language(), false);
+
+ language->set_lang_locale("en_EN");
+ language->set_language("br");
+ language->set_time_format("mm:hh");
+ language->set_date_format("yy/mm/dd");
+ language->set_date_format_short("dd/yy");
+ language->set_time_format_override(true);
+ language->set_date_format_override(true);
+ language->set_use_system_language(true);
+
+ TEST(language->lang_locale(), QStringLiteral("en_EN"));
+ TEST(language->language(), QStringLiteral("br"));
+ TEST(language->time_format(), QStringLiteral("mm:hh"));
+ TEST(language->date_format(), QStringLiteral("yy/mm/dd"));
+ TEST(language->date_format_short(), QStringLiteral("dd/yy"));
+ TEST(language->time_format_override(), true);
+ TEST(language->date_format_override(), true);
+ TEST(language->use_system_language(), true);
+
+}
+
QTEST_MAIN(TestQPrefLanguage)
diff --git a/tests/testqPrefLanguage.h b/tests/testqPrefLanguage.h
index b7afe9e1a..c10b99930 100644
--- a/tests/testqPrefLanguage.h
+++ b/tests/testqPrefLanguage.h
@@ -14,6 +14,7 @@ private slots:
void test_set_load_struct();
void test_struct_disk();
void test_multiple();
+ void test_oldPreferences();
};
#endif // TESTQPREFLANGUAGE_H