[Libreoffice-commits] online.git: test/httpwstest.cpp test/Makefile.am test/UnitTiffLoad.cpp

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Fri Sep 13 06:15:04 UTC 2019


 test/Makefile.am      |    4 +++
 test/UnitTiffLoad.cpp |   64 ++++++++++++++++++++++++++++++++++++++++++++++++++
 test/httpwstest.cpp   |   19 --------------
 3 files changed, 68 insertions(+), 19 deletions(-)

New commits:
commit 08f5d74f6373f3a2ad7bd3315c8526a381633285
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Thu Sep 12 23:10:04 2019 +0200
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Thu Sep 12 23:10:04 2019 +0200

    Convert TIFF load testcase to a new-style one
    
    This was originally added in commit
    c2c7982e5e49bb698342df1f9eaf7a2e50fd43eb (Add TIFF load testcase,
    2019-07-04), and still fails without the core.git fix.
    
    Change-Id: I798b82ea8212dfeafc162e4b73f6fff707ac3de2

diff --git a/test/Makefile.am b/test/Makefile.am
index d5dc5792f..9d1bd5aa3 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -21,6 +21,7 @@ noinst_LTLIBRARIES = \
 	unit-wopi.la unit-wopi-saveas.la \
 	unit-wopi-ownertermination.la unit-wopi-versionrestore.la \
 	unit-wopi-documentconflict.la unit_wopi_renamefile.la \
+	unit-tiff-load.la \
 	unit-wopi-loadencoded.la unit-wopi-temp.la
 
 MAGIC_TO_FORCE_SHLIB_CREATION = -rpath /dummy
@@ -119,6 +120,8 @@ unit_wopi_loadencoded_la_SOURCES = UnitWOPILoadEncoded.cpp
 unit_wopi_loadencoded_la_LIBADD = $(CPPUNIT_LIBS)
 unit_wopi_temp_la_SOURCES = UnitWOPITemplate.cpp
 unit_wopi_temp_la_LIBADD = $(CPPUNIT_LIBS)
+unit_tiff_load_la_SOURCES = UnitTiffLoad.cpp
+unit_tiff_load_la_LIBADD = $(CPPUNIT_LIBS)
 
 if HAVE_LO_PATH
 SYSTEM_STAMP = @SYSTEMPLATE_PATH@/system_stamp
@@ -138,6 +141,7 @@ TESTS = unit-copy-paste.la unit-typing.la unit-convert.la unit-prefork.la unit-t
         unit-wopi-ownertermination.la unit-wopi-versionrestore.la \
         unit-wopi-documentconflict.la unit_wopi_renamefile.la \
 	unit-http.la \
+	unit-tiff-load.la \
 	unit-wopi-loadencoded.la unit-wopi-temp.la
 # TESTS = unit-client.la
 # TESTS += unit-admin.la
diff --git a/test/UnitTiffLoad.cpp b/test/UnitTiffLoad.cpp
new file mode 100644
index 000000000..ea39a09fa
--- /dev/null
+++ b/test/UnitTiffLoad.cpp
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <config.h>
+
+#include <Unit.hpp>
+#include <UnitHTTP.hpp>
+#include <helpers.hpp>
+#include <wsd/LOOLWSD.hpp>
+
+#include <test.hpp>
+
+/// TIFF load testcase.
+class UnitTiffLoad : public UnitWSD
+{
+public:
+    UnitTiffLoad();
+
+    void invokeTest() override;
+
+    void configure(Poco::Util::LayeredConfiguration& config) override;
+};
+
+UnitTiffLoad::UnitTiffLoad() {}
+
+void UnitTiffLoad::invokeTest()
+{
+    const char testname[] = "UnitTiffLoad";
+
+    // Load a document which has a TIFF image in it.
+    std::string documentPath;
+    std::string documentURL;
+    helpers::getDocumentPathAndURL("tiff.odt", documentPath, documentURL, testname);
+    std::shared_ptr<LOOLWebSocket> socket = helpers::loadDocAndGetSocket(
+        Poco::URI(helpers::getTestServerURI()), documentURL, testname);
+
+    // Select the image.
+    helpers::sendTextFrame(socket, "uno .uno:JumpToNextFrame", testname);
+    helpers::sendTextFrame(socket, "rendershapeselection mimetype=image/svg+xml", testname);
+
+    // Make sure we can get an SVG representation of the image; this failed as the TIFF import was
+    // broken.
+    const std::string content
+        = helpers::assertResponseString(socket, "shapeselectioncontent:", testname);
+    CPPUNIT_ASSERT(Util::startsWith(content, "shapeselectioncontent:\n"));
+
+    exitTest(TestResult::Ok);
+}
+
+void UnitTiffLoad::configure(Poco::Util::LayeredConfiguration& config)
+{
+    UnitWSD::configure(config);
+    config.setBool("ssl.enable", true);
+}
+
+UnitBase* unit_create_wsd(void) { return new UnitTiffLoad(); }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/test/httpwstest.cpp b/test/httpwstest.cpp
index 33ae52b91..08a06edfb 100644
--- a/test/httpwstest.cpp
+++ b/test/httpwstest.cpp
@@ -102,7 +102,6 @@ class HTTPWSTest : public CPPUNIT_NS::TestFixture
     CPPUNIT_TEST(testReloadWhileDisconnecting);
     CPPUNIT_TEST(testExcelLoad);
     CPPUNIT_TEST(testPaste);
-    CPPUNIT_TEST(testTiff);
     CPPUNIT_TEST(testPasteBlank);
     CPPUNIT_TEST(testLargePaste);
     CPPUNIT_TEST(testRenderingOptions);
@@ -163,7 +162,6 @@ class HTTPWSTest : public CPPUNIT_NS::TestFixture
     void testReloadWhileDisconnecting();
     void testExcelLoad();
     void testPaste();
-    void testTiff();
     void testPasteBlank();
     void testLargePaste();
     void testRenderingOptions();
@@ -924,23 +922,6 @@ void HTTPWSTest::testPaste()
     }
 }
 
-void HTTPWSTest::testTiff()
-{
-    const char* testname = "tiff ";
-
-    // Load a document which has a TIFF image in it.
-    std::shared_ptr<LOOLWebSocket> socket = loadDocAndGetSocket("tiff.odt", _uri, testname);
-
-    // Select the image.
-    sendTextFrame(socket, "uno .uno:JumpToNextFrame", testname);
-    sendTextFrame(socket, "rendershapeselection mimetype=image/svg+xml", testname);
-
-    // Make sure we can get an SVG representation of the image; this failed as the TIFF import was
-    // broken.
-    const std::string content = assertResponseString(socket, "shapeselectioncontent:", testname);
-    CPPUNIT_ASSERT(Util::startsWith(content, "shapeselectioncontent:\n"));
-}
-
 void HTTPWSTest::testPasteBlank()
 {
     const char* testname = "pasteBlank ";


More information about the Libreoffice-commits mailing list