[libcalamares] Explicit tests for Interlingue

- The language code "ie" is not recognized,
- "ia" is, and it seems to be the post-war variant of
  Interlingue, so we may want to rename / relabel.

The testEsperanto test -- now split into scripts and
esperanto -- would have picked "ie" out of the list
because it does map to C locale.
This commit is contained in:
Adriaan de Groot 2020-08-04 13:21:08 +02:00
parent b27bc11975
commit 3f1b31e352

View File

@ -38,10 +38,13 @@ private Q_SLOTS:
void initTestCase(); void initTestCase();
void testLanguageModelCount(); void testLanguageModelCount();
void testEsperanto();
void testTranslatableLanguages(); void testTranslatableLanguages();
void testTranslatableConfig1(); void testTranslatableConfig1();
void testTranslatableConfig2(); void testTranslatableConfig2();
void testLanguageScripts();
void testEsperanto();
void testInterlingue();
// TimeZone testing // TimeZone testing
void testSimpleZones(); void testSimpleZones();
@ -55,6 +58,8 @@ LocaleTests::~LocaleTests() {}
void void
LocaleTests::initTestCase() LocaleTests::initTestCase()
{ {
Logger::setupLogLevel( Logger::LOGDEBUG );
// Otherwise plain get() is dubious in the TranslatableConfiguration tests // Otherwise plain get() is dubious in the TranslatableConfiguration tests
QLocale::setDefault( QLocale( QStringLiteral( "en_US" ) ) ); QLocale::setDefault( QLocale( QStringLiteral( "en_US" ) ) );
QVERIFY( ( QLocale().name() == "C" ) || ( QLocale().name() == "en_US" ) ); QVERIFY( ( QLocale().name() == "C" ) || ( QLocale().name() == "en_US" ) );
@ -80,10 +85,8 @@ LocaleTests::testLanguageModelCount()
} }
void void
LocaleTests::testEsperanto() LocaleTests::testLanguageScripts()
{ {
Logger::setupLogLevel( Logger::LOGDEBUG );
const auto* m = CalamaresUtils::Locale::availableTranslations(); const auto* m = CalamaresUtils::Locale::availableTranslations();
QVERIFY( m ); QVERIFY( m );
@ -104,13 +107,33 @@ LocaleTests::testEsperanto()
QVERIFY( locale.language() == QLocale::Lithuanian ? locale.country() == QLocale::Lithuania : true ); QVERIFY( locale.language() == QLocale::Lithuanian ? locale.country() == QLocale::Lithuania : true );
QVERIFY( locale.language() != QLocale::C ); QVERIFY( locale.language() != QLocale::C );
} }
}
void
LocaleTests::testEsperanto()
{
#if QT_VERSION < QT_VERSION_CHECK( 5, 12, 2 ) #if QT_VERSION < QT_VERSION_CHECK( 5, 12, 2 )
QCOMPARE( QLocale( "eo" ).language(), QLocale::C ); QCOMPARE( QLocale( "eo" ).language(), QLocale::C );
#else #else
QCOMPARE( QLocale( "eo" ).language(), QLocale::Esperanto ); QCOMPARE( QLocale( "eo" ).language(), QLocale::Esperanto );
#endif #endif
QCOMPARE( QLocale( QLocale::Esperanto ).language(), QLocale::Esperanto ); // Probably fails on 5.12, too
} }
void
LocaleTests::testInterlingue()
{
// ie / Interlingue is borked (is "ie" even the right name?)
QCOMPARE( QLocale( "ie" ).language(), QLocale::C );
QCOMPARE( QLocale( QLocale::Interlingue ).language(), QLocale::English );
// "ia" exists (post-war variant of Interlingue)
QCOMPARE( QLocale( "ia" ).language(), QLocale::Interlingua );
// "bork" does not exist
QCOMPARE( QLocale( "bork" ).language(), QLocale::C );
}
static const QStringList& static const QStringList&
someLanguages() someLanguages()
{ {