Commit 5bea8d72 authored by Laurent Montel's avatar Laurent Montel 😁

improve autocorrect too

parent 802c5f54
......@@ -832,6 +832,8 @@ int AutoCorrection::advancedAutocorrect()
// (Necessary to make sure the first letters match???)
if (actualWord.at(0).isUpper() && replacement.at(0).isLower()) {
replacement[0] = replacement[0].toUpper();
} else if (actualWord.at(0).isLower() && replacement.at(0).isUpper()) {
replacement[0] = replacement[0].toLower();
}
// If a punctuation mark was on the end originally, add it back on
......
......@@ -467,11 +467,25 @@ void AutoCorrectionTest::shouldAutocorrectMultiWord_data()
map.insert(QStringLiteral("boo"), QStringLiteral("Bla"));
QTest::newRow("withuppercase-3") << QStringLiteral("Boo") << QStringLiteral("Bla") << map;
map.clear();
map.insert(QStringLiteral("boo"), QStringLiteral("Bla"));
QTest::newRow("withuppercase-4") << QStringLiteral("boo") << QStringLiteral("bla") << map;
map.clear();
map.insert(QStringLiteral("booooo"), QStringLiteral("bla"));
QTest::newRow("nofindtext") << QStringLiteral("boo") << QStringLiteral("boo") << map;
map.clear();
map.insert(QStringLiteral("boosss"), QStringLiteral("Blasss"));
map.insert(QStringLiteral("boo"), QStringLiteral("bla"));
QTest::newRow("withponct") << QStringLiteral("boo!") << QStringLiteral("bla!") << map;
map.clear();
map.insert(QStringLiteral("boosss"), QStringLiteral("Blasss"));
map.insert(QStringLiteral("boo"), QStringLiteral("bla"));
QTest::newRow("withponct-2") << QStringLiteral("lolo. boo!") << QStringLiteral("lolo. bla!") << map;
}
void AutoCorrectionTest::shouldAutocorrectMultiWord()
......
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