summaryrefslogtreecommitdiff
path: root/shell/qa
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@suse.com>2012-10-02 14:13:40 +0100
committerMichael Meeks <michael.meeks@suse.com>2012-10-03 16:56:06 +0100
commitc4008ef54630b560792aa288437db1179ad96095 (patch)
tree53a568a3d143490a341fe546bb08438d59e35ac6 /shell/qa
parent258548ca8116a233e91900709ed7ce7ef1804ecd (diff)
re-base on ALv2 code. Includes:
tkr41: #117828# office crash fixed . (null pointer) + add unit test Patch contributed by Tobias Krause http://svn.apache.org/viewvc?view=revision&revision=1172105 Do not add targets for junit tests when junit is disabled. Patch contributed by Andre Fischer http://svn.apache.org/viewvc?view=revision&revision=1241508 remove the OutDev::GetKernPair* stubs completely Patch contributed by Herbert Duerr http://svn.apache.org/viewvc?view=revision&revision=1179221 reverting un-necessary OS/2 conditionals.
Diffstat (limited to 'shell/qa')
-rw-r--r--shell/qa/i_xml_parser_event_handler.hxx78
-rw-r--r--shell/qa/makefile.mk68
-rw-r--r--shell/qa/recent_docs.cxx222
-rw-r--r--shell/qa/zip/export.map27
-rw-r--r--shell/qa/zip/makefile.mk58
-rw-r--r--shell/qa/zip/simpledocument.odtbin0 -> 16259 bytes
-rw-r--r--shell/qa/zip/testimpl/makefile.mk52
-rw-r--r--shell/qa/zip/testimpl/testzipimpl.cxx72
-rw-r--r--shell/qa/zip/testimpl/testzipimpl.hxx45
-rw-r--r--shell/qa/zip/ziptest.cxx76
10 files changed, 330 insertions, 368 deletions
diff --git a/shell/qa/i_xml_parser_event_handler.hxx b/shell/qa/i_xml_parser_event_handler.hxx
deleted file mode 100644
index 5ff98ff75972..000000000000
--- a/shell/qa/i_xml_parser_event_handler.hxx
+++ /dev/null
@@ -1,78 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _I_XML_PARSER_EVENT_HANDLER_HXX_
-#define _I_XML_PARSER_EVENT_HANDLER_HXX_
-
-#include <string>
-#include <map>
-#include <utility>
-
-#if defined(XML_UNICODE) || defined(XML_UNICODE_WCHAR_T)
- typedef std::wstring string_t;
-#else
- typedef std::string string_t;
-#endif
-
-// name-value container
-typedef std::map<string_t, string_t> xml_tag_attribute_container_t;
-
-
-class i_xml_parser_event_handler
-{
-public:
- virtual ~i_xml_parser_event_handler() {};
-
- virtual void start_document() = 0;
-
- virtual void end_document() = 0;
-
- virtual void start_element(
- const string_t& raw_name,
- const string_t& local_name,
- const xml_tag_attribute_container_t& attributes) = 0;
-
- virtual void end_element(
- const string_t& raw_name,
- const string_t& local_name) = 0;
-
- virtual void characters(
- const string_t& character) = 0;
-
- virtual void ignore_whitespace(
- const string_t& whitespaces) = 0;
-
- virtual void processing_instruction(
- const string_t& target, const string_t& data) = 0;
-
- virtual void comment(const string_t& comment) = 0;
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/shell/qa/makefile.mk b/shell/qa/makefile.mk
deleted file mode 100644
index 1420d3881d09..000000000000
--- a/shell/qa/makefile.mk
+++ /dev/null
@@ -1,68 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-PRJ=..
-
-PRJNAME=shell
-TARGET=qa
-
-ENABLE_EXCEPTIONS=TRUE
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-
-CFLAGSCXX += $(CPPUNIT_CFLAGS)
-
-# BEGIN ----------------------------------------------------------------
-# auto generated Target:testjob by codegen.pl
-
-SHL1OBJS=$(SLO)$/recent_docs.obj $(SLO)$/xml_parser.obj
-SHL1TARGET=recent_docs
-SHL1STDLIBS=$(SALLIB) $(CPPUNITLIB)
-
-.IF "$(GUI)" == "UNX"
-..$/unxsols4.pro$/slb$/libsysshell.a \
-$(EXPATASCII3RDLIB)
-.ENDIF
-
-SHL1IMPLIB= i$(SHL1TARGET)
-SHL1DEF=$(MISC)$/$(SHL1TARGET).def
-DEF1NAME=$(SHL1TARGET)
-DEF1EXPORTFILE= export.exp
-
-# END ------------------------------------------------------------------
-
-
-#------------------------------- All object files -------------------------------
-# do this here, so we get right dependencies
-
-SLOFILES=$(SHL1OBJS)
-
-# --- Targets ------------------------------------------------------
-
-.INCLUDE : target.mk
-
diff --git a/shell/qa/recent_docs.cxx b/shell/qa/recent_docs.cxx
deleted file mode 100644
index b2fa80c0cd16..000000000000
--- a/shell/qa/recent_docs.cxx
+++ /dev/null
@@ -1,222 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-#include <testshl/simpleheader.hxx>
-
-#include "systemshell.hxx"
-#include "osl/file.hxx"
-#include "osl/security.hxx"
-#include "rtl/ustring.hxx"
-
-#include <stdlib.h>
-#include <iostream>
-
-using namespace osl;
-
-using ::rtl::OUString;
-
-namespace syssh = SystemShell;
-
-const OUString SXW_MIME_TYPE("application/vnd.sun.xml.writer");
-const OUString SXC_MIME_TYPE("application/vnd.sun.xml.calc");
-const OUString SXI_MIME_TYPE("application/vnd.sun.xml.impress");
-const OUString SXD_MIME_TYPE("application/vnd.sun.xml.draw");
-const OUString SXM_MIME_TYPE("application/vnd.sun.xml.math");
-
-class Test_AddToRecentDocs : public CppUnit::TestFixture
-{
-public:
-
- Test_AddToRecentDocs()
- {
- }
-
- //------------------------------------------------
- void test_existing_recently_used_file_with_valid_xml()
- {
- system("rm $HOME/.recently-used");
- system("echo '<?xml version=\"1.0\"?>\n<RecentFiles>\n<RecentItem>\n<URI>file:///home/federico/gedit.txt</URI>\n<Mime-Type>text/plain</Mime-Type>\n<Timestamp>1046485966</Timestamp>\n<Groups>\n<Group>gedit</Group>\n</Groups>\n</RecentItem>\n</RecentFiles>' > $HOME/.recently-used");
-
- rtl::OUString url("file:///home_athene/test.sxw");
- syssh::AddToRecentDocumentList(url, SXW_MIME_TYPE);
-
- url = rtl::OUString("file:///home_athene/test.sxc");
- syssh::AddToRecentDocumentList(url, SXC_MIME_TYPE);
-
- url = rtl::OUString("file:///home_athene/test.sxi");
- syssh::AddToRecentDocumentList(url, SXI_MIME_TYPE);
-
- url = rtl::OUString("file:///home_athene/test.sxd");
- syssh::AddToRecentDocumentList(url, SXD_MIME_TYPE);
-
- url = rtl::OUString("file:///home_athene/test.sxm");
- syssh::AddToRecentDocumentList(url, SXM_MIME_TYPE);
- }
-
- //------------------------------------------------
- void test_existing_recently_used_file_with_invalid_xml()
- {
- system("rm $HOME/.recently-used");
- system("echo '<?xml version=\"1.0\"?>\n<RecentFiles>\n<RecentItem>\n<URI>file:///home/federico/gedit.txt</URI>\n<Mime-Type>text/plain</Mime-Type>\n<Timestamp>1046485966</Timestamp>\n<Groups>\n<Group>gedit</Group>\n</Groups>\n<RecentItem>\n<URI>file:///home/federico/gedit2.txt</URI>\n<Mime-Type>text/plain</Mime-Type>\n<Timestamp>1046485966</Timestamp>\n<Groups>\n<Group>gedit</Group>\n</Groups>\n</RecentItem>\n</RecentFiles>' > $HOME/.recently-used");
-
- rtl::OUString url("file:///home_athene/test.sxw");
- syssh::AddToRecentDocumentList(url, SXW_MIME_TYPE);
- }
-
- //------------------------------------------------
- void test_non_existing_recently_used_file()
- {
- int ret = system("rm $HOME/.recently-used");
-
- rtl::OUString url("file:///home_athene/test.sxw");
- syssh::AddToRecentDocumentList(url, SXW_MIME_TYPE);
-
- url = rtl::OUString("file:///home_athene/test.sxc");
- syssh::AddToRecentDocumentList(url, SXC_MIME_TYPE);
-
- url = rtl::OUString("file:///home_athene/test.sxi");
- syssh::AddToRecentDocumentList(url, SXI_MIME_TYPE);
-
- url = rtl::OUString("file:///home_athene/test.sxd");
- syssh::AddToRecentDocumentList(url, SXD_MIME_TYPE);
-
- url = rtl::OUString("file:///home_athene/test.sxm");
- syssh::AddToRecentDocumentList(url, SXM_MIME_TYPE);
-
- ret = system("ls $HOME/.recently-used");
-
- CPPUNIT_ASSERT_MESSAGE(".recently-used doesn't exist", 0 == ret);
- }
-
- //------------------------------------------------
- OUString get_recently_used_url()
- {
- Security sec;
- OUString recently_used_url;
-
- CPPUNIT_ASSERT_MESSAGE("cannot get user home directory", sec.getHomeDir(recently_used_url));
-
- if ((recently_used_url.getLength() > 0) &&
- ('/' != recently_used_url.pData->buffer[recently_used_url.getLength() - 1]))
- recently_used_url += rtl::OUString("/");
-
- recently_used_url += rtl::OUString(".recently-used");
- return recently_used_url;
- }
-
- //------------------------------------------------
- void read_recently_used(void* buffer, size_t size)
- {
- File ruf(get_recently_used_url());
- FileBase::RC rc = ruf.open(osl_File_OpenFlag_Read);
-
- CPPUNIT_ASSERT_MESSAGE("Cannot open ~/.recently-used", FileBase::E_None == rc);
-
- sal_uInt64 read;
- ruf.read(buffer, size, read);
- ruf.close();
- CPPUNIT_ASSERT_MESSAGE("Cannot read .recently-used", (read > 0));
- }
-
- //------------------------------------------------
- void test_existing_recently_used_file_without_xml()
- {
- // remove an existing .recently-used file
- // create a new one with non xml data
- system("rm $HOME/.recently-used");
- system("date > $HOME/.recently-used");
-
- char cnt_before[128];
- memset(cnt_before, 0, sizeof(cnt_before));
- read_recently_used(cnt_before, sizeof(cnt_before));
-
- OUString url("file:///home_athene/test.sxw");
- syssh::AddToRecentDocumentList(url, SXW_MIME_TYPE);
-
- char cnt_after[128];
- memset(cnt_after, 0, sizeof(cnt_after));
- read_recently_used(cnt_after, sizeof(cnt_after));
- CPPUNIT_ASSERT_MESSAGE(".recently-used unexpectly touched", (0 == strcmp(cnt_before, cnt_after)));
- }
-
- //------------------------------------------------
- void test_existing_recently_used_with_unknown_xml()
- {
- system("rm $HOME/.recently-used");
-
- char* xml_unknown = "<?xml version=\"1.0\"?>\n<test>test</test>";
- char cmd[256];
- sprintf(cmd, "echo '%s' > $HOME/.recently-used", xml_unknown);
- system(cmd);
-
- OUString url("file:///home_athene/test.sxw");
- syssh::AddToRecentDocumentList(url, SXW_MIME_TYPE);
-
- char buffer[256];
- memset(buffer, 0, sizeof(buffer));
- read_recently_used(buffer, sizeof(buffer));
-
- CPPUNIT_ASSERT_MESSAGE("Unexpected recently-used content", (0 == strncmp(xml_unknown, buffer, strlen(xml_unknown))));
- }
-
- //------------------------------------------------
- void test_existing_empty_recently_used_file()
- {
- system("rm $HOME/.recently-used");
- system("touch $HOME/.recently-used");
-
- OUString url("file:///home_athene/test.sxw");
- syssh::AddToRecentDocumentList(url, SXW_MIME_TYPE);
-
- char buffer[256];
- memset(buffer, 0, sizeof(buffer));
- read_recently_used(buffer, sizeof(buffer));
-
- char* expected = "<?xml version=\"1.0\"?>\n<RecentFiles>";
- CPPUNIT_ASSERT_MESSAGE("Unexpected recently-used content", (0 == strncmp(buffer, expected, strlen(expected))));
- }
-
- //------------------------------------------------
- CPPUNIT_TEST_SUITE(Test_AddToRecentDocs);
- CPPUNIT_TEST(test_existing_recently_used_file_with_valid_xml);
- CPPUNIT_TEST(test_non_existing_recently_used_file);
- CPPUNIT_TEST(test_existing_recently_used_file_without_xml);
- CPPUNIT_TEST(test_existing_recently_used_with_unknown_xml);
- CPPUNIT_TEST(test_existing_empty_recently_used_file);
- CPPUNIT_TEST(test_existing_recently_used_file_with_invalid_xml);
- CPPUNIT_TEST_SUITE_END();
-};
-
-
-// register test suites
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(Test_AddToRecentDocs, "Test_AddToRecentDocs");
-
-NOADDITIONAL;
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/shell/qa/zip/export.map b/shell/qa/zip/export.map
new file mode 100644
index 000000000000..bfcb0b000f0b
--- /dev/null
+++ b/shell/qa/zip/export.map
@@ -0,0 +1,27 @@
+#
+# 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 .
+#
+
+
+
+UDK_3_0_0 {
+ global:
+ cppunitTestPlugIn;
+
+ local:
+ *;
+};
diff --git a/shell/qa/zip/makefile.mk b/shell/qa/zip/makefile.mk
new file mode 100644
index 000000000000..4039b918bab6
--- /dev/null
+++ b/shell/qa/zip/makefile.mk
@@ -0,0 +1,58 @@
+#
+# 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 .
+#
+
+
+PRJ=../..
+
+PRJNAME=shell
+TARGET=qa_zip
+ENABLE_EXCEPTIONS=TRUE
+#USE_STLP_DEBUG=
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+.IF "$(WITH_CPPUNIT)" != "YES" || "$(GUI)" == "OS2"
+
+@all:
+.IF "$(GUI)" == "OS2"
+ @echo "Skipping, cppunit broken."
+.ELIF "$(WITH_CPPUNIT)" != "YES"
+ @echo "cppunit disabled. nothing do do."
+.END
+
+.ELSE
+
+CFLAGSCXX += $(CPPUNIT_CFLAGS)
+
+SHL1OBJS = $(SLOFILES)
+SHL1RPATH = NONE
+SHL1STDLIBS = $(SALLIB) $(CPPUNITLIB)
+SHL1LIBS = $(SLB)$/..$/lib$/iqa_zipimpl.lib
+SHL1TARGET = $(TARGET)
+SHL1VERSIONMAP = $(PRJ)/qa/zip/export.map
+DEF1NAME=$(SHL1TARGET)
+SLOFILES=$(SLO)$/ziptest.obj
+
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+.INCLUDE: _cppunit.mk
+
diff --git a/shell/qa/zip/simpledocument.odt b/shell/qa/zip/simpledocument.odt
new file mode 100644
index 000000000000..bf83a648b7ed
--- /dev/null
+++ b/shell/qa/zip/simpledocument.odt
Binary files differ
diff --git a/shell/qa/zip/testimpl/makefile.mk b/shell/qa/zip/testimpl/makefile.mk
new file mode 100644
index 000000000000..cf07233b20dd
--- /dev/null
+++ b/shell/qa/zip/testimpl/makefile.mk
@@ -0,0 +1,52 @@
+#
+# 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 .
+#
+
+
+PRJ=../../..
+
+PRJNAME=shell
+TARGET=qa_zipimpl
+LIBTARGET=NO
+ENABLE_EXCEPTIONS=TRUE
+.IF "$(OS)" == "WNT"
+ NO_DEFAULT_STL=TRUE
+ USE_STLP_DEBUG=
+.ENDIF
+USE_DEFFILE=TRUE
+# --- Settings -----------------------------------------------------
+.INCLUDE : settings.mk
+UWINAPILIB =
+
+SHL1IMPLIB = i$(SHL1TARGET)
+SHL1OBJS = $(SLOFILES)
+SHL1RPATH = NONE
+.IF "$(OS)" == "WNT"
+ SHL1STDLIBS = msvcprt.lib
+.ENDIF
+SHL1LIBS = $(SOLARLIBDIR)$/zlib.lib $(SLB)$/zipfile.lib
+SLOFILES=$(SLO)$/testzipimpl.obj
+SHL1TARGET = $(TARGET)
+DEF1NAME=$(SHL1TARGET)
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+.IF "$(OS)" == "WNT"
+ INCLUDE!:=$(subst,/stl, $(INCLUDE))
+ .EXPORT : INCLUDE
+.ENDIF
+
diff --git a/shell/qa/zip/testimpl/testzipimpl.cxx b/shell/qa/zip/testimpl/testzipimpl.cxx
new file mode 100644
index 000000000000..241c4d50d00a
--- /dev/null
+++ b/shell/qa/zip/testimpl/testzipimpl.cxx
@@ -0,0 +1,72 @@
+/* -*- 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 .
+ */
+
+#define DLLIMPLEMENTATION
+#include "testzipimpl.hxx"
+
+vector<string> expectedContents;
+
+TestZipImpl::TestZipImpl(const char * documentName) :
+ zipFile(ZipFile(string(documentName)))
+{
+ expectedContents.push_back("mimetype");
+ expectedContents.push_back("Configurations2/statusbar/");
+ expectedContents.push_back("Configurations2/accelerator/current.xml");
+ expectedContents.push_back("Configurations2/floater/");
+ expectedContents.push_back("Configurations2/popupmenu/");
+ expectedContents.push_back("Configurations2/progressbar/");
+ expectedContents.push_back("Configurations2/toolpanel/");
+ expectedContents.push_back("Configurations2/menubar/");
+ expectedContents.push_back("Configurations2/toolbar/");
+ expectedContents.push_back("Configurations2/images/Bitmaps/");
+ expectedContents.push_back("content.xml");
+ expectedContents.push_back("manifest.rdf");
+ expectedContents.push_back("styles.xml");
+ expectedContents.push_back("meta.xml");
+ expectedContents.push_back("Thumbnails/thumbnail.png");
+ expectedContents.push_back("settings.xml");
+ expectedContents.push_back("META-INF/manifest.xml");
+ sort(expectedContents.begin(), expectedContents.end());
+}
+
+TestZipImpl::~TestZipImpl()
+{
+}
+
+bool TestZipImpl::test_directory()
+{
+ ZipFile::DirectoryPtr_t contents = zipFile.GetDirectory();
+ vector<string> &stringVector = *contents.get();
+ sort(stringVector.begin(), stringVector.end());
+ return expectedContents == expectedContents;
+}
+
+bool TestZipImpl::test_hasContentCaseInSensitive()
+{
+ return zipFile.HasContent("mimetype");
+}
+
+bool TestZipImpl::test_getContent()
+{
+ ZipFile::ZipContentBuffer_t contentBuf;
+ zipFile.GetUncompressedContent("content.xml", contentBuf);
+ return !contentBuf.empty();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/shell/qa/zip/testimpl/testzipimpl.hxx b/shell/qa/zip/testimpl/testzipimpl.hxx
new file mode 100644
index 000000000000..584305cbe27b
--- /dev/null
+++ b/shell/qa/zip/testimpl/testzipimpl.hxx
@@ -0,0 +1,45 @@
+/* -*- 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 "internal/zipfile.hxx"
+#include <string>
+#include <vector>
+#include <algorithm>
+#include "sal/types.h"
+#if defined(DLLIMPLEMENTATION)
+ #define DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+ #define DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
+using namespace std;
+
+class DLLPUBLIC TestZipImpl
+{
+ private:
+ ZipFile zipFile;
+ public:
+ TestZipImpl(const char * documentName);
+ ~TestZipImpl();
+ bool test_directory();
+ bool test_hasContentCaseInSensitive();
+ bool test_getContent();
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/shell/qa/zip/ziptest.cxx b/shell/qa/zip/ziptest.cxx
new file mode 100644
index 000000000000..2a1ff25cdb53
--- /dev/null
+++ b/shell/qa/zip/ziptest.cxx
@@ -0,0 +1,76 @@
+/* -*- 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 "cppunit/TestAssert.h"
+#include "cppunit/TestFixture.h"
+#include "cppunit/extensions/HelperMacros.h"
+#include "cppunit/plugin/TestPlugIn.h"
+#include <string>
+#include "testimpl/testzipimpl.hxx"
+using namespace std;
+
+class Test : public CppUnit::TestFixture
+{
+private:
+ string documentName;
+public:
+ Test();
+ void setUp() {}
+ void tearDown() {}
+ void test_directory();
+ void test_hasContentCaseInSensitive();
+ void test_getContent();
+ CPPUNIT_TEST_SUITE(Test);
+ CPPUNIT_TEST(test_directory);
+ CPPUNIT_TEST(test_hasContentCaseInSensitive);
+ CPPUNIT_TEST(test_getContent);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(Test);
+
+Test::Test() :
+ documentName("simpledocument.odt")
+{
+}
+
+void Test::test_directory()
+{
+ TestZipImpl testImpl(documentName.c_str());
+ bool isPassed = testImpl.test_directory();
+ CPPUNIT_ASSERT_MESSAGE("Content does not match with expected directory names.", isPassed);
+}
+
+void Test::test_hasContentCaseInSensitive()
+{
+ TestZipImpl testImpl(documentName.c_str());
+ bool isPassed = testImpl.test_hasContentCaseInSensitive();
+ CPPUNIT_ASSERT_MESSAGE("Content in zip file was not found.", isPassed);
+}
+
+void Test::test_getContent()
+{
+ TestZipImpl testImpl(documentName.c_str());
+ bool isPassed = testImpl.test_getContent();
+ CPPUNIT_ASSERT_MESSAGE("Couldn't recieve content buffer form zipfile.", isPassed);
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */