xref: /trunk/main/shell/qa/zip/testimpl/testzipimpl.cxx (revision 6b7c93d1)
1f8e2c85aSAndrew Rist /**************************************************************
2*6b7c93d1Smseidel  *
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
10*6b7c93d1Smseidel  *
11f8e2c85aSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*6b7c93d1Smseidel  *
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.
19*6b7c93d1Smseidel  *
20f8e2c85aSAndrew Rist  *************************************************************/
21f8e2c85aSAndrew Rist 
225448f169SMichael Stahl // MARKER(update_precomp.py): autogen include statement, do not remove
235448f169SMichael Stahl #include "precompiled_shell.hxx"
245448f169SMichael Stahl 
255448f169SMichael Stahl #define DLLIMPLEMENTATION
265448f169SMichael Stahl #include "testzipimpl.hxx"
275448f169SMichael Stahl 
28*6b7c93d1Smseidel vector<string> expectedContents;
295448f169SMichael Stahl 
TestZipImpl(const char * documentName)305448f169SMichael Stahl TestZipImpl::TestZipImpl(const char * documentName) :
315448f169SMichael Stahl 		zipFile(ZipFile(string(documentName)))
325448f169SMichael Stahl {
335448f169SMichael Stahl 		expectedContents.push_back("mimetype");
345448f169SMichael Stahl 		expectedContents.push_back("Configurations2/statusbar/");
355448f169SMichael Stahl 		expectedContents.push_back("Configurations2/accelerator/current.xml");
365448f169SMichael Stahl 		expectedContents.push_back("Configurations2/floater/");
375448f169SMichael Stahl 		expectedContents.push_back("Configurations2/popupmenu/");
385448f169SMichael Stahl 		expectedContents.push_back("Configurations2/progressbar/");
395448f169SMichael Stahl 		expectedContents.push_back("Configurations2/toolpanel/");
405448f169SMichael Stahl 		expectedContents.push_back("Configurations2/menubar/");
415448f169SMichael Stahl 		expectedContents.push_back("Configurations2/toolbar/");
425448f169SMichael Stahl 		expectedContents.push_back("Configurations2/images/Bitmaps/");
435448f169SMichael Stahl 		expectedContents.push_back("content.xml");
445448f169SMichael Stahl 		expectedContents.push_back("manifest.rdf");
455448f169SMichael Stahl 		expectedContents.push_back("styles.xml");
465448f169SMichael Stahl 		expectedContents.push_back("meta.xml");
475448f169SMichael Stahl 		expectedContents.push_back("Thumbnails/thumbnail.png");
485448f169SMichael Stahl 		expectedContents.push_back("settings.xml");
495448f169SMichael Stahl 		expectedContents.push_back("META-INF/manifest.xml");
505448f169SMichael Stahl 		sort(expectedContents.begin(), expectedContents.end());
515448f169SMichael Stahl }
525448f169SMichael Stahl 
~TestZipImpl()53*6b7c93d1Smseidel TestZipImpl::~TestZipImpl()
54*6b7c93d1Smseidel {
555448f169SMichael Stahl }
565448f169SMichael Stahl 
575448f169SMichael Stahl //------------------------------------------------
test_directory()585448f169SMichael Stahl bool TestZipImpl::test_directory()
595448f169SMichael Stahl {
605448f169SMichael Stahl 		ZipFile::DirectoryPtr_t contents = zipFile.GetDirectory();
615448f169SMichael Stahl 		vector<string> &stringVector = *contents.get();
625448f169SMichael Stahl 		sort(stringVector.begin(), stringVector.end());
635448f169SMichael Stahl 		return expectedContents == expectedContents;
645448f169SMichael Stahl }
655448f169SMichael Stahl 
665448f169SMichael Stahl //------------------------------------------------
test_hasContentCaseInSensitive()675448f169SMichael Stahl bool TestZipImpl::test_hasContentCaseInSensitive()
685448f169SMichael Stahl {
695448f169SMichael Stahl 		return zipFile.HasContent("mimetype");
705448f169SMichael Stahl }
715448f169SMichael Stahl 
725448f169SMichael Stahl //------------------------------------------------
test_getContent()735448f169SMichael Stahl bool TestZipImpl::test_getContent()
745448f169SMichael Stahl {
755448f169SMichael Stahl 		ZipFile::ZipContentBuffer_t contentBuf;
765448f169SMichael Stahl 		zipFile.GetUncompressedContent("content.xml", contentBuf);
775448f169SMichael Stahl 		return !contentBuf.empty();
785448f169SMichael Stahl }
795448f169SMichael Stahl 
80*6b7c93d1Smseidel /* vim: set noet sw=4 ts=4: */
81