Skip to content

Commit

Permalink
vcl: failing GetPixel() test
Browse files Browse the repository at this point in the history
Change-Id: I9e91011b05c6b583a4d6c7677e8258300609fb31
  • Loading branch information
chrissherlock committed Oct 6, 2019
1 parent 368195c commit 515c1b3
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 0 deletions.
59 changes: 59 additions & 0 deletions vcl/CppunitTest_vcl_PixelTest.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#

$(eval $(call gb_CppunitTest_CppunitTest,PixelTest))

$(eval $(call gb_CppunitTest_add_exception_objects,PixelTest, \
vcl/qa/cppunit/outdev/PixelTest \
))

$(eval $(call gb_CppunitTest_use_externals,PixelTest,\
boost_headers \
libxml2 \
))
ifeq ($(DISABLE_GUI),)
$(eval $(call gb_CppunitTest_use_externals,PixelTest,\
epoxy \
))
endif


$(eval $(call gb_CppunitTest_set_include,PixelTest,\
$$(INCLUDE) \
-I$(SRCDIR)/vcl/inc \
))

$(eval $(call gb_CppunitTest_use_libraries,PixelTest, \
comphelper \
cppu \
cppuhelper \
sal \
svt \
test \
tl \
unotest \
vcl \
utl \
))

$(eval $(call gb_CppunitTest_use_sdk_api,PixelTest))

$(eval $(call gb_CppunitTest_use_ure,PixelTest))
$(eval $(call gb_CppunitTest_use_vcl,PixelTest))

$(eval $(call gb_CppunitTest_use_components,PixelTest,\
configmgr/source/configmgr \
i18npool/util/i18npool \
ucb/source/core/ucb1 \
unotools/util/utl \
))

$(eval $(call gb_CppunitTest_use_configuration,PixelTest))

# vim: set noet sw=4 ts=4:
1 change: 1 addition & 0 deletions vcl/Module_vcl.mk
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ $(eval $(call gb_Module_add_targets,vcl,\
endif

$(eval $(call gb_Module_add_check_targets,vcl,\
CppunitTest_vcl_PixelTest \
CppunitTest_vcl_lifecycle \
CppunitTest_vcl_bitmap_test \
CppunitTest_vcl_bitmapprocessor_test \
Expand Down
45 changes: 45 additions & 0 deletions vcl/qa/cppunit/outdev/PixelTest.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
*/

#include <test/bootstrapfixture.hxx>

#include <vcl/virdev.hxx>

class PixelTest : public test::BootstrapFixture
{
public:
PixelTest()
: BootstrapFixture(true, false)
{
}
void testPixel();

CPPUNIT_TEST_SUITE(PixelTest);
CPPUNIT_TEST(testPixel);

CPPUNIT_TEST_SUITE_END();
};

void PixelTest::testPixel()
{
VirtualDevice aRenderContext;

aRenderContext.DrawPixel(Point(8, 1), COL_GREEN);
CPPUNIT_ASSERT_EQUAL(COL_GREEN, aRenderContext.GetPixel(Point(8, 1)));

aRenderContext.DrawPixel(Point(1, 8), COL_BLUE);
CPPUNIT_ASSERT_EQUAL(COL_BLUE, aRenderContext.GetPixel(Point(1, 8)));
}

CPPUNIT_TEST_SUITE_REGISTRATION(PixelTest);

CPPUNIT_PLUGIN_IMPLEMENT();

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

0 comments on commit 515c1b3

Please sign in to comment.