xref: /AOO41X/main/shell/qa/zip/ziptest.cxx (revision f8e2c85a611dbc087707e0b32c9aee1ddf7485ca)
1*f8e2c85aSAndrew Rist /**************************************************************
25448f169SMichael Stahl  *
3*f8e2c85aSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*f8e2c85aSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*f8e2c85aSAndrew Rist  * distributed with this work for additional information
6*f8e2c85aSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*f8e2c85aSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*f8e2c85aSAndrew Rist  * "License"); you may not use this file except in compliance
9*f8e2c85aSAndrew Rist  * with the License.  You may obtain a copy of the License at
105448f169SMichael Stahl  *
11*f8e2c85aSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
125448f169SMichael Stahl  *
13*f8e2c85aSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*f8e2c85aSAndrew Rist  * software distributed under the License is distributed on an
15*f8e2c85aSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*f8e2c85aSAndrew Rist  * KIND, either express or implied.  See the License for the
17*f8e2c85aSAndrew Rist  * specific language governing permissions and limitations
18*f8e2c85aSAndrew Rist  * under the License.
195448f169SMichael Stahl  *
20*f8e2c85aSAndrew Rist  *************************************************************/
21*f8e2c85aSAndrew Rist 
22*f8e2c85aSAndrew Rist 
235448f169SMichael Stahl 
245448f169SMichael Stahl // MARKER(update_precomp.py): autogen include statement, do not remove
255448f169SMichael Stahl #include "precompiled_shell.hxx"
265448f169SMichael Stahl #include "cppunit/TestAssert.h"
275448f169SMichael Stahl #include "cppunit/TestFixture.h"
285448f169SMichael Stahl #include "cppunit/extensions/HelperMacros.h"
295448f169SMichael Stahl #include "cppunit/plugin/TestPlugIn.h"
305448f169SMichael Stahl #include <string>
315448f169SMichael Stahl #include "testimpl/testzipimpl.hxx"
325448f169SMichael Stahl using namespace std;
335448f169SMichael Stahl 
345448f169SMichael Stahl class Test : public CppUnit::TestFixture
355448f169SMichael Stahl {
365448f169SMichael Stahl 		private:
375448f169SMichael Stahl 				string documentName;
385448f169SMichael Stahl 		public:
395448f169SMichael Stahl 				Test();
setUp()405448f169SMichael Stahl 				void setUp() {}
tearDown()415448f169SMichael Stahl 				void tearDown() {}
425448f169SMichael Stahl 				void test_directory();
435448f169SMichael Stahl 				void test_hasContentCaseInSensitive();
445448f169SMichael Stahl 				void test_getContent();
455448f169SMichael Stahl 				CPPUNIT_TEST_SUITE(Test);
465448f169SMichael Stahl 				CPPUNIT_TEST(test_directory);
475448f169SMichael Stahl 				CPPUNIT_TEST(test_hasContentCaseInSensitive);
485448f169SMichael Stahl 				CPPUNIT_TEST(test_getContent);
495448f169SMichael Stahl 				CPPUNIT_TEST_SUITE_END();
505448f169SMichael Stahl };
515448f169SMichael Stahl 
525448f169SMichael Stahl CPPUNIT_TEST_SUITE_REGISTRATION(Test);
535448f169SMichael Stahl 
Test()545448f169SMichael Stahl Test::Test() :
555448f169SMichael Stahl 		documentName("simpledocument.odt")
565448f169SMichael Stahl {
575448f169SMichael Stahl }
585448f169SMichael Stahl 
595448f169SMichael Stahl //------------------------------------------------
test_directory()605448f169SMichael Stahl void Test::test_directory()
615448f169SMichael Stahl {
625448f169SMichael Stahl 		TestZipImpl testImpl(documentName.c_str());
635448f169SMichael Stahl 		bool isPassed = testImpl.test_directory();
645448f169SMichael Stahl 		CPPUNIT_ASSERT_MESSAGE("Content does not match with expected directory names.", isPassed);
655448f169SMichael Stahl }
665448f169SMichael Stahl 
675448f169SMichael Stahl //------------------------------------------------
test_hasContentCaseInSensitive()685448f169SMichael Stahl void Test::test_hasContentCaseInSensitive()
695448f169SMichael Stahl {
705448f169SMichael Stahl 		TestZipImpl testImpl(documentName.c_str());
715448f169SMichael Stahl 		bool isPassed = testImpl.test_hasContentCaseInSensitive();
725448f169SMichael Stahl 		CPPUNIT_ASSERT_MESSAGE("Content in zip file was not found.", isPassed);
735448f169SMichael Stahl }
745448f169SMichael Stahl 
755448f169SMichael Stahl //------------------------------------------------
test_getContent()765448f169SMichael Stahl void Test::test_getContent()
775448f169SMichael Stahl {
785448f169SMichael Stahl 		TestZipImpl testImpl(documentName.c_str());
795448f169SMichael Stahl 		bool isPassed = testImpl.test_getContent();
805448f169SMichael Stahl 		CPPUNIT_ASSERT_MESSAGE("Couldn't recieve content buffer form zipfile.", isPassed);
815448f169SMichael Stahl }
825448f169SMichael Stahl 
835448f169SMichael Stahl //#####################################
845448f169SMichael Stahl // register test suites
855448f169SMichael Stahl 
865448f169SMichael Stahl CPPUNIT_PLUGIN_IMPLEMENT();
875448f169SMichael Stahl 
88