tdf#122191: sc_subsequent_export-test2: Add unittest

Change-Id: Ib71b76766f1f20d73226c6551348c623077c06a3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118611
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
diff --git a/sc/qa/unit/data/xlsx/tdf122191.xlsx b/sc/qa/unit/data/xlsx/tdf122191.xlsx
new file mode 100644
index 0000000..023fa84
--- /dev/null
+++ b/sc/qa/unit/data/xlsx/tdf122191.xlsx
Binary files differ
diff --git a/sc/qa/unit/subsequent_export-test2.cxx b/sc/qa/unit/subsequent_export-test2.cxx
index 74e7957..e222c20 100644
--- a/sc/qa/unit/subsequent_export-test2.cxx
+++ b/sc/qa/unit/subsequent_export-test2.cxx
@@ -146,6 +146,7 @@ public:
    void testTdf91634XLSX();
    void testTdf115159();
    void testTdf112567();
    void testTdf122191();
    void testTdf112567b();
    void testTdf123645XLSX();
    void testTdf125173XLSX();
@@ -245,6 +246,7 @@ public:
    CPPUNIT_TEST(testTdf91634XLSX);
    CPPUNIT_TEST(testTdf115159);
    CPPUNIT_TEST(testTdf112567);
    CPPUNIT_TEST(testTdf122191);
    CPPUNIT_TEST(testTdf112567b);
    CPPUNIT_TEST(testTdf123645XLSX);
    CPPUNIT_TEST(testTdf125173XLSX);
@@ -1341,6 +1343,37 @@ void ScExportTest2::testTdf112567()
    xDocSh->DoClose();
}

void ScExportTest2::testTdf122191()
{
    // Set the system locale to Hungarian
    SvtSysLocaleOptions aOptions;
    OUString sLocaleConfigString = aOptions.GetLanguageTag().getBcp47();
    aOptions.SetLocaleConfigString("hu-HU");
    aOptions.Commit();
    comphelper::ScopeGuard g([&aOptions, &sLocaleConfigString] {
        aOptions.SetLocaleConfigString(sLocaleConfigString);
        aOptions.Commit();
    });

    ScDocShellRef xShell = loadDoc(u"tdf122191.", FORMAT_XLSX);
    CPPUNIT_ASSERT(xShell.is());

    ScDocument& rDoc = xShell->GetDocument();
    CPPUNIT_ASSERT_EQUAL(OUString("IGAZ"), rDoc.GetString(0, 0, 0));

    ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_XLSX);
    CPPUNIT_ASSERT(xDocSh.is());
    xShell->DoClose();

    ScDocument& rDoc2 = xDocSh->GetDocument();
    // Without the fix in place, this test would have failed with
    // - Expected: IGAZ
    // - Actual  : BOOL00AN
    CPPUNIT_ASSERT_EQUAL(OUString("IGAZ"), rDoc2.GetString(0, 0, 0));

    xDocSh->DoClose();
}

void ScExportTest2::testTdf112567b()
{
    // Set the system locale to Hungarian (a language with different range separator)