xref: /aoo42x/main/shell/qa/zip/ziptest.cxx (revision fb0f01d8)
1f8e2c85aSAndrew Rist /**************************************************************
25448f169SMichael Stahl  *
3f8e2c85aSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4f8e2c85aSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5f8e2c85aSAndrew Rist  * distributed with this work for additional information
6f8e2c85aSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7f8e2c85aSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8f8e2c85aSAndrew Rist  * "License"); you may not use this file except in compliance
9f8e2c85aSAndrew Rist  * with the License.  You may obtain a copy of the License at
10f8e2c85aSAndrew Rist  *
11f8e2c85aSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12f8e2c85aSAndrew Rist  *
13f8e2c85aSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14f8e2c85aSAndrew Rist  * software distributed under the License is distributed on an
15f8e2c85aSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16f8e2c85aSAndrew Rist  * KIND, either express or implied.  See the License for the
17f8e2c85aSAndrew Rist  * specific language governing permissions and limitations
18f8e2c85aSAndrew Rist  * under the License.
19f8e2c85aSAndrew Rist  *
20f8e2c85aSAndrew Rist  *************************************************************/
21f8e2c85aSAndrew Rist 
22f8e2c85aSAndrew Rist 
235448f169SMichael Stahl 
245448f169SMichael Stahl // MARKER(update_precomp.py): autogen include statement, do not remove
255448f169SMichael Stahl #include "precompiled_shell.hxx"
26*fb0f01d8SDamjan Jovanovic #include "gtest/gtest.h"
275448f169SMichael Stahl #include <string>
285448f169SMichael Stahl #include "testimpl/testzipimpl.hxx"
295448f169SMichael Stahl using namespace std;
305448f169SMichael Stahl 
31*fb0f01d8SDamjan Jovanovic class Test : public ::testing::Test
325448f169SMichael Stahl {
33*fb0f01d8SDamjan Jovanovic 		protected:
345448f169SMichael Stahl 				string documentName;
355448f169SMichael Stahl 		public:
365448f169SMichael Stahl 				Test();
37*fb0f01d8SDamjan Jovanovic 				void SetUp() {}
38*fb0f01d8SDamjan Jovanovic 				void TearDown() {}
395448f169SMichael Stahl };
405448f169SMichael Stahl 
415448f169SMichael Stahl Test::Test() :
425448f169SMichael Stahl 		documentName("simpledocument.odt")
435448f169SMichael Stahl {
445448f169SMichael Stahl }
455448f169SMichael Stahl 
465448f169SMichael Stahl //------------------------------------------------
47*fb0f01d8SDamjan Jovanovic TEST_F(Test, test_directory)
485448f169SMichael Stahl {
495448f169SMichael Stahl 		TestZipImpl testImpl(documentName.c_str());
505448f169SMichael Stahl 		bool isPassed = testImpl.test_directory();
51*fb0f01d8SDamjan Jovanovic 		ASSERT_TRUE(isPassed) << "Content does not match with expected directory names.";
525448f169SMichael Stahl }
535448f169SMichael Stahl 
545448f169SMichael Stahl //------------------------------------------------
55*fb0f01d8SDamjan Jovanovic TEST_F(Test, test_hasContentCaseInSensitive)
565448f169SMichael Stahl {
575448f169SMichael Stahl 		TestZipImpl testImpl(documentName.c_str());
585448f169SMichael Stahl 		bool isPassed = testImpl.test_hasContentCaseInSensitive();
59*fb0f01d8SDamjan Jovanovic 		ASSERT_TRUE(isPassed) << "Content in zip file was not found.";
605448f169SMichael Stahl }
615448f169SMichael Stahl 
625448f169SMichael Stahl //------------------------------------------------
63*fb0f01d8SDamjan Jovanovic TEST_F(Test, test_getContent)
645448f169SMichael Stahl {
655448f169SMichael Stahl 		TestZipImpl testImpl(documentName.c_str());
665448f169SMichael Stahl 		bool isPassed = testImpl.test_getContent();
67*fb0f01d8SDamjan Jovanovic 		ASSERT_TRUE(isPassed) << "Couldn't receive content buffer form zipfile.";
685448f169SMichael Stahl }
695448f169SMichael Stahl 
70*fb0f01d8SDamjan Jovanovic int main(int argc, char **argv)
71*fb0f01d8SDamjan Jovanovic {
72*fb0f01d8SDamjan Jovanovic     ::testing::InitGoogleTest(&argc, argv);
73*fb0f01d8SDamjan Jovanovic     return RUN_ALL_TESTS();
74*fb0f01d8SDamjan Jovanovic }
75