1*5448f169SMichael Stahl /************************************************************************* 2*5448f169SMichael Stahl * 3*5448f169SMichael Stahl * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*5448f169SMichael Stahl * 5*5448f169SMichael Stahl * Copyright 2000, 2010 Oracle and/or its affiliates. 6*5448f169SMichael Stahl * 7*5448f169SMichael Stahl * OpenOffice.org - a multi-platform office productivity suite 8*5448f169SMichael Stahl * 9*5448f169SMichael Stahl * This file is part of OpenOffice.org. 10*5448f169SMichael Stahl * 11*5448f169SMichael Stahl * OpenOffice.org is free software: you can redistribute it and/or modify 12*5448f169SMichael Stahl * it under the terms of the GNU Lesser General Public License version 3 13*5448f169SMichael Stahl * only, as published by the Free Software Foundation. 14*5448f169SMichael Stahl * 15*5448f169SMichael Stahl * OpenOffice.org is distributed in the hope that it will be useful, 16*5448f169SMichael Stahl * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*5448f169SMichael Stahl * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*5448f169SMichael Stahl * GNU Lesser General Public License version 3 for more details 19*5448f169SMichael Stahl * (a copy is included in the LICENSE file that accompanied this code). 20*5448f169SMichael Stahl * 21*5448f169SMichael Stahl * You should have received a copy of the GNU Lesser General Public License 22*5448f169SMichael Stahl * version 3 along with OpenOffice.org. If not, see 23*5448f169SMichael Stahl * <http://www.openoffice.org/license.html> 24*5448f169SMichael Stahl * for a copy of the LGPLv3 License. 25*5448f169SMichael Stahl * 26*5448f169SMichael Stahl ************************************************************************/ 27*5448f169SMichael Stahl 28*5448f169SMichael Stahl // MARKER(update_precomp.py): autogen include statement, do not remove 29*5448f169SMichael Stahl #include "precompiled_shell.hxx" 30*5448f169SMichael Stahl #include "cppunit/TestAssert.h" 31*5448f169SMichael Stahl #include "cppunit/TestFixture.h" 32*5448f169SMichael Stahl #include "cppunit/extensions/HelperMacros.h" 33*5448f169SMichael Stahl #include "cppunit/plugin/TestPlugIn.h" 34*5448f169SMichael Stahl #include <string> 35*5448f169SMichael Stahl #include "testimpl/testzipimpl.hxx" 36*5448f169SMichael Stahl using namespace std; 37*5448f169SMichael Stahl 38*5448f169SMichael Stahl class Test : public CppUnit::TestFixture 39*5448f169SMichael Stahl { 40*5448f169SMichael Stahl private: 41*5448f169SMichael Stahl string documentName; 42*5448f169SMichael Stahl public: 43*5448f169SMichael Stahl Test(); 44*5448f169SMichael Stahl void setUp() {} 45*5448f169SMichael Stahl void tearDown() {} 46*5448f169SMichael Stahl void test_directory(); 47*5448f169SMichael Stahl void test_hasContentCaseInSensitive(); 48*5448f169SMichael Stahl void test_getContent(); 49*5448f169SMichael Stahl CPPUNIT_TEST_SUITE(Test); 50*5448f169SMichael Stahl CPPUNIT_TEST(test_directory); 51*5448f169SMichael Stahl CPPUNIT_TEST(test_hasContentCaseInSensitive); 52*5448f169SMichael Stahl CPPUNIT_TEST(test_getContent); 53*5448f169SMichael Stahl CPPUNIT_TEST_SUITE_END(); 54*5448f169SMichael Stahl }; 55*5448f169SMichael Stahl 56*5448f169SMichael Stahl CPPUNIT_TEST_SUITE_REGISTRATION(Test); 57*5448f169SMichael Stahl 58*5448f169SMichael Stahl Test::Test() : 59*5448f169SMichael Stahl documentName("simpledocument.odt") 60*5448f169SMichael Stahl { 61*5448f169SMichael Stahl } 62*5448f169SMichael Stahl 63*5448f169SMichael Stahl //------------------------------------------------ 64*5448f169SMichael Stahl void Test::test_directory() 65*5448f169SMichael Stahl { 66*5448f169SMichael Stahl TestZipImpl testImpl(documentName.c_str()); 67*5448f169SMichael Stahl bool isPassed = testImpl.test_directory(); 68*5448f169SMichael Stahl CPPUNIT_ASSERT_MESSAGE("Content does not match with expected directory names.", isPassed); 69*5448f169SMichael Stahl } 70*5448f169SMichael Stahl 71*5448f169SMichael Stahl //------------------------------------------------ 72*5448f169SMichael Stahl void Test::test_hasContentCaseInSensitive() 73*5448f169SMichael Stahl { 74*5448f169SMichael Stahl TestZipImpl testImpl(documentName.c_str()); 75*5448f169SMichael Stahl bool isPassed = testImpl.test_hasContentCaseInSensitive(); 76*5448f169SMichael Stahl CPPUNIT_ASSERT_MESSAGE("Content in zip file was not found.", isPassed); 77*5448f169SMichael Stahl } 78*5448f169SMichael Stahl 79*5448f169SMichael Stahl //------------------------------------------------ 80*5448f169SMichael Stahl void Test::test_getContent() 81*5448f169SMichael Stahl { 82*5448f169SMichael Stahl TestZipImpl testImpl(documentName.c_str()); 83*5448f169SMichael Stahl bool isPassed = testImpl.test_getContent(); 84*5448f169SMichael Stahl CPPUNIT_ASSERT_MESSAGE("Couldn't recieve content buffer form zipfile.", isPassed); 85*5448f169SMichael Stahl } 86*5448f169SMichael Stahl 87*5448f169SMichael Stahl //##################################### 88*5448f169SMichael Stahl // register test suites 89*5448f169SMichael Stahl 90*5448f169SMichael Stahl CPPUNIT_PLUGIN_IMPLEMENT(); 91*5448f169SMichael Stahl 92