Commit 7139327b authored by Albert Astals Cid's avatar Albert Astals Cid Committed by Han Young
Browse files

Add autotest running in German

German is interesting because the decimal separator is , and not .

Test currently fails
   Actual   (InputManager::inst()->result()): "4,900000000000002e+16"
   Expected ("70")                          : 70
parent f044b735
......@@ -8,3 +8,12 @@ ecm_add_test(inputmanagertest.cpp
TEST_NAME "inputmanagertest"
LINK_LIBRARIES Qt5::Test knumber kalklib
)
ecm_add_test(inputmanagertest.cpp
TEST_NAME "inputmanagertest_de"
LINK_LIBRARIES Qt5::Test knumber kalklib
)
target_compile_definitions(inputmanagertest PUBLIC LANG="C")
target_compile_definitions(inputmanagertest_de PUBLIC LANG="de_DE.utf8")
......@@ -18,7 +18,7 @@ private slots:
#ifndef Q_OS_WIN
void initLocale()
{
setenv("LC_ALL", "C", 1);
setenv("LC_ALL", LANG, 1);
}
Q_CONSTRUCTOR_FUNCTION(initLocale)
......@@ -26,6 +26,12 @@ Q_CONSTRUCTOR_FUNCTION(initLocale)
void InputManagerTest::init()
{
if (QString(LANG) != "C") {
if (QLocale().language() != QLocale::German) {
qWarning() << "Please enable the" << LANG << "locale on your system";
exit(0);
}
}
InputManager::inst()->clear();
}
......@@ -70,7 +76,11 @@ void InputManagerTest::testNonIntegerDivision()
InputManager::inst()->append("70");
InputManager::inst()->append("÷");
InputManager::inst()->append("9");
QVERIFY(InputManager::inst()->result().startsWith("7.77777"));
if (QString(LANG) == "C") {
QVERIFY(InputManager::inst()->result().startsWith("7.77777"));
} else {
QVERIFY(InputManager::inst()->result().startsWith("7,77777"));
}
InputManager::inst()->equal();
InputManager::inst()->append("*");
InputManager::inst()->append("9");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment