filter/qa/unit/textfilterdetect.cxx |   56 +++++++++++++++++++++++++++---------
 1 file changed, 42 insertions(+), 14 deletions(-)

New commits:
commit fbf025b4903bfcb93c3d4bbf1ebbf860cf11618d
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Sat Dec 2 19:51:57 2023 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Sat Dec 2 21:55:03 2023 +0100

    Make testHybridPDFFile Windows-only, and filenames in repo ASCII-only.
    
    See 
https://lists.freedesktop.org/archives/libreoffice/2023-December/091265.html
    for details.
    
    Change-Id: I73f4a48c9b71adc42354f099dcc98aff56e3fc43
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160246
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git 
"a/filter/qa/unit/data/hybrid_calc_\320\260\320\261\320\262_\316\261\316\262\316\263.pdf"
 b/filter/qa/unit/data/hybrid_calc.pdf
similarity index 100%
rename from 
"filter/qa/unit/data/hybrid_calc_\320\260\320\261\320\262_\316\261\316\262\316\263.pdf"
rename to filter/qa/unit/data/hybrid_calc.pdf
diff --git 
"a/filter/qa/unit/data/hybrid_impress_\320\260\320\261\320\262_\316\261\316\262\316\263.pdf"
 b/filter/qa/unit/data/hybrid_impress.pdf
similarity index 100%
rename from 
"filter/qa/unit/data/hybrid_impress_\320\260\320\261\320\262_\316\261\316\262\316\263.pdf"
rename to filter/qa/unit/data/hybrid_impress.pdf
diff --git 
"a/filter/qa/unit/data/hybrid_writer_\320\260\320\261\320\262_\316\261\316\262\316\263.pdf"
 b/filter/qa/unit/data/hybrid_writer.pdf
similarity index 100%
rename from 
"filter/qa/unit/data/hybrid_writer_\320\260\320\261\320\262_\316\261\316\262\316\263.pdf"
rename to filter/qa/unit/data/hybrid_writer.pdf
diff --git a/filter/qa/unit/textfilterdetect.cxx 
b/filter/qa/unit/textfilterdetect.cxx
index c88de0e8790d..c39708668965 100644
--- a/filter/qa/unit/textfilterdetect.cxx
+++ b/filter/qa/unit/textfilterdetect.cxx
@@ -19,6 +19,7 @@
 #include <comphelper/configuration.hxx>
 #include <comphelper/propertyvalue.hxx>
 #include <officecfg/Office/Common.hxx>
+#include <osl/file.hxx>
 #include <sfx2/docfac.hxx>
 #include <unotools/mediadescriptor.hxx>
 #include <unotools/streamwrap.hxx>
@@ -176,6 +177,10 @@ CPPUNIT_TEST_FIXTURE(TextFilterDetectTest, testEmptyFile)
     }
 }
 
+// The unit test fails on some Linux systems. Until it is found out why the 
file URLs are broken
+// there, let it be Windows-only, since the original issue tested here was 
Windows-specific.
+// See 
https://lists.freedesktop.org/archives/libreoffice/2023-December/091265.html 
for details.
+#ifdef _WIN32
 CPPUNIT_TEST_FIXTURE(TextFilterDetectTest, testHybridPDFFile)
 {
     // Make sure that file locking is ON
@@ -188,23 +193,46 @@ CPPUNIT_TEST_FIXTURE(TextFilterDetectTest, 
testHybridPDFFile)
 
     // Given a hybrid PDF file
 
-    // Created in Writer
-    loadFromURL(u"hybrid_writer_абв_αβγ.pdf");
-    // Make sure it opens in Writer.
-    // Without the accompanying fix in place, this test would have failed on 
Windows, as it was
-    // opened in Draw instead.
-    CPPUNIT_ASSERT(supportsService(mxComponent, 
"com.sun.star.text.TextDocument"));
+    {
+        // Created in Writer
+        utl::TempFileNamed nonAsciiName(u"абв_αβγ_");
+        nonAsciiName.EnableKillingFile();
+        CPPUNIT_ASSERT_EQUAL(
+            osl::FileBase::E_None,
+            osl::File::copy(createFileURL(u"hybrid_writer.pdf"), 
nonAsciiName.GetURL()));
+        load(nonAsciiName.GetURL());
+        // Make sure it opens in Writer.
+        // Without the accompanying fix in place, this test would have failed 
on Windows, as it was
+        // opened in Draw instead.
+        CPPUNIT_ASSERT(supportsService(mxComponent, 
"com.sun.star.text.TextDocument"));
+    }
 
-    // Created in Calc
-    loadFromURL(u"hybrid_calc_абв_αβγ.pdf");
-    // Make sure it opens in Calc.
-    CPPUNIT_ASSERT(supportsService(mxComponent, 
"com.sun.star.sheet.SpreadsheetDocument"));
+    {
+        // Created in Calc
+        utl::TempFileNamed nonAsciiName(u"абв_αβγ_");
+        nonAsciiName.EnableKillingFile();
+        CPPUNIT_ASSERT_EQUAL(
+            osl::FileBase::E_None,
+            osl::File::copy(createFileURL(u"hybrid_calc.pdf"), 
nonAsciiName.GetURL()));
+        load(nonAsciiName.GetURL());
+        // Make sure it opens in Calc.
+        CPPUNIT_ASSERT(supportsService(mxComponent, 
"com.sun.star.sheet.SpreadsheetDocument"));
+    }
 
-    // Created in Impress
-    loadFromURL(u"hybrid_impress_абв_αβγ.pdf");
-    // Make sure it opens in Impress.
-    CPPUNIT_ASSERT(supportsService(mxComponent, 
"com.sun.star.presentation.PresentationDocument"));
+    {
+        // Created in Impress
+        utl::TempFileNamed nonAsciiName(u"абв_αβγ_");
+        nonAsciiName.EnableKillingFile();
+        CPPUNIT_ASSERT_EQUAL(
+            osl::FileBase::E_None,
+            osl::File::copy(createFileURL(u"hybrid_impress.pdf"), 
nonAsciiName.GetURL()));
+        load(nonAsciiName.GetURL());
+        // Make sure it opens in Impress.
+        CPPUNIT_ASSERT(
+            supportsService(mxComponent, 
"com.sun.star.presentation.PresentationDocument"));
+    }
 }
+#endif // _WIN32
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();

Reply via email to