[Libreoffice-commits] core.git: vcl/CppunitTest_vcl_bitmapprocessor_test.mk vcl/inc vcl/Module_vcl.mk vcl/qa

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Sat Apr 8 20:29:21 UTC 2017


 vcl/CppunitTest_vcl_bitmapprocessor_test.mk |   56 ++++++++++++++++++++++++
 vcl/Module_vcl.mk                           |    1 
 vcl/inc/BitmapProcessor.hxx                 |    2 
 vcl/qa/cppunit/BitmapProcessorTest.cxx      |   63 ++++++++++++++++++++++++++++
 4 files changed, 121 insertions(+), 1 deletion(-)

New commits:
commit 2fc6d1a1097cf52aa0845b016139e0bdbdfdeb6d
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Sat Apr 8 19:29:37 2017 +0200

    vcl: Bitmap processor test - test converting to "disabled" image
    
    Change-Id: I7146d2c667ec439a07e709e0aba96c37dc780db4
    Reviewed-on: https://gerrit.libreoffice.org/36293
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/vcl/CppunitTest_vcl_bitmapprocessor_test.mk b/vcl/CppunitTest_vcl_bitmapprocessor_test.mk
new file mode 100644
index 000000000000..76dc666465e7
--- /dev/null
+++ b/vcl/CppunitTest_vcl_bitmapprocessor_test.mk
@@ -0,0 +1,56 @@
+# -*- 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,vcl_bitmapprocessor_test))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,vcl_bitmapprocessor_test, \
+    vcl/qa/cppunit/BitmapProcessorTest \
+))
+
+$(eval $(call gb_CppunitTest_use_externals,vcl_bitmapprocessor_test,\
+    boost_headers \
+))
+
+$(eval $(call gb_CppunitTest_set_include,vcl_bitmapprocessor_test,\
+    $$(INCLUDE) \
+    -I$(SRCDIR)/vcl/inc \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,vcl_bitmapprocessor_test, \
+    comphelper \
+    cppu \
+    cppuhelper \
+    sal \
+    svt \
+    test \
+    tl \
+    unotest \
+    vcl \
+    utl \
+    $(gb_UWINAPI) \
+))
+
+$(eval $(call gb_CppunitTest_use_api,vcl_bitmapprocessor_test,\
+    udkapi \
+    offapi \
+))
+
+$(eval $(call gb_CppunitTest_use_ure,vcl_bitmapprocessor_test))
+$(eval $(call gb_CppunitTest_use_vcl,vcl_bitmapprocessor_test))
+
+$(eval $(call gb_CppunitTest_use_components,vcl_bitmapprocessor_test,\
+    configmgr/source/configmgr \
+    i18npool/util/i18npool \
+    ucb/source/core/ucb1 \
+    unotools/util/utl \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,vcl_bitmapprocessor_test))
+
+# vim: set noet sw=4 ts=4:
diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk
index a3c78c07b8e8..6232aa621135 100644
--- a/vcl/Module_vcl.mk
+++ b/vcl/Module_vcl.mk
@@ -138,6 +138,7 @@ endif
 $(eval $(call gb_Module_add_check_targets,vcl,\
 	CppunitTest_vcl_lifecycle \
 	CppunitTest_vcl_bitmap_test \
+	CppunitTest_vcl_bitmapprocessor_test \
 	CppunitTest_vcl_fontcharmap \
 	CppunitTest_vcl_font \
 	CppunitTest_vcl_fontmetric \
diff --git a/vcl/inc/BitmapProcessor.hxx b/vcl/inc/BitmapProcessor.hxx
index 8c07188ba19b..d76435c190fd 100644
--- a/vcl/inc/BitmapProcessor.hxx
+++ b/vcl/inc/BitmapProcessor.hxx
@@ -12,7 +12,7 @@
 
 #include <vcl/bitmapex.hxx>
 
-class BitmapProcessor
+class VCL_DLLPUBLIC BitmapProcessor
 {
 public:
     static BitmapEx createLightImage(const BitmapEx& rBitmapEx);
diff --git a/vcl/qa/cppunit/BitmapProcessorTest.cxx b/vcl/qa/cppunit/BitmapProcessorTest.cxx
new file mode 100644
index 000000000000..d2676da29d18
--- /dev/null
+++ b/vcl/qa/cppunit/BitmapProcessorTest.cxx
@@ -0,0 +1,63 @@
+/* -*- 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 <cppunit/TestAssert.h>
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/plugin/TestPlugIn.h>
+
+#include <vcl/bitmap.hxx>
+#include <vcl/bitmapaccess.hxx>
+#include <vcl/alpha.hxx>
+#include <vcl/virdev.hxx>
+
+#include <rtl/strbuf.hxx>
+#include <tools/stream.hxx>
+#include <vcl/graphicfilter.hxx>
+#include <config_features.h>
+
+#include "BitmapProcessor.hxx"
+
+
+namespace
+{
+
+class BitmapProcessorTest : public CppUnit::TestFixture
+{
+    void testDisabledImage();
+
+    CPPUNIT_TEST_SUITE(BitmapProcessorTest);
+    CPPUNIT_TEST(testDisabledImage);
+    CPPUNIT_TEST_SUITE_END();
+};
+
+void BitmapProcessorTest::testDisabledImage()
+{
+    Bitmap aBitmap(Size(3, 3), 24);
+    {
+        Bitmap::ScopedWriteAccess pWriteAccess(aBitmap);
+        pWriteAccess->Erase(Color(0x00, 0x11, 0x22, 0x33));
+    }
+    BitmapEx aBitmapEx(aBitmap);
+    BitmapEx aDisabledBitmapEx(BitmapProcessor::createDisabledImage(aBitmapEx));
+    Bitmap aDisabledBitmap(aDisabledBitmapEx.GetBitmap());
+    {
+        Bitmap::ScopedReadAccess pReadAccess(aDisabledBitmap);
+        Color aColor(pReadAccess->GetPixel(0, 0));
+        CPPUNIT_ASSERT_EQUAL(ColorData(0x001E1E1E), aColor.GetColor());
+    }
+}
+
+} // namespace
+
+CPPUNIT_TEST_SUITE_REGISTRATION(BitmapProcessorTest);
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list