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