diff --git a/po/POTFILES.src.in b/po/POTFILES.src.in index 434ebd1ae9b7694b025d9ab0a83320d189310f7f..113cc10a94d30a84a443c07f2688b9c15a0de291 100644 --- a/po/POTFILES.src.in +++ b/po/POTFILES.src.in @@ -91,6 +91,7 @@ ../src/extension/internal/pdfinput/pdf-input.cpp ../src/extension/internal/pov-out.cpp ../src/extension/internal/svg.cpp +../src/extension/internal/svg.h ../src/extension/internal/svgz.cpp ../src/extension/internal/vsd-input.cpp ../src/extension/internal/wmf-inout.cpp diff --git a/src/extension/internal/svg.cpp b/src/extension/internal/svg.cpp index 0a69887928f3982899bb078c747531a98104951c..caa090bb88e7c1281737bb0adcac88896f2e5737 100644 --- a/src/extension/internal/svg.cpp +++ b/src/extension/internal/svg.cpp @@ -727,19 +727,7 @@ Svg::init() "\n" "" N_("SVG Input") "\n" "" SP_MODULE_KEY_INPUT_SVG "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "96.00\n" - "\n" - "\n" - "\n" - "\n" - "\n" - - "false\n" + SVG_COMMON_INPUT_PARAMS "\n" ".svg\n" "image/svg+xml\n" diff --git a/src/extension/internal/svg.h b/src/extension/internal/svg.h index 1eb4f51e8d6cec66da1b0762c95efdace4c03408..a7adba43ba25071712164cf046eae50c2d10773d 100644 --- a/src/extension/internal/svg.h +++ b/src/extension/internal/svg.h @@ -18,6 +18,21 @@ #include "../implementation/implementation.h" +#define SVG_COMMON_INPUT_PARAMS \ + "\n" \ + "\n" \ + "\n" \ + "\n" \ + "\n" \ + "96.00\n" \ + "\n" \ + "\n" \ + "\n" \ + "\n" \ + "\n" \ + "false\n" + + namespace Inkscape { namespace Extension { namespace Internal { diff --git a/src/extension/internal/svgz.cpp b/src/extension/internal/svgz.cpp index 18b6e5b026fe11863bc40b208542880da3587866..ea00f943b1b93582b9bb0cb06c7e46cd862efed8 100644 --- a/src/extension/internal/svgz.cpp +++ b/src/extension/internal/svgz.cpp @@ -44,6 +44,7 @@ Svgz::init() "" N_("SVGZ Input") "\n" "" SP_MODULE_KEY_INPUT_SVGZ "\n" "" SP_MODULE_KEY_INPUT_SVG "\n" + SVG_COMMON_INPUT_PARAMS "\n" ".svgz\n" "image/svg+xml-compressed\n" diff --git a/testfiles/CMakeLists.txt b/testfiles/CMakeLists.txt index 646505e083f6a7c45937267f24774ed043c00720..8a6825709e25d7a4d3dc0d49c9104eb90c47512f 100644 --- a/testfiles/CMakeLists.txt +++ b/testfiles/CMakeLists.txt @@ -15,6 +15,7 @@ include_directories("${CMAKE_SOURCE_DIR}/src/3rdparty/adaptagrams") set(TEST_SOURCES uri-test + drag-and-drop-svgz extract-uri-test attributes-test color-profile-test diff --git a/testfiles/src/drag-and-drop-svgz.cpp b/testfiles/src/drag-and-drop-svgz.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5ea7c0b0aaac86efbe59221474f6f479ccb3a818 --- /dev/null +++ b/testfiles/src/drag-and-drop-svgz.cpp @@ -0,0 +1,62 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/** + * @file + * Test that svgz (= compressed SVG) import/drag-and-drop + * is working: https://gitlab.com/inkscape/inkscape/issues/906 . + * + */ +/* + * Authors: + * Shlomi Fish + * + * Copyright (C) 2020 Authors + */ + +#include "doc-per-case-test.h" +#include + +#include "extension/db.h" +#include "extension/find_extension_by_mime.h" +#include "extension/internal/svgz.h" +#include "path-prefix.h" +#include "preferences.h" + +#include "gtest/gtest.h" + + +class SvgzImportTest : public DocPerCaseTest { + public: + SvgzImportTest() {} + void TestBody() + { + ASSERT_TRUE(_doc != nullptr); + ASSERT_TRUE(_doc->getRoot() != nullptr); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->setBool("/dialogs/import/ask_svg", true); + prefs->setBool("/options/onimport", true); + auto ext = Inkscape::Extension::find_by_mime("image/svg+xml-compressed"); + ext->set_gui(true); + auto fn = Glib::build_filename(INKSCAPE_EXAMPLESDIR, "tiger.svgz"); + auto imod = dynamic_cast(ext); + auto svg_mod = (new Inkscape::Extension::Internal::Svg); + ASSERT_TRUE(svg_mod->open(imod, fn.c_str()) != nullptr); + } + ~SvgzImportTest() override {} +}; + +TEST_F(SvgzImportTest, Eq) +{ + SvgzImportTest foo; + foo.TestBody(); +} + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :