xref: /trunk/main/shell/qa/zip/testimpl/testzipimpl.cxx (revision 6b7c93d1)
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 // MARKER(update_precomp.py): autogen include statement, do not remove
23 #include "precompiled_shell.hxx"
24 
25 #define DLLIMPLEMENTATION
26 #include "testzipimpl.hxx"
27 
28 vector<string> expectedContents;
29 
TestZipImpl(const char * documentName)30 TestZipImpl::TestZipImpl(const char * documentName) :
31 		zipFile(ZipFile(string(documentName)))
32 {
33 		expectedContents.push_back("mimetype");
34 		expectedContents.push_back("Configurations2/statusbar/");
35 		expectedContents.push_back("Configurations2/accelerator/current.xml");
36 		expectedContents.push_back("Configurations2/floater/");
37 		expectedContents.push_back("Configurations2/popupmenu/");
38 		expectedContents.push_back("Configurations2/progressbar/");
39 		expectedContents.push_back("Configurations2/toolpanel/");
40 		expectedContents.push_back("Configurations2/menubar/");
41 		expectedContents.push_back("Configurations2/toolbar/");
42 		expectedContents.push_back("Configurations2/images/Bitmaps/");
43 		expectedContents.push_back("content.xml");
44 		expectedContents.push_back("manifest.rdf");
45 		expectedContents.push_back("styles.xml");
46 		expectedContents.push_back("meta.xml");
47 		expectedContents.push_back("Thumbnails/thumbnail.png");
48 		expectedContents.push_back("settings.xml");
49 		expectedContents.push_back("META-INF/manifest.xml");
50 		sort(expectedContents.begin(), expectedContents.end());
51 }
52 
~TestZipImpl()53 TestZipImpl::~TestZipImpl()
54 {
55 }
56 
57 //------------------------------------------------
test_directory()58 bool TestZipImpl::test_directory()
59 {
60 		ZipFile::DirectoryPtr_t contents = zipFile.GetDirectory();
61 		vector<string> &stringVector = *contents.get();
62 		sort(stringVector.begin(), stringVector.end());
63 		return expectedContents == expectedContents;
64 }
65 
66 //------------------------------------------------
test_hasContentCaseInSensitive()67 bool TestZipImpl::test_hasContentCaseInSensitive()
68 {
69 		return zipFile.HasContent("mimetype");
70 }
71 
72 //------------------------------------------------
test_getContent()73 bool TestZipImpl::test_getContent()
74 {
75 		ZipFile::ZipContentBuffer_t contentBuf;
76 		zipFile.GetUncompressedContent("content.xml", contentBuf);
77 		return !contentBuf.empty();
78 }
79 
80 /* vim: set noet sw=4 ts=4: */
81