incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject svn commit: r1172105 - in /incubator/ooo/trunk/main/shell: prj/ qa/ qa/zip/ qa/zip/testimpl/ source/all/zipfile/
Date Sat, 17 Sep 2011 22:37:36 GMT
Author: mst
Date: Sat Sep 17 22:37:36 2011
New Revision: 1172105

URL: http://svn.apache.org/viewvc?rev=1172105&view=rev
Log:
tkr41: #117828# office crash fixed . (null pointer) + add unit test

# HG changeset patch
# User Tobias Krause <tkr@openoffice.org>
# Date 1303116372 -7200
# Node ID 10c707c39a92a6284158f635b7b69115403d1ed0
# Parent  12fa3ee3d107fb6bbb980de805e20c6c3ca2408a

Added:
    incubator/ooo/trunk/main/shell/qa/zip/
    incubator/ooo/trunk/main/shell/qa/zip/export.map   (contents, props changed)
      - copied, changed from r1172104, incubator/ooo/trunk/main/shell/qa/makefile.mk
    incubator/ooo/trunk/main/shell/qa/zip/makefile.mk   (contents, props changed)
      - copied, changed from r1172104, incubator/ooo/trunk/main/shell/qa/makefile.mk
    incubator/ooo/trunk/main/shell/qa/zip/simpledocument.odt   (with props)
    incubator/ooo/trunk/main/shell/qa/zip/testimpl/
    incubator/ooo/trunk/main/shell/qa/zip/testimpl/makefile.mk   (contents, props changed)
      - copied, changed from r1172104, incubator/ooo/trunk/main/shell/qa/makefile.mk
    incubator/ooo/trunk/main/shell/qa/zip/testimpl/testzipimpl.cxx
    incubator/ooo/trunk/main/shell/qa/zip/testimpl/testzipimpl.hxx
      - copied, changed from r1172104, incubator/ooo/trunk/main/shell/qa/i_xml_parser_event_handler.hxx
    incubator/ooo/trunk/main/shell/qa/zip/ziptest.cxx
Removed:
    incubator/ooo/trunk/main/shell/qa/i_xml_parser_event_handler.hxx
    incubator/ooo/trunk/main/shell/qa/makefile.mk
    incubator/ooo/trunk/main/shell/qa/recent_docs.cxx
Modified:
    incubator/ooo/trunk/main/shell/prj/build.lst
    incubator/ooo/trunk/main/shell/source/all/zipfile/zipfile.cxx

Modified: incubator/ooo/trunk/main/shell/prj/build.lst
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/shell/prj/build.lst?rev=1172105&r1=1172104&r2=1172105&view=diff
==============================================================================
--- incubator/ooo/trunk/main/shell/prj/build.lst (original)
+++ incubator/ooo/trunk/main/shell/prj/build.lst Sat Sep 17 22:37:36 2011
@@ -32,3 +32,5 @@ sl    shell\source\backends\kdebe       
 sl    shell\source\backends\kde4be                 nmake   -   u   sl_backends_kde4be sl_inc
NULL
 sl    shell\source\backends\desktopbe              nmake   -   u   sl_backends_desktopbe
sl_inc NULL
 sl    shell\source\win32\shlxthandler\ooofilt      nmake   -   w   sl_win32_shlxthandler_ooofilt
sl_all_zipfile.w sl_all_ooofilereader.w sl_win32_shlxthandler_util.w sl_all sl_inc NULL
+sl    shell\qa\zip\testimpl						   nmake   -   w   sl_qa_zip_testimpl sl_all_zipfile.w NULL
+sl    shell\qa\zip						           nmake   -   w   sl_qa_zip sl_qa_zip_testimpl.w NULL

Copied: incubator/ooo/trunk/main/shell/qa/zip/export.map (from r1172104, incubator/ooo/trunk/main/shell/qa/makefile.mk)
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/shell/qa/zip/export.map?p2=incubator/ooo/trunk/main/shell/qa/zip/export.map&p1=incubator/ooo/trunk/main/shell/qa/makefile.mk&r1=1172104&r2=1172105&rev=1172105&view=diff
==============================================================================
--- incubator/ooo/trunk/main/shell/qa/makefile.mk (original)
+++ incubator/ooo/trunk/main/shell/qa/zip/export.map Sat Sep 17 22:37:36 2011
@@ -24,45 +24,11 @@
 # 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) $(TESTSHL2LIB)
-
-.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
 
+UDK_3_0_0 {
+    global:
+        cppunitTestPlugIn;
+
+    local:
+        *;
+};

Copied: incubator/ooo/trunk/main/shell/qa/zip/makefile.mk (from r1172104, incubator/ooo/trunk/main/shell/qa/makefile.mk)
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/shell/qa/zip/makefile.mk?p2=incubator/ooo/trunk/main/shell/qa/zip/makefile.mk&p1=incubator/ooo/trunk/main/shell/qa/makefile.mk&r1=1172104&r2=1172105&rev=1172105&view=diff
==============================================================================
--- incubator/ooo/trunk/main/shell/qa/makefile.mk (original)
+++ incubator/ooo/trunk/main/shell/qa/zip/makefile.mk Sat Sep 17 22:37:36 2011
@@ -24,45 +24,29 @@
 # for a copy of the LGPLv3 License.
 #
 #*************************************************************************
-PRJ=..
+PRJ=../..
 
 PRJNAME=shell
-TARGET=qa
-
+TARGET=qa_zip
 ENABLE_EXCEPTIONS=TRUE
-
+#USE_STLP_DEBUG= 
 # --- 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) $(TESTSHL2LIB)
-
-.IF "$(GUI)" == "UNX"
-..$/unxsols4.pro$/slb$/libsysshell.a \
-$(EXPATASCII3RDLIB)
-.ENDIF
-
-SHL1IMPLIB= i$(SHL1TARGET)
-SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+SHL1OBJS = $(SLOFILES)
+SHL1RPATH = NONE
+SHL1STDLIBS = $(SALLIB) $(CPPUNITLIB)  
+SHL1LIBS = $(SLB)$/..$/lib$/iqa_zipimpl.lib
+SHL1TARGET = $(TARGET)
+SHL1VERSIONMAP = $(PRJ)/qa/zip/export.map
 DEF1NAME=$(SHL1TARGET)
-DEF1EXPORTFILE= export.exp
-
-# END ------------------------------------------------------------------
-
-
-#------------------------------- All object files -------------------------------
-# do this here, so we get right dependencies
-
-SLOFILES=$(SHL1OBJS)
+SLOFILES=$(SLO)$/ziptest.obj  
 
 # --- Targets ------------------------------------------------------
 
 .INCLUDE :  target.mk
+.INCLUDE: _cppunit.mk
 

Added: incubator/ooo/trunk/main/shell/qa/zip/simpledocument.odt
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/shell/qa/zip/simpledocument.odt?rev=1172105&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/ooo/trunk/main/shell/qa/zip/simpledocument.odt
------------------------------------------------------------------------------
    svn:mime-type = application/vnd.oasis.opendocument.text

Copied: incubator/ooo/trunk/main/shell/qa/zip/testimpl/makefile.mk (from r1172104, incubator/ooo/trunk/main/shell/qa/makefile.mk)
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/shell/qa/zip/testimpl/makefile.mk?p2=incubator/ooo/trunk/main/shell/qa/zip/testimpl/makefile.mk&p1=incubator/ooo/trunk/main/shell/qa/makefile.mk&r1=1172104&r2=1172105&rev=1172105&view=diff
==============================================================================
--- incubator/ooo/trunk/main/shell/qa/makefile.mk (original)
+++ incubator/ooo/trunk/main/shell/qa/zip/testimpl/makefile.mk Sat Sep 17 22:37:36 2011
@@ -24,45 +24,36 @@
 # for a copy of the LGPLv3 License.
 #
 #*************************************************************************
-PRJ=..
+PRJ=../../..
 
 PRJNAME=shell
-TARGET=qa
-
+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 =
 
-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) $(TESTSHL2LIB)
-
-.IF "$(GUI)" == "UNX"
-..$/unxsols4.pro$/slb$/libsysshell.a \
-$(EXPATASCII3RDLIB)
+SHL1IMPLIB = i$(SHL1TARGET)
+SHL1OBJS = $(SLOFILES)
+SHL1RPATH = NONE
+.IF "$(OS)" == "WNT"
+	SHL1STDLIBS = msvcprt.lib 
 .ENDIF
-
-SHL1IMPLIB= i$(SHL1TARGET)
-SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+SHL1LIBS = $(SOLARLIBDIR)$/zlib.lib $(SLB)$/ooofilereader.lib   
+SLOFILES=$(SLO)$/testzipimpl.obj
+SHL1TARGET = $(TARGET)
 DEF1NAME=$(SHL1TARGET)
-DEF1EXPORTFILE= export.exp
-
-# END ------------------------------------------------------------------
-
-
-#------------------------------- All object files -------------------------------
-# do this here, so we get right dependencies
-
-SLOFILES=$(SHL1OBJS)
-
 # --- Targets ------------------------------------------------------
 
 .INCLUDE :  target.mk
+.IF "$(OS)" == "WNT"
+	INCLUDE!:=$(subst,/stl, $(INCLUDE))
+	.EXPORT : INCLUDE 
+.ENDIF
 

Added: incubator/ooo/trunk/main/shell/qa/zip/testimpl/testzipimpl.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/shell/qa/zip/testimpl/testzipimpl.cxx?rev=1172105&view=auto
==============================================================================
--- incubator/ooo/trunk/main/shell/qa/zip/testimpl/testzipimpl.cxx (added)
+++ incubator/ooo/trunk/main/shell/qa/zip/testimpl/testzipimpl.cxx Sat Sep 17 22:37:36 2011
@@ -0,0 +1,86 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_shell.hxx"
+
+#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();
+}
+

Copied: incubator/ooo/trunk/main/shell/qa/zip/testimpl/testzipimpl.hxx (from r1172104, incubator/ooo/trunk/main/shell/qa/i_xml_parser_event_handler.hxx)
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/shell/qa/zip/testimpl/testzipimpl.hxx?p2=incubator/ooo/trunk/main/shell/qa/zip/testimpl/testzipimpl.hxx&p1=incubator/ooo/trunk/main/shell/qa/i_xml_parser_event_handler.hxx&r1=1172104&r2=1172105&rev=1172105&view=diff
==============================================================================
--- incubator/ooo/trunk/main/shell/qa/i_xml_parser_event_handler.hxx (original)
+++ incubator/ooo/trunk/main/shell/qa/zip/testimpl/testzipimpl.hxx Sat Sep 17 22:37:36 2011
@@ -24,54 +24,31 @@
  * for a copy of the LGPLv3 License.
  *
  ************************************************************************/
- 
-#ifndef _I_XML_PARSER_EVENT_HANDLER_HXX_
-#define _I_XML_PARSER_EVENT_HANDLER_HXX_
 
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_shell.hxx"
+#include "internal/zipfile.hxx"
 #include <string>
-#include <map>
-#include <utility>
-
-#if defined(XML_UNICODE) || defined(XML_UNICODE_WCHAR_T)
-	typedef std::wstring string_t;
+#include <vector>
+#include <algorithm>
+#include "sal/types.h"
+#if defined(DLLIMPLEMENTATION)
+	#define DLLPUBLIC  SAL_DLLPUBLIC_EXPORT
 #else
-	typedef std::string string_t;
+	#define DLLPUBLIC  SAL_DLLPUBLIC_IMPORT
 #endif
 
-// name-value container
-typedef std::map<string_t, string_t> xml_tag_attribute_container_t;
-
+using namespace std;
 
-//#########################################
-class i_xml_parser_event_handler
+class DLLPUBLIC TestZipImpl  
 {
-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;
+		private:
+				ZipFile zipFile;
+		public:
+				TestZipImpl(const char * documentName);
+				~TestZipImpl();
+				bool test_directory();
+				bool test_hasContentCaseInSensitive();
+				bool test_getContent();
 };
 
-#endif
-

Added: incubator/ooo/trunk/main/shell/qa/zip/ziptest.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/shell/qa/zip/ziptest.cxx?rev=1172105&view=auto
==============================================================================
--- incubator/ooo/trunk/main/shell/qa/zip/ziptest.cxx (added)
+++ incubator/ooo/trunk/main/shell/qa/zip/ziptest.cxx Sat Sep 17 22:37:36 2011
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_shell.hxx"
+#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);
+}
+
+//#####################################
+// register test suites
+
+CPPUNIT_PLUGIN_IMPLEMENT(); 
+

Modified: incubator/ooo/trunk/main/shell/source/all/zipfile/zipfile.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/shell/source/all/zipfile/zipfile.cxx?rev=1172105&r1=1172104&r2=1172105&view=diff
==============================================================================
--- incubator/ooo/trunk/main/shell/source/all/zipfile/zipfile.cxx (original)
+++ incubator/ooo/trunk/main/shell/source/all/zipfile/zipfile.cxx Sat Sep 17 22:37:36 2011
@@ -196,8 +196,9 @@ ZipFile::DirectoryPtr_t ZipFile::GetDire
 
 	while (UNZ_OK == rc && UNZ_END_OF_LIST_OF_FILE != rc)
 	{				
+		unz_file_info finfo;
 		unzGetCurrentFileInfo(
-			m_uzFile, 0, szFileName, lmax, 0, 0, 0, 0);
+			m_uzFile, &finfo, szFileName, lmax, 0, 0, 0, 0);
 
 		dir->push_back(szFileName);
 



Mime
View raw message