summaryrefslogtreecommitdiff
path: root/vcl/qa
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.com>2014-05-15 16:17:54 +0200
committerTomaž Vajngerl <tomaz.vajngerl@collabora.com>2014-05-15 19:51:08 +0200
commitf9e81786f43a91f8cb562552ea0b379ea73ba08a (patch)
tree07e74cfee5293fdca69522529ccb9ba7903070e9 /vcl/qa
parentfb688d64466b56ad7804c8ecf66aecae7f1faafa (diff)
wmf: test that non-placeable WMF uses correct sizes
Change-Id: I546d654726483b40ce4d981bc66377c8a3df6194
Diffstat (limited to 'vcl/qa')
-rw-r--r--vcl/qa/cppunit/wmf/data/visio_import_source.wmfbin0 -> 13801 bytes
-rw-r--r--vcl/qa/cppunit/wmf/wmfimporttest.cxx84
2 files changed, 84 insertions, 0 deletions
diff --git a/vcl/qa/cppunit/wmf/data/visio_import_source.wmf b/vcl/qa/cppunit/wmf/data/visio_import_source.wmf
new file mode 100644
index 000000000000..88deac9d248d
--- /dev/null
+++ b/vcl/qa/cppunit/wmf/data/visio_import_source.wmf
Binary files differ
diff --git a/vcl/qa/cppunit/wmf/wmfimporttest.cxx b/vcl/qa/cppunit/wmf/wmfimporttest.cxx
new file mode 100644
index 000000000000..e75f5a123714
--- /dev/null
+++ b/vcl/qa/cppunit/wmf/wmfimporttest.cxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <test/bootstrapfixture.hxx>
+#include <test/xmltesttools.hxx>
+#include <test/mtfxmldump.hxx>
+#include <vcl/wmf.hxx>
+#include <vcl/metaact.hxx>
+
+using namespace css;
+
+class WmfTest : public test::BootstrapFixture, public XmlTestTools
+{
+public:
+ WmfTest() :
+ BootstrapFixture(true, false)
+ {}
+
+ void runTest();
+ void testNonPlaceableWmf();
+
+ CPPUNIT_TEST_SUITE(WmfTest);
+ CPPUNIT_TEST(testNonPlaceableWmf);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+void WmfTest::testNonPlaceableWmf()
+{
+ OUString aUrl = getURLFromSrc("/vcl/qa/cppunit/wmf/data/");
+
+ SvFileStream aFileStream(aUrl + "visio_import_source.wmf", STREAM_READ);
+ GDIMetaFile aGDIMetaFile;
+ ReadWindowMetafile(aFileStream, aGDIMetaFile);
+
+ boost::scoped_ptr<SvMemoryStream> aStream(new SvMemoryStream);
+
+ MetafileXmlDump dumper(*aStream);
+ dumper.filterAllActionTypes();
+ dumper.filterActionType(META_POLYLINE_ACTION, false);
+ dumper.dump(aGDIMetaFile);
+
+ aStream->Seek(STREAM_SEEK_TO_BEGIN);
+
+ xmlDocPtr pDoc = parseXmlStream(aStream.get());
+
+ CPPUNIT_ASSERT (pDoc);
+
+ assertXPath(pDoc, "/metafile/polyline[1]/point[1]", "x", "16798");
+ assertXPath(pDoc, "/metafile/polyline[1]/point[1]", "y", "1003");
+
+ assertXPath(pDoc, "/metafile/polyline[1]/point[2]", "x", "16798");
+ assertXPath(pDoc, "/metafile/polyline[1]/point[2]", "y", "7507");
+
+ assertXPath(pDoc, "/metafile/polyline[1]/point[3]", "x", "26090");
+ assertXPath(pDoc, "/metafile/polyline[1]/point[3]", "y", "7507");
+
+ assertXPath(pDoc, "/metafile/polyline[1]/point[4]", "x", "26090");
+ assertXPath(pDoc, "/metafile/polyline[1]/point[4]", "y", "1003");
+
+ assertXPath(pDoc, "/metafile/polyline[1]/point[5]", "x", "16798");
+ assertXPath(pDoc, "/metafile/polyline[1]/point[5]", "y", "1003");
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(WmfTest);
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */