ziptest.cxx (86e1cf34) ziptest.cxx (fb0f01d8)
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 unchanged lines hidden (view full) ---

18 * under the License.
19 *
20 *************************************************************/
21
22
23
24// MARKER(update_precomp.py): autogen include statement, do not remove
25#include "precompiled_shell.hxx"
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 unchanged lines hidden (view full) ---

18 * under the License.
19 *
20 *************************************************************/
21
22
23
24// MARKER(update_precomp.py): autogen include statement, do not remove
25#include "precompiled_shell.hxx"
26#include "cppunit/TestAssert.h"
27#include "cppunit/TestFixture.h"
28#include "cppunit/extensions/HelperMacros.h"
29#include "cppunit/plugin/TestPlugIn.h"
26#include "gtest/gtest.h"
30#include <string>
31#include "testimpl/testzipimpl.hxx"
32using namespace std;
33
27#include <string>
28#include "testimpl/testzipimpl.hxx"
29using namespace std;
30
34class Test : public CppUnit::TestFixture
31class Test : public ::testing::Test
35{
32{
36 private:
33 protected:
37 string documentName;
38 public:
39 Test();
34 string documentName;
35 public:
36 Test();
40 void setUp() {}
41 void tearDown() {}
42 void test_directory();
43 void test_hasContentCaseInSensitive();
44 void test_getContent();
45 CPPUNIT_TEST_SUITE(Test);
46 CPPUNIT_TEST(test_directory);
47 CPPUNIT_TEST(test_hasContentCaseInSensitive);
48 CPPUNIT_TEST(test_getContent);
49 CPPUNIT_TEST_SUITE_END();
37 void SetUp() {}
38 void TearDown() {}
50};
51
39};
40
52CPPUNIT_TEST_SUITE_REGISTRATION(Test);
53
54Test::Test() :
55 documentName("simpledocument.odt")
56{
57}
58
59//------------------------------------------------
41Test::Test() :
42 documentName("simpledocument.odt")
43{
44}
45
46//------------------------------------------------
60void Test::test_directory()
47TEST_F(Test, test_directory)
61{
62 TestZipImpl testImpl(documentName.c_str());
63 bool isPassed = testImpl.test_directory();
48{
49 TestZipImpl testImpl(documentName.c_str());
50 bool isPassed = testImpl.test_directory();
64 CPPUNIT_ASSERT_MESSAGE("Content does not match with expected directory names.", isPassed);
51 ASSERT_TRUE(isPassed) << "Content does not match with expected directory names.";
65}
66
67//------------------------------------------------
52}
53
54//------------------------------------------------
68void Test::test_hasContentCaseInSensitive()
55TEST_F(Test, test_hasContentCaseInSensitive)
69{
70 TestZipImpl testImpl(documentName.c_str());
71 bool isPassed = testImpl.test_hasContentCaseInSensitive();
56{
57 TestZipImpl testImpl(documentName.c_str());
58 bool isPassed = testImpl.test_hasContentCaseInSensitive();
72 CPPUNIT_ASSERT_MESSAGE("Content in zip file was not found.", isPassed);
59 ASSERT_TRUE(isPassed) << "Content in zip file was not found.";
73}
74
75//------------------------------------------------
60}
61
62//------------------------------------------------
76void Test::test_getContent()
63TEST_F(Test, test_getContent)
77{
78 TestZipImpl testImpl(documentName.c_str());
79 bool isPassed = testImpl.test_getContent();
64{
65 TestZipImpl testImpl(documentName.c_str());
66 bool isPassed = testImpl.test_getContent();
80 CPPUNIT_ASSERT_MESSAGE("Couldn't receive content buffer form zipfile.", isPassed);
67 ASSERT_TRUE(isPassed) << "Couldn't receive content buffer form zipfile.";
81}
82
68}
69
83//#####################################
84// register test suites
85
86CPPUNIT_PLUGIN_IMPLEMENT();
87
70int main(int argc, char **argv)
71{
72 ::testing::InitGoogleTest(&argc, argv);
73 return RUN_ALL_TESTS();
74}