1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "testzipimpl.hxx"
22 TestZipImpl::TestZipImpl(StreamInterface
*stream
) :
23 zipFile(ZipFile(stream
)), expectedContents()
25 expectedContents
.push_back("mimetype");
26 expectedContents
.push_back("Configurations2/statusbar/");
27 expectedContents
.push_back("Configurations2/accelerator/current.xml");
28 expectedContents
.push_back("Configurations2/floater/");
29 expectedContents
.push_back("Configurations2/popupmenu/");
30 expectedContents
.push_back("Configurations2/progressbar/");
31 expectedContents
.push_back("Configurations2/toolpanel/");
32 expectedContents
.push_back("Configurations2/menubar/");
33 expectedContents
.push_back("Configurations2/toolbar/");
34 expectedContents
.push_back("Configurations2/images/Bitmaps/");
35 expectedContents
.push_back("content.xml");
36 expectedContents
.push_back("manifest.rdf");
37 expectedContents
.push_back("styles.xml");
38 expectedContents
.push_back("meta.xml");
39 expectedContents
.push_back("Thumbnails/thumbnail.png");
40 expectedContents
.push_back("settings.xml");
41 expectedContents
.push_back("META-INF/manifest.xml");
42 sort(expectedContents
.begin(), expectedContents
.end());
45 TestZipImpl::~TestZipImpl()
49 bool TestZipImpl::test_directory()
51 ZipFile::DirectoryPtr_t contents
= zipFile
.GetDirectory();
52 vector
<string
> &stringVector
= *contents
.get();
53 sort(stringVector
.begin(), stringVector
.end());
54 return expectedContents
== stringVector
;
57 bool TestZipImpl::test_hasContentCaseInSensitive()
59 return zipFile
.HasContent("mimetype");
62 bool TestZipImpl::test_getContent()
64 ZipFile::ZipContentBuffer_t contentBuf
;
65 zipFile
.GetUncompressedContent("content.xml", contentBuf
);
66 return !contentBuf
.empty();
69 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */