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 <cppunit/TestAssert.h>
21 #include <cppunit/TestFixture.h>
22 #include <cppunit/extensions/HelperMacros.h>
24 #include <basegfx/color/bcolor.hxx>
25 #include <basegfx/color/bcolormodifier.hxx>
29 class bcolormodifier
: public CppUnit::TestFixture
57 const basegfx::BColorModifierSharedPtr aBColorModifier
58 = std::make_shared
<basegfx::BColorModifier_gray
>();
60 CPPUNIT_ASSERT_EQUAL(maWhite
, aBColorModifier
->getModifiedColor(maWhite
));
61 CPPUNIT_ASSERT_EQUAL(maGray
, aBColorModifier
->getModifiedColor(maGray
));
62 CPPUNIT_ASSERT_EQUAL(maBlack
, aBColorModifier
->getModifiedColor(maBlack
));
64 BColor
aGrayedRed(77.0 / 256.0, 77.0 / 256.0, 77.0 / 256.0);
65 CPPUNIT_ASSERT_EQUAL(aGrayedRed
, aBColorModifier
->getModifiedColor(maRed
));
66 BColor
aGrayedGreen(151.0 / 256.0, 151.0 / 256.0, 151.0 / 256.0);
67 CPPUNIT_ASSERT_EQUAL(aGrayedGreen
, aBColorModifier
->getModifiedColor(maGreen
));
68 BColor
aGrayedBlue(28.0 / 256.0, 28.0 / 256.0, 28.0 / 256.0);
69 CPPUNIT_ASSERT_EQUAL(aGrayedBlue
, aBColorModifier
->getModifiedColor(maBlue
));
71 BColor
aGrayedYellow(228.0 / 256.0, 228.0 / 256.0, 228.0 / 256.0);
72 CPPUNIT_ASSERT_EQUAL(aGrayedYellow
, aBColorModifier
->getModifiedColor(maYellow
));
74 BColor
aGrayedMagenta(105.0 / 256.0, 105.0 / 256.0, 105.0 / 256.0);
75 CPPUNIT_ASSERT_EQUAL(aGrayedMagenta
, aBColorModifier
->getModifiedColor(maMagenta
));
77 BColor
aGrayedCyan(179.0 / 256.0, 179.0 / 256.0, 179.0 / 256.0);
78 CPPUNIT_ASSERT_EQUAL(aGrayedCyan
, aBColorModifier
->getModifiedColor(maCyan
));
80 CPPUNIT_ASSERT(aBColorModifier
->operator==(*aBColorModifier
));
81 const basegfx::BColorModifierSharedPtr aBColorModifierInvert
82 = std::make_shared
<basegfx::BColorModifier_invert
>();
83 CPPUNIT_ASSERT(*aBColorModifier
!= *aBColorModifierInvert
);
85 const basegfx::BColorModifierSharedPtr aBColorModifier2
86 = std::make_shared
<basegfx::BColorModifier_gray
>();
87 CPPUNIT_ASSERT(aBColorModifier
->operator==(*aBColorModifier2
));
92 const basegfx::BColorModifierSharedPtr aBColorModifier
93 = std::make_shared
<basegfx::BColorModifier_invert
>();
95 CPPUNIT_ASSERT_EQUAL(maBlack
, aBColorModifier
->getModifiedColor(maWhite
));
96 CPPUNIT_ASSERT_EQUAL(maGray
, aBColorModifier
->getModifiedColor(maGray
));
97 CPPUNIT_ASSERT_EQUAL(maWhite
, aBColorModifier
->getModifiedColor(maBlack
));
98 CPPUNIT_ASSERT_EQUAL(maRed
, aBColorModifier
->getModifiedColor(maCyan
));
99 CPPUNIT_ASSERT_EQUAL(maCyan
, aBColorModifier
->getModifiedColor(maRed
));
100 CPPUNIT_ASSERT_EQUAL(maGreen
, aBColorModifier
->getModifiedColor(maMagenta
));
101 CPPUNIT_ASSERT_EQUAL(maMagenta
, aBColorModifier
->getModifiedColor(maGreen
));
102 CPPUNIT_ASSERT_EQUAL(maBlue
, aBColorModifier
->getModifiedColor(maYellow
));
103 CPPUNIT_ASSERT_EQUAL(maYellow
, aBColorModifier
->getModifiedColor(maBlue
));
104 CPPUNIT_ASSERT_EQUAL(BColor(.8, .7, .6),
105 aBColorModifier
->getModifiedColor(BColor(.2, .3, .4)));
107 CPPUNIT_ASSERT(aBColorModifier
->operator==(*aBColorModifier
));
108 const basegfx::BColorModifierSharedPtr aBColorModifierGray
109 = std::make_shared
<basegfx::BColorModifier_gray
>();
110 CPPUNIT_ASSERT(*aBColorModifier
!= *aBColorModifierGray
);
112 const basegfx::BColorModifierSharedPtr aBColorModifier2
113 = std::make_shared
<basegfx::BColorModifier_invert
>();
114 CPPUNIT_ASSERT(aBColorModifier
->operator==(*aBColorModifier2
));
119 const basegfx::BColorModifierSharedPtr aBColorModifierRed
120 = std::make_shared
<basegfx::BColorModifier_replace
>(maRed
);
121 CPPUNIT_ASSERT_EQUAL(maRed
, aBColorModifierRed
->getModifiedColor(maCyan
));
122 CPPUNIT_ASSERT_EQUAL(maRed
, aBColorModifierRed
->getModifiedColor(maRed
));
123 CPPUNIT_ASSERT_EQUAL(maRed
, aBColorModifierRed
->getModifiedColor(maMagenta
));
124 CPPUNIT_ASSERT_EQUAL(maRed
, aBColorModifierRed
->getModifiedColor(maGreen
));
126 const basegfx::BColorModifierSharedPtr aBColorModifierBlack
127 = std::make_shared
<basegfx::BColorModifier_replace
>(maBlack
);
129 CPPUNIT_ASSERT_EQUAL(maBlack
, aBColorModifierBlack
->getModifiedColor(maCyan
));
130 CPPUNIT_ASSERT_EQUAL(maBlack
, aBColorModifierBlack
->getModifiedColor(maRed
));
131 CPPUNIT_ASSERT_EQUAL(maBlack
, aBColorModifierBlack
->getModifiedColor(maMagenta
));
132 CPPUNIT_ASSERT_EQUAL(maBlack
, aBColorModifierBlack
->getModifiedColor(maGreen
));
134 CPPUNIT_ASSERT(aBColorModifierRed
->operator==(*aBColorModifierRed
));
135 CPPUNIT_ASSERT(aBColorModifierBlack
->operator==(*aBColorModifierBlack
));
136 CPPUNIT_ASSERT(*aBColorModifierRed
!= *aBColorModifierBlack
);
138 const basegfx::BColorModifierSharedPtr aBColorModifierGray
139 = std::make_shared
<basegfx::BColorModifier_gray
>();
140 CPPUNIT_ASSERT(*aBColorModifierRed
!= *aBColorModifierGray
);
145 BColorModifierStack aStack1
;
146 sal_uInt32 expected
= 0;
147 CPPUNIT_ASSERT_EQUAL(expected
, aStack1
.count());
148 CPPUNIT_ASSERT_EQUAL(maRed
, aStack1
.getModifiedColor(maRed
));
149 CPPUNIT_ASSERT_EQUAL(maWhite
, aStack1
.getModifiedColor(maWhite
));
150 CPPUNIT_ASSERT_EQUAL(maBlue
, aStack1
.getModifiedColor(maBlue
));
152 aStack1
.push(std::make_shared
<basegfx::BColorModifier_invert
>());
154 CPPUNIT_ASSERT_EQUAL(expected
, aStack1
.count());
155 CPPUNIT_ASSERT_EQUAL(maCyan
, aStack1
.getModifiedColor(maRed
));
156 CPPUNIT_ASSERT_EQUAL(maBlack
, aStack1
.getModifiedColor(maWhite
));
157 CPPUNIT_ASSERT_EQUAL(maYellow
, aStack1
.getModifiedColor(maBlue
));
159 aStack1
.push(std::make_shared
<basegfx::BColorModifier_gray
>());
161 CPPUNIT_ASSERT_EQUAL(expected
, aStack1
.count());
162 BColor
aInvertedGrayedRed(1 - (77.0 / 256.0), 1 - (77.0 / 256.0), 1 - (77.0 / 256.0));
163 BColor
aInvertedGrayedBlue(1 - (28.0 / 256.0), 1 - (28.0 / 256.0), 1 - (28.0 / 256.0));
164 CPPUNIT_ASSERT_EQUAL(aInvertedGrayedRed
, aStack1
.getModifiedColor(maRed
));
165 CPPUNIT_ASSERT_EQUAL(maBlack
, aStack1
.getModifiedColor(maWhite
));
166 CPPUNIT_ASSERT_EQUAL(aInvertedGrayedBlue
, aStack1
.getModifiedColor(maBlue
));
170 CPPUNIT_ASSERT_EQUAL(expected
, aStack1
.count());
171 CPPUNIT_ASSERT_EQUAL(maCyan
, aStack1
.getModifiedColor(maRed
));
172 CPPUNIT_ASSERT_EQUAL(maBlack
, aStack1
.getModifiedColor(maWhite
));
173 CPPUNIT_ASSERT_EQUAL(maYellow
, aStack1
.getModifiedColor(maBlue
));
178 const basegfx::BColorModifierSharedPtr aBColorModifier
179 = std::make_shared
<basegfx::BColorModifier_saturate
>(0.5);
181 CPPUNIT_ASSERT_EQUAL(maWhite
, aBColorModifier
->getModifiedColor(maWhite
));
182 CPPUNIT_ASSERT_EQUAL(maGray
, aBColorModifier
->getModifiedColor(maGray
));
183 CPPUNIT_ASSERT_EQUAL(maBlack
, aBColorModifier
->getModifiedColor(maBlack
));
185 BColor
aExpectedRed(0.6065, 0.1065, 0.1065);
186 CPPUNIT_ASSERT_EQUAL(aExpectedRed
, aBColorModifier
->getModifiedColor(maRed
));
187 BColor
aExpectedGreen(0.3575, 0.8575, 0.3575);
188 CPPUNIT_ASSERT_EQUAL(aExpectedGreen
, aBColorModifier
->getModifiedColor(maGreen
));
189 BColor
aExpectedBlue(0.036, 0.036, 0.536);
190 CPPUNIT_ASSERT_EQUAL(aExpectedBlue
, aBColorModifier
->getModifiedColor(maBlue
));
191 BColor
aExpectedYellow(0.964, 0.964, 0.464);
192 CPPUNIT_ASSERT_EQUAL(aExpectedYellow
, aBColorModifier
->getModifiedColor(maYellow
));
193 BColor
aExpectedMagenta(0.6425, 0.1425, 0.6425);
194 CPPUNIT_ASSERT_EQUAL(aExpectedMagenta
, aBColorModifier
->getModifiedColor(maMagenta
));
195 BColor
aExpectedCyan(0.3935, 0.8935, 0.8935);
196 CPPUNIT_ASSERT_EQUAL(aExpectedCyan
, aBColorModifier
->getModifiedColor(maCyan
));
198 CPPUNIT_ASSERT(aBColorModifier
->operator==(*aBColorModifier
));
199 const basegfx::BColorModifierSharedPtr aBColorModifierInvert
200 = std::make_shared
<basegfx::BColorModifier_invert
>();
201 CPPUNIT_ASSERT(*aBColorModifier
!= *aBColorModifierInvert
);
203 const basegfx::BColorModifierSharedPtr aBColorModifier2
204 = std::make_shared
<basegfx::BColorModifier_saturate
>(0.5);
205 CPPUNIT_ASSERT(aBColorModifier
->operator==(*aBColorModifier2
));
208 void testLuminanceToAlpha()
210 const basegfx::BColorModifierSharedPtr aBColorModifier
211 = std::make_shared
<basegfx::BColorModifier_luminance_to_alpha
>();
213 CPPUNIT_ASSERT_EQUAL(maBlack
, aBColorModifier
->getModifiedColor(maWhite
));
214 CPPUNIT_ASSERT_EQUAL(maGray
, aBColorModifier
->getModifiedColor(maGray
));
215 CPPUNIT_ASSERT_EQUAL(maWhite
, aBColorModifier
->getModifiedColor(maBlack
));
217 BColor
aExpectedRed(0.7875, 0.7875, 0.7875);
218 CPPUNIT_ASSERT_EQUAL(aExpectedRed
, aBColorModifier
->getModifiedColor(maRed
));
219 BColor
aExpectedGreen(0.2846, 0.2846, 0.2846);
220 CPPUNIT_ASSERT_EQUAL(aExpectedGreen
, aBColorModifier
->getModifiedColor(maGreen
));
221 BColor
aExpectedBlue(0.9279, 0.9279, 0.9279);
222 CPPUNIT_ASSERT_EQUAL(aExpectedBlue
, aBColorModifier
->getModifiedColor(maBlue
));
223 BColor
aExpectedYellow(0.0721, 0.0721, 0.0721);
224 CPPUNIT_ASSERT_EQUAL(aExpectedYellow
, aBColorModifier
->getModifiedColor(maYellow
));
225 BColor
aExpectedMagenta(0.7154, 0.7154, 0.7154);
226 CPPUNIT_ASSERT_EQUAL(aExpectedMagenta
, aBColorModifier
->getModifiedColor(maMagenta
));
227 BColor
aExpectedCyan(0.2125, 0.2125, 0.2125);
228 CPPUNIT_ASSERT_EQUAL(aExpectedCyan
, aBColorModifier
->getModifiedColor(maCyan
));
230 CPPUNIT_ASSERT(aBColorModifier
->operator==(*aBColorModifier
));
231 const basegfx::BColorModifierSharedPtr aBColorModifierInvert
232 = std::make_shared
<basegfx::BColorModifier_invert
>();
233 CPPUNIT_ASSERT(*aBColorModifier
!= *aBColorModifierInvert
);
235 const basegfx::BColorModifierSharedPtr aBColorModifier2
236 = std::make_shared
<basegfx::BColorModifier_luminance_to_alpha
>();
237 CPPUNIT_ASSERT(aBColorModifier
->operator==(*aBColorModifier2
));
242 const basegfx::BColorModifierSharedPtr aBColorModifier
243 = std::make_shared
<basegfx::BColorModifier_hueRotate
>(basegfx::deg2rad(180.0));
245 CPPUNIT_ASSERT_EQUAL(maWhite
, aBColorModifier
->getModifiedColor(maWhite
));
246 CPPUNIT_ASSERT_EQUAL(maGray
, aBColorModifier
->getModifiedColor(maGray
));
247 CPPUNIT_ASSERT_EQUAL(maBlack
, aBColorModifier
->getModifiedColor(maBlack
));
249 BColor
aExpectedRed(0.0, 0.426, 0.426);
250 CPPUNIT_ASSERT_EQUAL(aExpectedRed
, aBColorModifier
->getModifiedColor(maRed
));
251 BColor
aExpectedGreen(1.0, 0.43, 1.0);
252 CPPUNIT_ASSERT_EQUAL(aExpectedGreen
, aBColorModifier
->getModifiedColor(maGreen
));
253 BColor
aExpectedBlue(0.144, 0.144, 0);
254 CPPUNIT_ASSERT_EQUAL(aExpectedBlue
, aBColorModifier
->getModifiedColor(maBlue
));
255 BColor
aExpectedYellow(0.856, 0.856, 1.0);
256 CPPUNIT_ASSERT_EQUAL(aExpectedYellow
, aBColorModifier
->getModifiedColor(maYellow
));
257 BColor
aExpectedMagenta(0.0, 0.57, 0.0);
258 CPPUNIT_ASSERT_EQUAL(aExpectedMagenta
, aBColorModifier
->getModifiedColor(maMagenta
));
259 BColor
aExpectedCyan(1.0, 0.574, 0.574);
260 CPPUNIT_ASSERT_EQUAL(aExpectedCyan
, aBColorModifier
->getModifiedColor(maCyan
));
262 CPPUNIT_ASSERT(aBColorModifier
->operator==(*aBColorModifier
));
263 const basegfx::BColorModifierSharedPtr aBColorModifierInvert
264 = std::make_shared
<basegfx::BColorModifier_invert
>();
265 CPPUNIT_ASSERT(*aBColorModifier
!= *aBColorModifierInvert
);
267 const basegfx::BColorModifierSharedPtr aBColorModifier2
268 = std::make_shared
<basegfx::BColorModifier_hueRotate
>(basegfx::deg2rad(180.0));
269 CPPUNIT_ASSERT(aBColorModifier
->operator==(*aBColorModifier2
));
276 std::vector
<double> aVector
= {0.0, 0.0, 0.0, 0.0, 0.0,
277 1.0, 1.0, 1.0, 1.0, 0.0,
278 0.0, 0.0, 0.0, 0.0, 0.0,
279 0.0, 0.0, 0.0, 1.0, 0.0};
282 const basegfx::BColorModifierSharedPtr aBColorModifier
283 = std::make_shared
<basegfx::BColorModifier_matrix
>(aVector
);
285 CPPUNIT_ASSERT_EQUAL(maGreen
, aBColorModifier
->getModifiedColor(maWhite
));
286 CPPUNIT_ASSERT_EQUAL(maGreen
, aBColorModifier
->getModifiedColor(maGray
));
287 CPPUNIT_ASSERT_EQUAL(maGreen
, aBColorModifier
->getModifiedColor(maBlack
));
289 CPPUNIT_ASSERT_EQUAL(maGreen
, aBColorModifier
->getModifiedColor(maRed
));
290 CPPUNIT_ASSERT_EQUAL(maGreen
, aBColorModifier
->getModifiedColor(maGreen
));
291 CPPUNIT_ASSERT_EQUAL(maGreen
, aBColorModifier
->getModifiedColor(maBlue
));
292 CPPUNIT_ASSERT_EQUAL(maGreen
, aBColorModifier
->getModifiedColor(maYellow
));
293 CPPUNIT_ASSERT_EQUAL(maGreen
, aBColorModifier
->getModifiedColor(maMagenta
));
294 CPPUNIT_ASSERT_EQUAL(maGreen
, aBColorModifier
->getModifiedColor(maCyan
));
296 CPPUNIT_ASSERT(aBColorModifier
->operator==(*aBColorModifier
));
297 const basegfx::BColorModifierSharedPtr aBColorModifierInvert
298 = std::make_shared
<basegfx::BColorModifier_invert
>();
299 CPPUNIT_ASSERT(*aBColorModifier
!= *aBColorModifierInvert
);
301 const basegfx::BColorModifierSharedPtr aBColorModifier2
302 = std::make_shared
<basegfx::BColorModifier_matrix
>(aVector
);
303 CPPUNIT_ASSERT(aBColorModifier
->operator==(*aBColorModifier2
));
306 void testMatrixShift()
309 std::vector
<double> aVector
= {0.0, 0.0, 0.0, 0.0, 0.0,
310 0.0, 0.0, 0.0, 0.0, 1.0,
311 0.0, 0.0, 0.0, 0.0, 0.0,
312 0.0, 0.0, 0.0, 1.0, 0.0};
315 const basegfx::BColorModifierSharedPtr aBColorModifier
316 = std::make_shared
<basegfx::BColorModifier_matrix
>(aVector
);
318 CPPUNIT_ASSERT_EQUAL(maGreen
, aBColorModifier
->getModifiedColor(maWhite
));
319 CPPUNIT_ASSERT_EQUAL(maGreen
, aBColorModifier
->getModifiedColor(maGray
));
320 CPPUNIT_ASSERT_EQUAL(maGreen
, aBColorModifier
->getModifiedColor(maBlack
));
322 CPPUNIT_ASSERT_EQUAL(maGreen
, aBColorModifier
->getModifiedColor(maRed
));
323 CPPUNIT_ASSERT_EQUAL(maGreen
, aBColorModifier
->getModifiedColor(maGreen
));
324 CPPUNIT_ASSERT_EQUAL(maGreen
, aBColorModifier
->getModifiedColor(maBlue
));
325 CPPUNIT_ASSERT_EQUAL(maGreen
, aBColorModifier
->getModifiedColor(maYellow
));
326 CPPUNIT_ASSERT_EQUAL(maGreen
, aBColorModifier
->getModifiedColor(maMagenta
));
327 CPPUNIT_ASSERT_EQUAL(maGreen
, aBColorModifier
->getModifiedColor(maCyan
));
329 CPPUNIT_ASSERT(aBColorModifier
->operator==(*aBColorModifier
));
330 const basegfx::BColorModifierSharedPtr aBColorModifierInvert
331 = std::make_shared
<basegfx::BColorModifier_invert
>();
332 CPPUNIT_ASSERT(*aBColorModifier
!= *aBColorModifierInvert
);
334 const basegfx::BColorModifierSharedPtr aBColorModifier2
335 = std::make_shared
<basegfx::BColorModifier_matrix
>(aVector
);
336 CPPUNIT_ASSERT(aBColorModifier
->operator==(*aBColorModifier2
));
339 void testIdentityMatrix()
342 std::vector
<double> aVector
= {1.0, 0.0, 0.0, 0.0, 0.0,
343 0.0, 1.0, 0.0, 0.0, 0.0,
344 0.0, 0.0, 1.0, 0.0, 0.0,
345 0.0, 1.0, 0.0, 1.0, 0.0};
348 const basegfx::BColorModifierSharedPtr aBColorModifier
349 = std::make_shared
<basegfx::BColorModifier_matrix
>(aVector
);
351 CPPUNIT_ASSERT_EQUAL(maWhite
, aBColorModifier
->getModifiedColor(maWhite
));
352 CPPUNIT_ASSERT_EQUAL(maGray
, aBColorModifier
->getModifiedColor(maGray
));
353 CPPUNIT_ASSERT_EQUAL(maBlack
, aBColorModifier
->getModifiedColor(maBlack
));
355 CPPUNIT_ASSERT_EQUAL(maRed
, aBColorModifier
->getModifiedColor(maRed
));
356 CPPUNIT_ASSERT_EQUAL(maGreen
, aBColorModifier
->getModifiedColor(maGreen
));
357 CPPUNIT_ASSERT_EQUAL(maBlue
, aBColorModifier
->getModifiedColor(maBlue
));
358 CPPUNIT_ASSERT_EQUAL(maYellow
, aBColorModifier
->getModifiedColor(maYellow
));
359 CPPUNIT_ASSERT_EQUAL(maMagenta
, aBColorModifier
->getModifiedColor(maMagenta
));
360 CPPUNIT_ASSERT_EQUAL(maCyan
, aBColorModifier
->getModifiedColor(maCyan
));
362 CPPUNIT_ASSERT(aBColorModifier
->operator==(*aBColorModifier
));
363 const basegfx::BColorModifierSharedPtr aBColorModifierInvert
364 = std::make_shared
<basegfx::BColorModifier_invert
>();
365 CPPUNIT_ASSERT(*aBColorModifier
!= *aBColorModifierInvert
);
367 const basegfx::BColorModifierSharedPtr aBColorModifier2
368 = std::make_shared
<basegfx::BColorModifier_matrix
>(aVector
);
369 CPPUNIT_ASSERT(aBColorModifier
->operator==(*aBColorModifier2
));
372 void testBlackAndWhite()
374 const basegfx::BColorModifierSharedPtr aBColorModifier
375 = std::make_shared
<basegfx::BColorModifier_black_and_white
>(0.5);
377 CPPUNIT_ASSERT_EQUAL(maWhite
, aBColorModifier
->getModifiedColor(maWhite
));
378 CPPUNIT_ASSERT_EQUAL(maWhite
, aBColorModifier
->getModifiedColor(maGray
));
379 CPPUNIT_ASSERT_EQUAL(maBlack
, aBColorModifier
->getModifiedColor(maBlack
));
381 CPPUNIT_ASSERT_EQUAL(maBlack
, aBColorModifier
->getModifiedColor(maRed
));
382 CPPUNIT_ASSERT_EQUAL(maWhite
, aBColorModifier
->getModifiedColor(maGreen
));
383 CPPUNIT_ASSERT_EQUAL(maBlack
, aBColorModifier
->getModifiedColor(maBlue
));
384 CPPUNIT_ASSERT_EQUAL(maWhite
, aBColorModifier
->getModifiedColor(maYellow
));
385 CPPUNIT_ASSERT_EQUAL(maBlack
, aBColorModifier
->getModifiedColor(maMagenta
));
386 CPPUNIT_ASSERT_EQUAL(maWhite
, aBColorModifier
->getModifiedColor(maCyan
));
388 CPPUNIT_ASSERT(aBColorModifier
->operator==(*aBColorModifier
));
389 const basegfx::BColorModifierSharedPtr aBColorModifierInvert
390 = std::make_shared
<basegfx::BColorModifier_invert
>();
391 CPPUNIT_ASSERT(*aBColorModifier
!= *aBColorModifierInvert
);
393 const basegfx::BColorModifierSharedPtr aBColorModifier2
394 = std::make_shared
<basegfx::BColorModifier_black_and_white
>(0.5);
395 CPPUNIT_ASSERT(aBColorModifier
->operator==(*aBColorModifier2
));
398 CPPUNIT_TEST_SUITE(bcolormodifier
);
399 CPPUNIT_TEST(testGray
);
400 CPPUNIT_TEST(testInvert
);
401 CPPUNIT_TEST(testReplace
);
402 CPPUNIT_TEST(testStack
);
403 CPPUNIT_TEST(testSaturate
);
404 CPPUNIT_TEST(testLuminanceToAlpha
);
405 CPPUNIT_TEST(testHueRotate
);
406 CPPUNIT_TEST(testMatrix
);
407 CPPUNIT_TEST(testMatrixShift
);
408 CPPUNIT_TEST(testIdentityMatrix
);
409 CPPUNIT_TEST(testBlackAndWhite
);
410 CPPUNIT_TEST_SUITE_END();
413 } // namespace basegfx
415 CPPUNIT_TEST_SUITE_REGISTRATION(basegfx::bcolormodifier
);
417 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */