calc: on editing invalidation of view with different zoom is wrong
[LibreOffice.git] / vcl / qa / cppunit / BinaryDataContainerTest.cxx
blob2f72a9d182144c1454f1ab1cf20b4d08a9f52908
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
8 */
10 #include <cppunit/TestAssert.h>
11 #include <cppunit/TestFixture.h>
12 #include <cppunit/extensions/HelperMacros.h>
14 #include <vcl/BinaryDataContainer.hxx>
16 using namespace css;
18 namespace
20 class BinaryDataContainerTest : public CppUnit::TestFixture
22 void testConstruct();
24 CPPUNIT_TEST_SUITE(BinaryDataContainerTest);
25 CPPUNIT_TEST(testConstruct);
26 CPPUNIT_TEST_SUITE_END();
29 void BinaryDataContainerTest::testConstruct()
32 BinaryDataContainer aContainer;
33 CPPUNIT_ASSERT(aContainer.isEmpty());
34 CPPUNIT_ASSERT_EQUAL(size_t(0), aContainer.getSize());
37 // construct a data array
38 sal_uInt8 aTestByteArray[] = { 1, 2, 3, 4 };
39 SvMemoryStream stream(aTestByteArray, std::size(aTestByteArray), StreamMode::READ);
41 BinaryDataContainer aContainer(stream, std::size(aTestByteArray));
43 CPPUNIT_ASSERT(!aContainer.isEmpty());
44 CPPUNIT_ASSERT_EQUAL(size_t(4), aContainer.getSize());
46 // Test Copy
47 BinaryDataContainer aCopyOfContainer = aContainer;
48 CPPUNIT_ASSERT(!aCopyOfContainer.isEmpty());
49 CPPUNIT_ASSERT_EQUAL(size_t(4), aCopyOfContainer.getSize());
50 CPPUNIT_ASSERT_EQUAL(aCopyOfContainer.getData(), aContainer.getData());
52 // Test Move
53 BinaryDataContainer aMovedInContainer = std::move(aCopyOfContainer);
54 CPPUNIT_ASSERT(!aMovedInContainer.isEmpty());
55 CPPUNIT_ASSERT_EQUAL(size_t(4), aMovedInContainer.getSize());
56 CPPUNIT_ASSERT_EQUAL(aMovedInContainer.getData(), aContainer.getData());
58 CPPUNIT_ASSERT(aCopyOfContainer.isEmpty());
59 CPPUNIT_ASSERT_EQUAL(size_t(0), aCopyOfContainer.getSize());
63 } // namespace
65 CPPUNIT_TEST_SUITE_REGISTRATION(BinaryDataContainerTest);
67 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */