1*5448f169SMichael Stahl /*************************************************************************
2*5448f169SMichael Stahl  *
3*5448f169SMichael Stahl  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*5448f169SMichael Stahl  *
5*5448f169SMichael Stahl  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*5448f169SMichael Stahl  *
7*5448f169SMichael Stahl  * OpenOffice.org - a multi-platform office productivity suite
8*5448f169SMichael Stahl  *
9*5448f169SMichael Stahl  * This file is part of OpenOffice.org.
10*5448f169SMichael Stahl  *
11*5448f169SMichael Stahl  * OpenOffice.org is free software: you can redistribute it and/or modify
12*5448f169SMichael Stahl  * it under the terms of the GNU Lesser General Public License version 3
13*5448f169SMichael Stahl  * only, as published by the Free Software Foundation.
14*5448f169SMichael Stahl  *
15*5448f169SMichael Stahl  * OpenOffice.org is distributed in the hope that it will be useful,
16*5448f169SMichael Stahl  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*5448f169SMichael Stahl  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*5448f169SMichael Stahl  * GNU Lesser General Public License version 3 for more details
19*5448f169SMichael Stahl  * (a copy is included in the LICENSE file that accompanied this code).
20*5448f169SMichael Stahl  *
21*5448f169SMichael Stahl  * You should have received a copy of the GNU Lesser General Public License
22*5448f169SMichael Stahl  * version 3 along with OpenOffice.org.  If not, see
23*5448f169SMichael Stahl  * <http://www.openoffice.org/license.html>
24*5448f169SMichael Stahl  * for a copy of the LGPLv3 License.
25*5448f169SMichael Stahl  *
26*5448f169SMichael Stahl  ************************************************************************/
27*5448f169SMichael Stahl 
28*5448f169SMichael Stahl // MARKER(update_precomp.py): autogen include statement, do not remove
29*5448f169SMichael Stahl #include "precompiled_shell.hxx"
30*5448f169SMichael Stahl 
31*5448f169SMichael Stahl #define DLLIMPLEMENTATION
32*5448f169SMichael Stahl #include "testzipimpl.hxx"
33*5448f169SMichael Stahl 
34*5448f169SMichael Stahl vector<string> expectedContents;
35*5448f169SMichael Stahl 
36*5448f169SMichael Stahl TestZipImpl::TestZipImpl(const char * documentName) :
37*5448f169SMichael Stahl 		zipFile(ZipFile(string(documentName)))
38*5448f169SMichael Stahl {
39*5448f169SMichael Stahl 		expectedContents.push_back("mimetype");
40*5448f169SMichael Stahl 		expectedContents.push_back("Configurations2/statusbar/");
41*5448f169SMichael Stahl 		expectedContents.push_back("Configurations2/accelerator/current.xml");
42*5448f169SMichael Stahl 		expectedContents.push_back("Configurations2/floater/");
43*5448f169SMichael Stahl 		expectedContents.push_back("Configurations2/popupmenu/");
44*5448f169SMichael Stahl 		expectedContents.push_back("Configurations2/progressbar/");
45*5448f169SMichael Stahl 		expectedContents.push_back("Configurations2/toolpanel/");
46*5448f169SMichael Stahl 		expectedContents.push_back("Configurations2/menubar/");
47*5448f169SMichael Stahl 		expectedContents.push_back("Configurations2/toolbar/");
48*5448f169SMichael Stahl 		expectedContents.push_back("Configurations2/images/Bitmaps/");
49*5448f169SMichael Stahl 		expectedContents.push_back("content.xml");
50*5448f169SMichael Stahl 		expectedContents.push_back("manifest.rdf");
51*5448f169SMichael Stahl 		expectedContents.push_back("styles.xml");
52*5448f169SMichael Stahl 		expectedContents.push_back("meta.xml");
53*5448f169SMichael Stahl 		expectedContents.push_back("Thumbnails/thumbnail.png");
54*5448f169SMichael Stahl 		expectedContents.push_back("settings.xml");
55*5448f169SMichael Stahl 		expectedContents.push_back("META-INF/manifest.xml");
56*5448f169SMichael Stahl 		sort(expectedContents.begin(), expectedContents.end());
57*5448f169SMichael Stahl }
58*5448f169SMichael Stahl 
59*5448f169SMichael Stahl TestZipImpl::~TestZipImpl()
60*5448f169SMichael Stahl {
61*5448f169SMichael Stahl }
62*5448f169SMichael Stahl 
63*5448f169SMichael Stahl 
64*5448f169SMichael Stahl //------------------------------------------------
65*5448f169SMichael Stahl bool TestZipImpl::test_directory()
66*5448f169SMichael Stahl {
67*5448f169SMichael Stahl 		ZipFile::DirectoryPtr_t contents = zipFile.GetDirectory();
68*5448f169SMichael Stahl 		vector<string> &stringVector = *contents.get();
69*5448f169SMichael Stahl 		sort(stringVector.begin(), stringVector.end());
70*5448f169SMichael Stahl 		return expectedContents == expectedContents;
71*5448f169SMichael Stahl }
72*5448f169SMichael Stahl 
73*5448f169SMichael Stahl //------------------------------------------------
74*5448f169SMichael Stahl bool TestZipImpl::test_hasContentCaseInSensitive()
75*5448f169SMichael Stahl {
76*5448f169SMichael Stahl 		return zipFile.HasContent("mimetype");
77*5448f169SMichael Stahl }
78*5448f169SMichael Stahl 
79*5448f169SMichael Stahl //------------------------------------------------
80*5448f169SMichael Stahl bool TestZipImpl::test_getContent()
81*5448f169SMichael Stahl {
82*5448f169SMichael Stahl 		ZipFile::ZipContentBuffer_t contentBuf;
83*5448f169SMichael Stahl 		zipFile.GetUncompressedContent("content.xml", contentBuf);
84*5448f169SMichael Stahl 		return !contentBuf.empty();
85*5448f169SMichael Stahl }
86*5448f169SMichael Stahl 
87