xref: /aoo41x/main/shell/qa/zip/ziptest.cxx (revision f8e2c85a)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_shell.hxx"
26 #include "cppunit/TestAssert.h"
27 #include "cppunit/TestFixture.h"
28 #include "cppunit/extensions/HelperMacros.h"
29 #include "cppunit/plugin/TestPlugIn.h"
30 #include <string>
31 #include "testimpl/testzipimpl.hxx"
32 using namespace std;
33 
34 class Test : public CppUnit::TestFixture
35 {
36 		private:
37 				string documentName;
38 		public:
39 				Test();
setUp()40 				void setUp() {}
tearDown()41 				void tearDown() {}
42 				void test_directory();
43 				void test_hasContentCaseInSensitive();
44 				void test_getContent();
45 				CPPUNIT_TEST_SUITE(Test);
46 				CPPUNIT_TEST(test_directory);
47 				CPPUNIT_TEST(test_hasContentCaseInSensitive);
48 				CPPUNIT_TEST(test_getContent);
49 				CPPUNIT_TEST_SUITE_END();
50 };
51 
52 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
53 
Test()54 Test::Test() :
55 		documentName("simpledocument.odt")
56 {
57 }
58 
59 //------------------------------------------------
test_directory()60 void Test::test_directory()
61 {
62 		TestZipImpl testImpl(documentName.c_str());
63 		bool isPassed = testImpl.test_directory();
64 		CPPUNIT_ASSERT_MESSAGE("Content does not match with expected directory names.", isPassed);
65 }
66 
67 //------------------------------------------------
test_hasContentCaseInSensitive()68 void Test::test_hasContentCaseInSensitive()
69 {
70 		TestZipImpl testImpl(documentName.c_str());
71 		bool isPassed = testImpl.test_hasContentCaseInSensitive();
72 		CPPUNIT_ASSERT_MESSAGE("Content in zip file was not found.", isPassed);
73 }
74 
75 //------------------------------------------------
test_getContent()76 void Test::test_getContent()
77 {
78 		TestZipImpl testImpl(documentName.c_str());
79 		bool isPassed = testImpl.test_getContent();
80 		CPPUNIT_ASSERT_MESSAGE("Couldn't recieve content buffer form zipfile.", isPassed);
81 }
82 
83 //#####################################
84 // register test suites
85 
86 CPPUNIT_PLUGIN_IMPLEMENT();
87 
88