MRaster examples 21.0.0.0
Image Processing Library
Loading...
Searching...
No Matches
utest_colorTpl.cpp
Go to the documentation of this file.
1// -*- Mode:C++; Coding:us-ascii-unix; fill-column:158 -*-
2/*******************************************************************************************************************************************************.H.S.**/
3/**
4 @file utest_colorTpl.cpp
5 @author Mitch Richling http://www.mitchr.me/
6 @date 2022-08-11
7 @brief Unit tests for basic color methods.@EOL
8 @keywords boost
9 @std C++20
10 @copyright
11 @parblock
12 Copyright (c) 2022, Mitchell Jay Richling <http://www.mitchr.me/> All rights reserved.
13
14 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
15
16 1. Redistributions of source code must retain the above copyright notice, this list of conditions, and the following disclaimer.
17
18 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions, and the following disclaimer in the documentation
19 and/or other materials provided with the distribution.
20
21 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software
22 without specific prior written permission.
23
24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
26 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
29 DAMAGE.
30 @endparblock
31*/
32/*******************************************************************************************************************************************************.H.E.**/
33/** @cond exj */
34
35#define BOOST_TEST_DYN_LINK
36#define BOOST_TEST_MODULE Main
37#include <boost/test/unit_test.hpp>
38
39#define BOOST_TEST_DYN_LINK
40#ifdef STAND_ALONE
41# define BOOST_TEST_MODULE Main
42#endif
43#include <boost/test/unit_test.hpp>
44
45#include "ramCanvas.hpp"
46
47// |----------+--------------------------------------------------------------------------------------------------------------|
48// | Coverage | Method |
49// |----------+--------------------------------------------------------------------------------------------------------------|
50// | DIRECT | colorTpl(); |
51// | DIRECT | colorTpl(const colorType& aColor); |
52// | DIRECT | colorTpl(clrChanT c1, clrChanT c2, clrChanT c3, clrChanT c4); |
53// | DIRECT | colorTpl(clrChanT c1, clrChanT c2, clrChanT c3); |
54// | DIRECT | colorTpl(clrChanT c1, clrChanT c2); |
55// | DIRECT | colorTpl(clrChanT cVal); |
56// | DIRECT | colorTpl(cornerColorEnum cornerColor); |
57// | DIRECT | colorTpl(std::string colorString); |
58// | DIRECT | colorTpl(const char* colorCString); |
59// | INDIRECT | ~colorTpl(); |
60// |----------+--------------------------------------------------------------------------------------------------------------|
61// | INDIRECT | colorTpl& copy(colorArgType aCol); |
62// |----------+--------------------------------------------------------------------------------------------------------------|
63// | DIRECT | getC0() const; |
64// | DIRECT | getC1() const; |
65// | DIRECT | getC2() const; |
66// | DIRECT | getC3() const; |
67// | DIRECT | getChan(int chan) const; |
68// | DIRECT | setC0(clrChanT cVal); |
69// | DIRECT | setC1(clrChanT cVal); |
70// | DIRECT | setC2(clrChanT cVal); |
71// | DIRECT | setC3(clrChanT cVal); |
72// | DIRECT | setChan(int chan, clrChanT cVal); |
73// | INDIRECT | setChanToMax(int chan); |
74// | INDIRECT | setChanToMin(int chan); |
75// | DIRECT | setChans(clrChanT c1, clrChanT c2, clrChanT c3, clrChanT c4); |
76// | DIRECT | setChans(clrChanT c1, clrChanT c2, clrChanT c3); |
77// | DIRECT | setChans(clrChanT c1, clrChanT c2); |
78// | DIRECT | setChans(clrChanT cVal); |
79// | INDIRECT | setChans(std::tuple<clrChanT, clrChanT, clrChanT, clrChanT> chanValues); |
80// | INDIRECT | setChans(std::tuple<clrChanT, clrChanT, clrChanT> chanValues); |
81// | | setChans(std::vector<clrChanT>& chanValues); |
82// | DIRECT | setChans(std::string colorHexString, bool clearUndefinedChannels = false); |
83// |----------+--------------------------------------------------------------------------------------------------------------|
84// | DIRECT | getC0_dbl() const; |
85// | DIRECT | getC1_dbl() const; |
86// | DIRECT | getC2_dbl() const; |
87// | DIRECT | getC3_dbl() const; |
88// | DIRECT | getChan_dbl(int chan) const; |
89// | DIRECT | setChan_dbl(int chan, double cVal); |
90// | DIRECT | setC0_dbl(double cVal); |
91// | DIRECT | setC1_dbl(double cVal); |
92// | DIRECT | setC2_dbl(double cVal); |
93// | DIRECT | setC3_dbl(double cVal); |
94// | DIRECT | setChans_dbl(double c1, double c2, double c3, double c4); |
95// | DIRECT | setChans_dbl(double c1, double c2, double c3); |
96// | DIRECT | setChans_dbl(double c1, double c2); |
97// | DIRECT | setChans_dbl(double cVal); |
98// |----------+--------------------------------------------------------------------------------------------------------------|
99// | DIRECT | bestRedChan() |
100// | DIRECT | bestGreenChan() |
101// | DIRECT | bestBlueChan() |
102// | DIRECT | bestAlphaChan() |
103// |----------+--------------------------------------------------------------------------------------------------------------|
104// | DIRECT | setChans_dbl(colConALLdbl dblColor) |
105// | DIRECT | setChans_byte(colConALLbyte byteColor) |
106// | DIRECT | setChansRGBA_dbl(colConRGBAdbl dblColor) |
107// | DIRECT | setChansRGB_dbl(colConRGBdbl dblColor) |
108// | DIRECT | setChansRGBA_byte(colConRGBAbyte byteColor) |
109// | DIRECT | setChansRGB_byte(colConRGBbyte byteColor) |
110// | DIRECT | getColCon_dbl() |
111// | DIRECT | getColCon_byte() |
112// | DIRECT | getColConRGBA_dbl() |
113// | DIRECT | getColConRGB_dbl() |
114// | DIRECT | getColConRGBA_byte() |
115// | DIRECT | getColConRGB_byte() |
116// |----------+--------------------------------------------------------------------------------------------------------------|
117// | DIRECT | getC0_byte() const; |
118// | DIRECT | getC1_byte() const; |
119// | DIRECT | getC2_byte() const; |
120// | DIRECT | getC3_byte() const; |
121// | DIRECT | getChan_byte(int chan) const; |
122// | DIRECT | setChan_byte(int chan, uint8_t cVal); |
123// | DIRECT | setC0_byte(uint8_t cVal); |
124// | DIRECT | setC1_byte(uint8_t cVal); |
125// | DIRECT | setC2_byte(uint8_t cVal); |
126// | DIRECT | setC3_byte(uint8_t cVal); |
127// | DIRECT | setChans_byte(uint8_t c1, uint8_t c2, uint8_t c3, uint8_t c4); |
128// | DIRECT | setChans_byte(uint8_t c1, uint8_t c2, uint8_t c3); |
129// | DIRECT | setChans_byte(uint8_t c1, uint8_t c2); |
130// | DIRECT | setChans_byte(uint8_t cVal); |
131// |----------+--------------------------------------------------------------------------------------------------------------|
132// | DIRECT | setToBlack(); |
133// | DIRECT | setToWhite(); |
134// | DIRECT | setToRed(); |
135// | DIRECT | setToBlue(); |
136// | DIRECT | setToGreen(); |
137// | DIRECT | setToCyan(); |
138// | DIRECT | setToYellow(); |
139// | DIRECT | setToMagenta(); |
140// | DIRECT | setToCorner(char cornerColor); |
141// | DIRECT | setToCorner(cornerColorEnum cornerColor); |
142// | DIRECT | setToCorner(std::string cornerColor); |
143// |----------+--------------------------------------------------------------------------------------------------------------|
144// | DIRECT | setRGBAfromLogPackIntABGR(packed4Cint anInt) |
145// | DIRECT | setRGBfromLogPackIntABGR( packed4Cint anInt) |
146// | DIRECT | setRGBAfromLogPackIntARGB(packed4Cint anInt) |
147// | DIRECT | setRGBfromLogPackIntARGB( packed4Cint anInt) |
148// | DIRECT | setRGBAfromLogPackIntRGBA(packed4Cint anInt) |
149// | DIRECT | setRGBfromLogPackIntRGBA( packed4Cint anInt) |
150// | DIRECT | setRGBAfromLogPackIntABRG(packed4Cint anInt) |
151// | DIRECT | setRGBfromLogPackIntABRG( packed4Cint anInt) |
152// | DIRECT | setRGBAfromLogPackIntBGRA(packed4Cint anInt) |
153// | DIRECT | setRGBfromLogPackIntBGRA( packed4Cint anInt) |
154// | INDIRECT | setRGBAfromLogPackIntGen(uint32_t anInt, uint8_t rIdx, uint8_t gIdx, uint8_t bIdx, uint8_t aIdx); |
155// | INDIRECT | setRGBfromLogPackIntGen(uint32_t anInt, uint8_t rIdx, uint8_t gIdx, uint8_t bIdx); |
156// | | setRGBAfromPackIntGen(uint32_t anInt, uint8_t rIdx, uint8_t gIdx, uint8_t bIdx, uint8_t aIdx); |
157// | | setRGBfromPackIntGen(uint32_t anInt, uint8_t rIdx, uint8_t gIdx, uint8_t bIdx); |
158// |----------+--------------------------------------------------------------------------------------------------------------|
159// | DIRECT | setRGBfromUnitHSV(double H, double S, double V); |
160// | DIRECT | setRGBfromUnitHSL(double H, double S, double L); |
161// | DIRECT | setRGBfromColorSpace(colorSpaceEnum space, double inCh1, double inCh2, double inCh3); |
162// | SIMILAR | setRGBfromColorSpace(colorSpaceEnum space, colorTpl<double, 3> inColor); |
163// | | interplColorSpace(colorSpaceEnum space, double aDouble, colorArgType col1, colorArgType col2); |
164// | DIRECT | rgb2colorSpace(colorSpaceEnum space); |
165// | | colorSpaceToString(colorSpaceEnum space); |
166// |----------+--------------------------------------------------------------------------------------------------------------|
167// | DIRECT | setRGBcmpGreyTGA16bit(uint16_t tga16val); |
168// | DIRECT | setRGBcmpGreyTGA24bit(uint32_t tga24val); |
169// |----------+--------------------------------------------------------------------------------------------------------------|
170// | DIRECT | setRGBfromWavelengthCM(double wavelength, cmfInterpolationEnum interpMethod = cmfInterpolationEnum::LINEAR); |
171// | DIRECT | setRGBfromWavelengthLA(double wavelength); |
172// |----------+--------------------------------------------------------------------------------------------------------------|
173// | | cmpGradiant(csFltType csX, std::vector<csFltType> const& anchors, std::vector<colorType> const& colors); |
174// | | cmpGradiant(csFltType csX, std::vector<colorType> const& colors); |
175// | INDIRECT | cmpGradiant(csFltType csX, csIntType numColors, const packed4Cint* colors) |
176// | DIRECT | cmpRGBcornerDGradiant(csIntType csIdx, const char *cornerColors); |
177// | INDIRECT | cmpRGBcornerDGradiant(csIntType csIdx, csIntType numColors, const ccT* cornerColors) |
178// | DIRECT | cmpRGBcornerCGradiant(csFltType csX, const char *cornerColors) { |
179// | INDIRECT | cmpRGBcornerCGradiant(csFltType csX, csIntType numColors, const ccT* cornerColors) |
180// |----------+--------------------------------------------------------------------------------------------------------------|
181// | DIRECT | wMean( 8 args |
182// | DIRECT | wMean( 6 args |
183// | DIRECT | wMean( 4 args |
184// | DIRECT | uMean( 7 args |
185// | DIRECT | uMean( 5 args |
186// | DIRECT | uMean( 3 args |
187// | DIRECT | linearInterpolate(double aDouble, colorArgType col1, colorArgType col2); |
188// |----------+--------------------------------------------------------------------------------------------------------------|
189// | DIRECT | tfrmOr(colorArgType aCol) No coverage for floating point clrChanT |
190// | DIRECT | tfrmNor(colorArgType aCol) No coverage for floating point clrChanT |
191// | DIRECT | tfrmAnd(colorArgType aCol) No coverage for floating point clrChanT |
192// | DIRECT | tfrmNand(colorArgType aCol) No coverage for floating point clrChanT |
193// | DIRECT | tfrmXor(colorArgType aCol) No coverage for floating point clrChanT |
194// | DIRECT | tfrmNxor(colorArgType aCol) No coverage for floating point clrChanT |
195// | DIRECT | tfrmNot(void) No coverage for floating point clrChanT |
196// |----------+--------------------------------------------------------------------------------------------------------------|
197// | DIRECT | tfrmSqDiff(colorArgType aCol); |
198// | DIRECT | tfrmAbsDiff(colorArgType aCol); |
199// | DIRECT | tfrmAdd(colorArgType aCol); |
200// | DIRECT | tfrmDiv(colorArgType aCol); |
201// | DIRECT | tfrmMult(colorArgType aCol); |
202// | DIRECT | tfrmMultClamp(colorArgType aCol); |
203// | DIRECT | tfrmSignDiff(colorArgType aCol); |
204// | DIRECT | tfrmDiffClamp(colorArgType aCol); |
205// | DIRECT | tfrmNegDiffClamp(colorArgType aCol); |
206// | DIRECT | tfrmAddClamp(colorArgType aCol); |
207// | DIRECT | tfrmAddDivClamp(colorArgType aCol, colorArgType dCol); |
208// | DIRECT | tfrmDiff(colorArgType aCol); |
209// | DIRECT | tfrmMod(colorArgType aCol) |
210// | DIRECT | tfrmInvert(); |
211// | DIRECT | tfrmMix(double aDouble, colorArgType tooCol); |
212// |----------+--------------------------------------------------------------------------------------------------------------|
213// | DIRECT | tfrmCopy(colorArgType aCol); |
214// | DIRECT | tfrmMaxI(colorArgType aCol); |
215// | DIRECT | tfrmMinI(colorArgType aCol); |
216// | DIRECT | tfrmMax(colorArgType aCol); |
217// | DIRECT | tfrmMin(colorArgType aCol); |
218// | DIRECT | tfrmShiftL(colorArgType aCol) |
219// | DIRECT | tfrmShiftR(colorArgType aCol) |
220// | DIRECT | tfrmSaw(colorArgType lowCol, colorArgType highCol); |
221// | DIRECT | tfrmStep(colorArgType lowCol, colorArgType highCol); |
222// | DIRECT | tfrmDiracTot(colorArgType aCol); |
223// | DIRECT | tfrmDirac(colorArgType aCol); |
224// | DIRECT | tfrmFuzzyDirac(colorArgType ctrCol, colorArgType radCol); |
225// | DIRECT | tfrmMean(colorArgType aCol); |
226// | DIRECT | tfrmGmean(colorArgType aCol); |
227// | DIRECT | tfrmGmeanClamp(colorArgType aCol); |
228// | DIRECT | tfrmGreyScaleRGB(void); |
229// | DIRECT | tfrmWebSafeRGB(); |
230// |----------+--------------------------------------------------------------------------------------------------------------|
231// | DIRECT | tfrmLinearGreyLevelScale(double c, double b); |
232// | DIRECT | tfrmLinearGreyLevelScaleRGB(double rc, double rb, double gc, double gb, double bc, double bb); |
233// |----------+--------------------------------------------------------------------------------------------------------------|
234// | DIRECT | tfrmStdPow(double p); |
235// | DIRECT | tfrmStdPowRGB(double rp, double gp, double bp); |
236// | DIRECT | tfrmStdPowSqr(void); |
237// | DIRECT | tfrmStdPowSqrt(void); |
238// | DIRECT | tfrmLn(); |
239// |----------+--------------------------------------------------------------------------------------------------------------|
240// | DIRECT | rgb2GreyDotProd(channelArithSDPType redWt, channelArithSDPType greenWt, channelArithSDPType blueWt); |
241// | DIRECT | luminanceRGB(void); |
242// | DIRECT | intensityRGB(void); |
243// | DIRECT | intensity(void); |
244// | DIRECT | intensityScaledRGB(void); |
245// | DIRECT | intensityScaled(void); |
246// |----------+--------------------------------------------------------------------------------------------------------------|
247// | DIRECT | getMaxC(); |
248// | DIRECT | getMinC(); |
249// | DIRECT | getMaxRGB(); |
250// | DIRECT | getMinRGB(); |
251// |----------+--------------------------------------------------------------------------------------------------------------|
252// | DIRECT | dotProd(colorArgType aColor); |
253// | DIRECT | distHypot(colorArgType aColor); |
254// | DIRECT | distSumAbs(colorArgType aColor); |
255// | DIRECT | distMaxAbs(colorArgType aColor); |
256// | DIRECT | distDeltaE1976(colorArgType aColor); |
257// | DIRECT | distDeltaE1994(colorArgType aColor); |
258// |----------+--------------------------------------------------------------------------------------------------------------|
259// | DIRECT | isEqual(colorArgType aColor); |
260// | DIRECT | isEqualRGB(colorArgType aColor); |
261// | DIRECT | isClose |
262// | DIRECT | isCloseRGB |
263// | DIRECT | isNotEqual(colorArgType aColor); |
264// | DIRECT | isBlack(); |
265// | DIRECT | isBlackRGB(); |
266// |----------+--------------------------------------------------------------------------------------------------------------|
267// | INDIRECT | clampTop(iT arithValue); |
268// | INDIRECT | clampBot(iT arithValue); |
269// | INDIRECT | clampAll(iT arithValue); |
270// |----------+--------------------------------------------------------------------------------------------------------------|
271// | DIRECT | csBin01 |
272// | SIMILAR | csBinGB |
273// | SIMILAR | csBinRB |
274// | SIMILAR | csBinMC |
275// | SIMILAR | csBinYC |
276// | SIMILAR | csBinRG |
277// | SIMILAR | csBinMY |
278// |----------+--------------------------------------------------------------------------------------------------------------|
279// | INDIRECT | csBin_tpl |
280// |----------+--------------------------------------------------------------------------------------------------------------|
281// | SIMILAR | csCBAccent |
282// | SIMILAR | csCBBlues |
283// | SIMILAR | csCBBrBG |
284// | SIMILAR | csCBBuGn |
285// | SIMILAR | csCBBuPu |
286// | SIMILAR | csCBDark2 |
287// | SIMILAR | csCBGnBu |
288// | SIMILAR | csCBGreens |
289// | SIMILAR | csCBGreys |
290// | SIMILAR | csCBOrRd |
291// | SIMILAR | csCBOranges |
292// | SIMILAR | csCBPRGn |
293// | SIMILAR | csCBPaired |
294// | SIMILAR | csCBPastel1 |
295// | SIMILAR | csCBPastel2 |
296// | SIMILAR | csCBPiYG |
297// | SIMILAR | csCBPuBu |
298// | SIMILAR | csCBPuBuGn |
299// | SIMILAR | csCBPuOr |
300// | SIMILAR | csCBPuRd |
301// | SIMILAR | csCBPurples |
302// | SIMILAR | csCBRdBu |
303// | SIMILAR | csCBRdGy |
304// | SIMILAR | csCBRdPu |
305// | SIMILAR | csCBRdYlBu |
306// | SIMILAR | csCBRdYlGn |
307// | SIMILAR | csCBReds |
308// | SIMILAR | csCBSet1 |
309// | SIMILAR | csCBSet2 |
310// | SIMILAR | csCBSet3 |
311// | DIRECT | csCBSpectral |
312// | SIMILAR | csCBYlGn |
313// | SIMILAR | csCBYlGnBu |
314// | SIMILAR | csCBYlOrBr |
315// | SIMILAR | csCBYlOrRd |
316// |----------+--------------------------------------------------------------------------------------------------------------|
317// | INDIRECT | csCB_tpl |
318// |----------+--------------------------------------------------------------------------------------------------------------|
319// | INDIRECT | csCC_tpl |
320// |----------+--------------------------------------------------------------------------------------------------------------|
321// | SIMILAR | csCCconsOne |
322// | SIMILAR | csCCconsTwo |
323// | SIMILAR | csCCdiag01 |
324// | SIMILAR | csCCdiagCR |
325// | SIMILAR | csCCdiagMG |
326// | SIMILAR | csCCdiagYB |
327// | SIMILAR | csCColdeColdToHot |
328// | SIMILAR | csCColdeFireRamp |
329// | SIMILAR | csCColdeIceToWaterToHot |
330// | DIRECT | csCColdeRainbow |
331// | SIMILAR | csCCsumBGR |
332// | SIMILAR | csCCsumBRG |
333// | SIMILAR | csCCsumGBR |
334// | SIMILAR | csCCsumGRB |
335// | SIMILAR | csCCsumRBG |
336// | SIMILAR | csCCsumRGB |
337// | SIMILAR | csCCudBg |
338// | SIMILAR | csCCudBr |
339// | SIMILAR | csCCudGb |
340// | SIMILAR | csCCudGr |
341// | SIMILAR | csCCudRb |
342// | SIMILAR | csCCudRg |
343// |----------+--------------------------------------------------------------------------------------------------------------|
344// | DIRECT | csCHblu |
345// | DIRECT | csCHstd |
346// | DIRECT | csCHvio |
347// |----------+--------------------------------------------------------------------------------------------------------------|
348// | INDIRECT | csCubeHelix_tpl |
349// |----------+--------------------------------------------------------------------------------------------------------------|
350// | INDIRECT | csFP_tpl |
351// |----------+--------------------------------------------------------------------------------------------------------------|
352// | SIMILAR | csFPblAqGrYeOrReVi200 |
353// | DIRECT | csFPcircular12 |
354// | SIMILAR | csFPcircular24 |
355// | SIMILAR | csFPcmoceanAlgae |
356// | SIMILAR | csFPcmoceanAmp |
357// | SIMILAR | csFPcmoceanBalance |
358// | SIMILAR | csFPcmoceanCurl |
359// | SIMILAR | csFPcmoceanDeep |
360// | SIMILAR | csFPcmoceanDense |
361// | SIMILAR | csFPcmoceanHaline |
362// | SIMILAR | csFPcmoceanIce |
363// | SIMILAR | csFPcmoceanTempo |
364// | SIMILAR | csFPmplBrBG |
365// | SIMILAR | csFPmplOcean |
366// | SIMILAR | csFPmplOranges |
367// | SIMILAR | csFPneoDdivVegetationA |
368// | SIMILAR | csFPneoDivVegetationC |
369// | SIMILAR | csFPneoModisNdvi |
370// |----------+--------------------------------------------------------------------------------------------------------------|
371// | | csWS_tpl |
372// |----------+--------------------------------------------------------------------------------------------------------------|
373// | | csWSnormalVision |
374// | | csWSprotanopia |
375// | | csWSdeutanopia |
376// | | csWStritanoptia |
377// | | csWSprotanopiaAlt |
378// | | csWSdeutanopiaAlt |
379// | | csWStritanoptiaAlt |
380// |----------+--------------------------------------------------------------------------------------------------------------|
381// | DIRECT | csHSLhB |
382// | DIRECT | csHSLhC |
383// | DIRECT | csHSLhG |
384// | DIRECT | csHSLhM |
385// | DIRECT | csHSLhR |
386// | DIRECT | csHSLhY |
387// |----------+--------------------------------------------------------------------------------------------------------------|
388// | INDIRECT | csHSLh_tpl |
389// |----------+--------------------------------------------------------------------------------------------------------------|
390// | | csPGrey3x |
391// | | csPGrey4x |
392// |----------+--------------------------------------------------------------------------------------------------------------|
393// | DIRECT | csPLY_tpl |
394// |----------+--------------------------------------------------------------------------------------------------------------|
395// | INDIRECT | csPLYcividis |
396// | DIRECT | csPLYgrey |
397// | INDIRECT | csPLYhsvRB |
398// | INDIRECT | csPLYinferno |
399// | INDIRECT | csPLYmagma |
400// | INDIRECT | csPLYparula |
401// | INDIRECT | csPLYplasma |
402// | DIRECT | csPLYquad |
403// | INDIRECT | csPLYturbo |
404// | INDIRECT | csPLYviridis |
405// |----------+--------------------------------------------------------------------------------------------------------------|
406// | | csRainbowCM |
407// | | csRainbowLA |
408// |----------+--------------------------------------------------------------------------------------------------------------|
409// | DIRECT | setRGBfromWavelengthCM(double wavelength, cmfInterpolationEnum interpMethod = cmfInterpolationEnum::LINEAR); |
410// | DIRECT | setRGBfromWavelengthLA(double wavelength); |
411// |----------+--------------------------------------------------------------------------------------------------------------|
412
413
414////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
415BOOST_AUTO_TEST_CASE(set_chan_dbl_8) {
416
417 mjr::color4c8b aColor;
418
419 BOOST_TEST_CHECK(mjr::color4c8b::maxChanVal == 255);
420 BOOST_TEST_CHECK(mjr::color4c8b::minChanVal == 0);
421
422 aColor.setToBlack();
423 aColor.setChan_dbl(0, 1.0);
424 aColor.setChan_dbl(2, 1.0);
425
426 BOOST_TEST_CHECK(aColor.getChan(0) == mjr::color4c8b::maxChanVal);
427 BOOST_TEST_CHECK(aColor.getChan(1) == mjr::color4c8b::minChanVal);
428 BOOST_TEST_CHECK(aColor.getChan(2) == mjr::color4c8b::maxChanVal);
429 BOOST_TEST_CHECK(aColor.getChan(3) == mjr::color4c8b::minChanVal);
430
431 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
432 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
433 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
434 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
435
436 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 255);
437 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 0);
438 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 255);
439 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 0);
440
441 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
442 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
443 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
444 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
445
446 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == 1.0);
447 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == 0.0);
448 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == 1.0);
449 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == 0.0);
450
451 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == aColor.getC0_dbl(), boost::test_tools::tolerance(0.00001));
452 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == aColor.getC1_dbl(), boost::test_tools::tolerance(0.00001));
453 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == aColor.getC2_dbl(), boost::test_tools::tolerance(0.00001));
454 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == aColor.getC3_dbl(), boost::test_tools::tolerance(0.00001));
455
456 aColor.setChan_dbl(0, 0.0);
457
458 BOOST_TEST_CHECK(aColor.getChan(0) == mjr::color4c8b::minChanVal);
459 BOOST_TEST_CHECK(aColor.getChan(1) == mjr::color4c8b::minChanVal);
460 BOOST_TEST_CHECK(aColor.getChan(2) == mjr::color4c8b::maxChanVal);
461 BOOST_TEST_CHECK(aColor.getChan(3) == mjr::color4c8b::minChanVal);
462
463 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
464 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
465 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
466 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
467
468 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 0);
469 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 0);
470 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 255);
471 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 0);
472
473 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
474 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
475 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
476 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
477
478 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == 0.0);
479 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == 0.0);
480 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == 1.0);
481 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == 0.0);
482
483 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == aColor.getC0_dbl(), boost::test_tools::tolerance(0.00001));
484 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == aColor.getC1_dbl(), boost::test_tools::tolerance(0.00001));
485 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == aColor.getC2_dbl(), boost::test_tools::tolerance(0.00001));
486 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == aColor.getC3_dbl(), boost::test_tools::tolerance(0.00001));
487
488 aColor.setChansRGB_dbl(1.0, 1.0, 0.0);
489
490 BOOST_TEST_CHECK(aColor.getChan(0) == mjr::color4c8b::maxChanVal);
491 BOOST_TEST_CHECK(aColor.getChan(1) == mjr::color4c8b::maxChanVal);
492 BOOST_TEST_CHECK(aColor.getChan(2) == mjr::color4c8b::minChanVal);
493 BOOST_TEST_CHECK(aColor.getChan(3) == mjr::color4c8b::minChanVal);
494
495 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
496 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
497 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
498 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
499
500 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 255);
501 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 255);
502 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 0);
503 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 0);
504
505 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
506 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
507 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
508 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
509
510 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == 1.0);
511 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == 1.0);
512 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == 0.0);
513 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == 0.0);
514
515 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == aColor.getC0_dbl(), boost::test_tools::tolerance(0.00001));
516 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == aColor.getC1_dbl(), boost::test_tools::tolerance(0.00001));
517 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == aColor.getC2_dbl(), boost::test_tools::tolerance(0.00001));
518 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == aColor.getC3_dbl(), boost::test_tools::tolerance(0.00001));
519
520 aColor.setChan_dbl(1, 0.5);
521
522 BOOST_TEST_CHECK(aColor.getChan(0) == mjr::color4c8b::maxChanVal);
523 BOOST_TEST_CHECK(aColor.getChan(1) == 127);
524 BOOST_TEST_CHECK(aColor.getChan(2) == mjr::color4c8b::minChanVal);
525 BOOST_TEST_CHECK(aColor.getChan(3) == mjr::color4c8b::minChanVal);
526
527 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
528 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
529 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
530 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
531
532 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 255);
533 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 127);
534 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 0);
535 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 0);
536
537 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
538 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
539 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
540 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
541
542 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == 1.0);
543 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == 127.0/mjr::color4c8b::maxChanVal, boost::test_tools::tolerance(0.005));
544 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == 0.0);
545 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == 0.0);
546
547 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == aColor.getC0_dbl(), boost::test_tools::tolerance(0.00001));
548 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == aColor.getC1_dbl(), boost::test_tools::tolerance(0.00001));
549 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == aColor.getC2_dbl(), boost::test_tools::tolerance(0.00001));
550 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == aColor.getC3_dbl(), boost::test_tools::tolerance(0.00001));
551
552 aColor.setChansRGB_dbl(0.0, 0.0, 0.0);
553
554 BOOST_TEST_CHECK(aColor.getChan(0) == mjr::color4c8b::minChanVal);
555 BOOST_TEST_CHECK(aColor.getChan(1) == mjr::color4c8b::minChanVal);
556 BOOST_TEST_CHECK(aColor.getChan(2) == mjr::color4c8b::minChanVal);
557 BOOST_TEST_CHECK(aColor.getChan(3) == mjr::color4c8b::minChanVal);
558
559 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
560 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
561 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
562 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
563
564 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 0);
565 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 0);
566 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 0);
567 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 0);
568
569 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
570 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
571 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
572 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
573
574 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == 0.0);
575 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == 0.0);
576 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == 0.0);
577 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == 0.0);
578
579 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == aColor.getC0_dbl(), boost::test_tools::tolerance(0.00001));
580 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == aColor.getC1_dbl(), boost::test_tools::tolerance(0.00001));
581 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == aColor.getC2_dbl(), boost::test_tools::tolerance(0.00001));
582 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == aColor.getC3_dbl(), boost::test_tools::tolerance(0.00001));
583
584 aColor.setChans_dbl(1.0);
585
586 BOOST_TEST_CHECK(aColor.getChan(0) == mjr::color4c8b::maxChanVal);
587 BOOST_TEST_CHECK(aColor.getChan(1) == mjr::color4c8b::maxChanVal);
588 BOOST_TEST_CHECK(aColor.getChan(2) == mjr::color4c8b::maxChanVal);
589 BOOST_TEST_CHECK(aColor.getChan(3) == mjr::color4c8b::maxChanVal);
590
591 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
592 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
593 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
594 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
595
596 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 255);
597 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 255);
598 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 255);
599 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 255);
600
601 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
602 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
603 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
604 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
605
606 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == 1.0);
607 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == 1.0);
608 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == 1.0);
609 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == 1.0);
610
611 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == aColor.getC0_dbl(), boost::test_tools::tolerance(0.00001));
612 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == aColor.getC1_dbl(), boost::test_tools::tolerance(0.00001));
613 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == aColor.getC2_dbl(), boost::test_tools::tolerance(0.00001));
614 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == aColor.getC3_dbl(), boost::test_tools::tolerance(0.00001));
615
616 aColor.setChansRGBA_dbl(1.0, 0.0, 0.5, 0.5);
617
618 BOOST_TEST_CHECK(aColor.getChan(0) == mjr::color4c8b::maxChanVal);
619 BOOST_TEST_CHECK(aColor.getChan(1) == mjr::color4c8b::minChanVal);
620 BOOST_TEST_CHECK(aColor.getChan(2) == 127);
621 BOOST_TEST_CHECK(aColor.getChan(3) == 127);
622
623 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
624 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
625 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
626 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
627
628 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 255);
629 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 0);
630 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 127);
631 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 127);
632
633 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
634 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
635 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
636 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
637
638 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == 1.0);
639 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == 0.0);
640 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == 127.0/mjr::color4c8b::maxChanVal, boost::test_tools::tolerance(0.005));
641 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == 127.0/mjr::color4c8b::maxChanVal, boost::test_tools::tolerance(0.005));
642
643 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == aColor.getC0_dbl(), boost::test_tools::tolerance(0.00001));
644 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == aColor.getC1_dbl(), boost::test_tools::tolerance(0.00001));
645 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == aColor.getC2_dbl(), boost::test_tools::tolerance(0.00001));
646 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == aColor.getC3_dbl(), boost::test_tools::tolerance(0.00001));
647
648 aColor.setC0_dbl(0.0);
649 aColor.setC1_dbl(1.0);
650 aColor.setC2_dbl(1.0);
651 aColor.setC3_dbl(0.0);
652
653 BOOST_TEST_CHECK(aColor.getChan(0) == mjr::color4c8b::minChanVal);
654 BOOST_TEST_CHECK(aColor.getChan(1) == mjr::color4c8b::maxChanVal);
655 BOOST_TEST_CHECK(aColor.getChan(2) == mjr::color4c8b::maxChanVal);
656 BOOST_TEST_CHECK(aColor.getChan(3) == mjr::color4c8b::minChanVal);
657
658 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
659 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
660 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
661 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
662
663 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 0);
664 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 255);
665 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 255);
666 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 0);
667
668 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
669 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
670 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
671 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
672
673 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == 0.0);
674 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == 1.0);
675 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == 1.0);
676 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == 0.0);
677
678 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == aColor.getC0_dbl(), boost::test_tools::tolerance(0.00001));
679 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == aColor.getC1_dbl(), boost::test_tools::tolerance(0.00001));
680 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == aColor.getC2_dbl(), boost::test_tools::tolerance(0.00001));
681 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == aColor.getC3_dbl(), boost::test_tools::tolerance(0.00001));
682
683}
684
685////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
686BOOST_AUTO_TEST_CASE(set_chan_dbl_16, * boost::unit_test::tolerance(0.001)) {
687
688 mjr::color4c16b aColor;
689
690 BOOST_TEST_CHECK(mjr::color4c16b::maxChanVal == 65535);
691 BOOST_TEST_CHECK(mjr::color4c16b::minChanVal == 0);
692
693 aColor.setToBlack();
694 aColor.setChan_dbl(0, 1.0);
695 aColor.setChan_dbl(2, 1.0);
696
697 BOOST_TEST_CHECK(aColor.getChan(0) == mjr::color4c16b::maxChanVal);
698 BOOST_TEST_CHECK(aColor.getChan(1) == mjr::color4c16b::minChanVal);
699 BOOST_TEST_CHECK(aColor.getChan(2) == mjr::color4c16b::maxChanVal);
700 BOOST_TEST_CHECK(aColor.getChan(3) == mjr::color4c16b::minChanVal);
701
702 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
703 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
704 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
705 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
706
707 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 255);
708 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 0);
709 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 255);
710 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 0);
711
712 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
713 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
714 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
715 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
716
717 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == 1.0);
718 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == 0.0);
719 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == 1.0);
720 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == 0.0);
721
722 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == aColor.getC0_dbl(), boost::test_tools::tolerance(0.00001));
723 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == aColor.getC1_dbl(), boost::test_tools::tolerance(0.00001));
724 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == aColor.getC2_dbl(), boost::test_tools::tolerance(0.00001));
725 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == aColor.getC3_dbl(), boost::test_tools::tolerance(0.00001));
726
727 aColor.setChan_dbl(0, 0.0);
728
729 BOOST_TEST_CHECK(aColor.getChan(0) == mjr::color4c16b::minChanVal);
730 BOOST_TEST_CHECK(aColor.getChan(1) == mjr::color4c16b::minChanVal);
731 BOOST_TEST_CHECK(aColor.getChan(2) == mjr::color4c16b::maxChanVal);
732 BOOST_TEST_CHECK(aColor.getChan(3) == mjr::color4c16b::minChanVal);
733
734 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
735 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
736 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
737 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
738
739 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 0);
740 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 0);
741 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 255);
742 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 0);
743
744 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
745 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
746 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
747 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
748
749 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == 0.0);
750 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == 0.0);
751 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == 1.0);
752 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == 0.0);
753
754 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == aColor.getC0_dbl(), boost::test_tools::tolerance(0.00001));
755 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == aColor.getC1_dbl(), boost::test_tools::tolerance(0.00001));
756 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == aColor.getC2_dbl(), boost::test_tools::tolerance(0.00001));
757 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == aColor.getC3_dbl(), boost::test_tools::tolerance(0.00001));
758
759 aColor.setChansRGB_dbl(1.0, 1.0, 0.0);
760
761 BOOST_TEST_CHECK(aColor.getChan(0) == mjr::color4c16b::maxChanVal);
762 BOOST_TEST_CHECK(aColor.getChan(1) == mjr::color4c16b::maxChanVal);
763 BOOST_TEST_CHECK(aColor.getChan(2) == mjr::color4c16b::minChanVal);
764 BOOST_TEST_CHECK(aColor.getChan(3) == mjr::color4c16b::minChanVal);
765
766 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
767 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
768 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
769 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
770
771 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 255);
772 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 255);
773 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 0);
774 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 0);
775
776 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
777 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
778 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
779 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
780
781 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == 1.0);
782 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == 1.0);
783 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == 0.0);
784 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == 0.0);
785
786 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == aColor.getC0_dbl(), boost::test_tools::tolerance(0.00001));
787 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == aColor.getC1_dbl(), boost::test_tools::tolerance(0.00001));
788 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == aColor.getC2_dbl(), boost::test_tools::tolerance(0.00001));
789 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == aColor.getC3_dbl(), boost::test_tools::tolerance(0.00001));
790
791 aColor.setChan_dbl(1, 0.5);
792
793 BOOST_TEST_CHECK(aColor.getChan(0) == mjr::color4c16b::maxChanVal);
794 BOOST_TEST_CHECK(aColor.getChan(1) == 32767);
795 BOOST_TEST_CHECK(aColor.getChan(2) == mjr::color4c16b::minChanVal);
796 BOOST_TEST_CHECK(aColor.getChan(3) == mjr::color4c16b::minChanVal);
797
798 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
799 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
800 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
801 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
802
803 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 255);
804 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 127);
805 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 0);
806 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 0);
807
808 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
809 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
810 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
811 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
812
813 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == 1.0);
814 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == 32767.0/mjr::color4c16b::maxChanVal);
815 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == 0.0);
816 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == 0.0);
817
818 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == aColor.getC0_dbl(), boost::test_tools::tolerance(0.00001));
819 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == aColor.getC1_dbl(), boost::test_tools::tolerance(0.00001));
820 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == aColor.getC2_dbl(), boost::test_tools::tolerance(0.00001));
821 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == aColor.getC3_dbl(), boost::test_tools::tolerance(0.00001));
822
823 aColor.setChansRGB_dbl(0.0, 0.0, 0.0);
824
825 BOOST_TEST_CHECK(aColor.getChan(0) == mjr::color4c16b::minChanVal);
826 BOOST_TEST_CHECK(aColor.getChan(1) == mjr::color4c16b::minChanVal);
827 BOOST_TEST_CHECK(aColor.getChan(2) == mjr::color4c16b::minChanVal);
828 BOOST_TEST_CHECK(aColor.getChan(3) == mjr::color4c16b::minChanVal);
829
830 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
831 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
832 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
833 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
834
835 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 0);
836 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 0);
837 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 0);
838 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 0);
839
840 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
841 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
842 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
843 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
844
845 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == 0.0);
846 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == 0.0);
847 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == 0.0);
848 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == 0.0);
849
850 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == aColor.getC0_dbl(), boost::test_tools::tolerance(0.00001));
851 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == aColor.getC1_dbl(), boost::test_tools::tolerance(0.00001));
852 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == aColor.getC2_dbl(), boost::test_tools::tolerance(0.00001));
853 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == aColor.getC3_dbl(), boost::test_tools::tolerance(0.00001));
854
855 aColor.setChans_dbl(1.0);
856
857 BOOST_TEST_CHECK(aColor.getChan(0) == mjr::color4c16b::maxChanVal);
858 BOOST_TEST_CHECK(aColor.getChan(1) == mjr::color4c16b::maxChanVal);
859 BOOST_TEST_CHECK(aColor.getChan(2) == mjr::color4c16b::maxChanVal);
860 BOOST_TEST_CHECK(aColor.getChan(3) == mjr::color4c16b::maxChanVal);
861
862 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
863 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
864 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
865 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
866
867 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 255);
868 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 255);
869 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 255);
870 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 255);
871
872 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
873 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
874 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
875 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
876
877 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == 1.0);
878 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == 1.0);
879 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == 1.0);
880 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == 1.0);
881
882 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == aColor.getC0_dbl(), boost::test_tools::tolerance(0.00001));
883 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == aColor.getC1_dbl(), boost::test_tools::tolerance(0.00001));
884 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == aColor.getC2_dbl(), boost::test_tools::tolerance(0.00001));
885 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == aColor.getC3_dbl(), boost::test_tools::tolerance(0.00001));
886
887 aColor.setChansRGBA_dbl(1.0, 0.0, 0.5, 0.5);
888
889 BOOST_TEST_CHECK(aColor.getChan(0) == mjr::color4c16b::maxChanVal);
890 BOOST_TEST_CHECK(aColor.getChan(1) == mjr::color4c16b::minChanVal);
891 BOOST_TEST_CHECK(aColor.getChan(2) == 32767);
892 BOOST_TEST_CHECK(aColor.getChan(3) == 32767);
893
894 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
895 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
896 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
897 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
898
899 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 255);
900 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 0);
901 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 127);
902 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 127);
903
904 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
905 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
906 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
907 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
908
909 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == 1.0);
910 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == 0.0);
911 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == 32767.0/mjr::color4c16b::maxChanVal, boost::test_tools::tolerance(0.005));
912 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == 32767.0/mjr::color4c16b::maxChanVal, boost::test_tools::tolerance(0.005));
913
914 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == aColor.getC0_dbl(), boost::test_tools::tolerance(0.00001));
915 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == aColor.getC1_dbl(), boost::test_tools::tolerance(0.00001));
916 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == aColor.getC2_dbl(), boost::test_tools::tolerance(0.00001));
917 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == aColor.getC3_dbl(), boost::test_tools::tolerance(0.00001));
918
919 aColor.setC0_dbl(0.0);
920 aColor.setC1_dbl(1.0);
921 aColor.setC2_dbl(1.0);
922 aColor.setC3_dbl(0.0);
923
924 BOOST_TEST_CHECK(aColor.getChan(0) == mjr::color4c16b::minChanVal);
925 BOOST_TEST_CHECK(aColor.getChan(1) == mjr::color4c16b::maxChanVal);
926 BOOST_TEST_CHECK(aColor.getChan(2) == mjr::color4c16b::maxChanVal);
927 BOOST_TEST_CHECK(aColor.getChan(3) == mjr::color4c16b::minChanVal);
928
929 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
930 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
931 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
932 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
933
934 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 0);
935 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 255);
936 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 255);
937 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 0);
938
939 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
940 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
941 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
942 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
943
944 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == 0.0);
945 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == 1.0);
946 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == 1.0);
947 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == 0.0);
948
949 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == aColor.getC0_dbl(), boost::test_tools::tolerance(0.00001));
950 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == aColor.getC1_dbl(), boost::test_tools::tolerance(0.00001));
951 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == aColor.getC2_dbl(), boost::test_tools::tolerance(0.00001));
952 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == aColor.getC3_dbl(), boost::test_tools::tolerance(0.00001));
953
954}
955
956////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
957BOOST_AUTO_TEST_CASE(set_chan_dbl_64F, * boost::unit_test::tolerance(0.00001)) {
958
959 mjr::color4c64F aColor;
960
961 BOOST_TEST_CHECK(mjr::color4c64F::maxChanVal == 1.0);
962 BOOST_TEST_CHECK(mjr::color4c64F::minChanVal == 0.0);
963
964 aColor.setToBlack();
965 aColor.setChan_dbl(0, 1.0);
966 aColor.setChan_dbl(2, 1.0);
967
968 BOOST_TEST_CHECK(aColor.getChan(0) == mjr::color4c64F::maxChanVal);
969 BOOST_TEST_CHECK(aColor.getChan(1) == mjr::color4c64F::minChanVal);
970 BOOST_TEST_CHECK(aColor.getChan(2) == mjr::color4c64F::maxChanVal);
971 BOOST_TEST_CHECK(aColor.getChan(3) == mjr::color4c64F::minChanVal);
972
973 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
974 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
975 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
976 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
977
978 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 255);
979 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 0);
980 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 255);
981 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 0);
982
983 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
984 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
985 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
986 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
987
988 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == 1.0);
989 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == 0.0);
990 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == 1.0);
991 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == 0.0);
992
993 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == aColor.getC0_dbl(), boost::test_tools::tolerance(0.00001));
994 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == aColor.getC1_dbl(), boost::test_tools::tolerance(0.00001));
995 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == aColor.getC2_dbl(), boost::test_tools::tolerance(0.00001));
996 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == aColor.getC3_dbl(), boost::test_tools::tolerance(0.00001));
997
998 aColor.setChan_dbl(0, 0.0);
999
1000 BOOST_TEST_CHECK(aColor.getChan(0) == mjr::color4c64F::minChanVal);
1001 BOOST_TEST_CHECK(aColor.getChan(1) == mjr::color4c64F::minChanVal);
1002 BOOST_TEST_CHECK(aColor.getChan(2) == mjr::color4c64F::maxChanVal);
1003 BOOST_TEST_CHECK(aColor.getChan(3) == mjr::color4c64F::minChanVal);
1004
1005 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
1006 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
1007 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
1008 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
1009
1010 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 0);
1011 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 0);
1012 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 255);
1013 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 0);
1014
1015 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
1016 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
1017 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
1018 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
1019
1020 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == 0.0);
1021 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == 0.0);
1022 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == 1.0);
1023 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == 0.0);
1024
1025 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == aColor.getC0_dbl(), boost::test_tools::tolerance(0.00001));
1026 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == aColor.getC1_dbl(), boost::test_tools::tolerance(0.00001));
1027 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == aColor.getC2_dbl(), boost::test_tools::tolerance(0.00001));
1028 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == aColor.getC3_dbl(), boost::test_tools::tolerance(0.00001));
1029
1030 aColor.setChansRGB_dbl(1.0, 1.0, 0.0);
1031
1032 BOOST_TEST_CHECK(aColor.getChan(0) == mjr::color4c64F::maxChanVal);
1033 BOOST_TEST_CHECK(aColor.getChan(1) == mjr::color4c64F::maxChanVal);
1034 BOOST_TEST_CHECK(aColor.getChan(2) == mjr::color4c64F::minChanVal);
1035 BOOST_TEST_CHECK(aColor.getChan(3) == mjr::color4c64F::minChanVal);
1036
1037 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
1038 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
1039 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
1040 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
1041
1042 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 255);
1043 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 255);
1044 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 0);
1045 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 0);
1046
1047 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
1048 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
1049 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
1050 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
1051
1052 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == 1.0);
1053 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == 1.0);
1054 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == 0.0);
1055 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == 0.0);
1056
1057 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == aColor.getC0_dbl(), boost::test_tools::tolerance(0.00001));
1058 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == aColor.getC1_dbl(), boost::test_tools::tolerance(0.00001));
1059 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == aColor.getC2_dbl(), boost::test_tools::tolerance(0.00001));
1060 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == aColor.getC3_dbl(), boost::test_tools::tolerance(0.00001));
1061
1062 aColor.setChan_dbl(1, 0.5);
1063
1064 BOOST_TEST_CHECK(aColor.getChan(0) == mjr::color4c64F::maxChanVal);
1065 BOOST_TEST_CHECK(aColor.getChan(1) == 0.5);
1066 BOOST_TEST_CHECK(aColor.getChan(2) == mjr::color4c64F::minChanVal);
1067 BOOST_TEST_CHECK(aColor.getChan(3) == mjr::color4c64F::minChanVal);
1068
1069 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
1070 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
1071 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
1072 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
1073
1074 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 255);
1075 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 127);
1076 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 0);
1077 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 0);
1078
1079 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
1080 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
1081 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
1082 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
1083
1084 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == 1.0);
1085 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == 0.5);
1086 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == 0.0);
1087 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == 0.0);
1088
1089 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == aColor.getC0_dbl(), boost::test_tools::tolerance(0.00001));
1090 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == aColor.getC1_dbl(), boost::test_tools::tolerance(0.00001));
1091 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == aColor.getC2_dbl(), boost::test_tools::tolerance(0.00001));
1092 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == aColor.getC3_dbl(), boost::test_tools::tolerance(0.00001));
1093
1094 aColor.setChansRGB_dbl(0.0, 0.0, 0.0);
1095
1096 BOOST_TEST_CHECK(aColor.getChan(0) == mjr::color4c64F::minChanVal);
1097 BOOST_TEST_CHECK(aColor.getChan(1) == mjr::color4c64F::minChanVal);
1098 BOOST_TEST_CHECK(aColor.getChan(2) == mjr::color4c64F::minChanVal);
1099 BOOST_TEST_CHECK(aColor.getChan(3) == mjr::color4c64F::minChanVal);
1100
1101 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
1102 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
1103 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
1104 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
1105
1106 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 0);
1107 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 0);
1108 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 0);
1109 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 0);
1110
1111 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
1112 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
1113 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
1114 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
1115
1116 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == 0.0);
1117 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == 0.0);
1118 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == 0.0);
1119 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == 0.0);
1120
1121 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == aColor.getC0_dbl(), boost::test_tools::tolerance(0.00001));
1122 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == aColor.getC1_dbl(), boost::test_tools::tolerance(0.00001));
1123 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == aColor.getC2_dbl(), boost::test_tools::tolerance(0.00001));
1124 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == aColor.getC3_dbl(), boost::test_tools::tolerance(0.00001));
1125
1126 aColor.setChans_dbl(1.0);
1127
1128 BOOST_TEST_CHECK(aColor.getChan(0) == mjr::color4c64F::maxChanVal);
1129 BOOST_TEST_CHECK(aColor.getChan(1) == mjr::color4c64F::maxChanVal);
1130 BOOST_TEST_CHECK(aColor.getChan(2) == mjr::color4c64F::maxChanVal);
1131 BOOST_TEST_CHECK(aColor.getChan(3) == mjr::color4c64F::maxChanVal);
1132
1133 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
1134 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
1135 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
1136 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
1137
1138 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 255);
1139 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 255);
1140 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 255);
1141 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 255);
1142
1143 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
1144 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
1145 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
1146 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
1147
1148 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == 1.0);
1149 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == 1.0);
1150 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == 1.0);
1151 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == 1.0);
1152
1153 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == aColor.getC0_dbl(), boost::test_tools::tolerance(0.00001));
1154 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == aColor.getC1_dbl(), boost::test_tools::tolerance(0.00001));
1155 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == aColor.getC2_dbl(), boost::test_tools::tolerance(0.00001));
1156 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == aColor.getC3_dbl(), boost::test_tools::tolerance(0.00001));
1157
1158 aColor.setChansRGBA_dbl(1.0, 0.0, 0.5, 0.5);
1159
1160 BOOST_TEST_CHECK(aColor.getChan(0) == mjr::color4c64F::maxChanVal);
1161 BOOST_TEST_CHECK(aColor.getChan(1) == mjr::color4c64F::minChanVal);
1162 BOOST_TEST_CHECK(aColor.getChan(2) == 0.5);
1163 BOOST_TEST_CHECK(aColor.getChan(3) == 0.5);
1164
1165 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
1166 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
1167 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
1168 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
1169
1170 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 255);
1171 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 0);
1172 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 127);
1173 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 127);
1174
1175 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
1176 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
1177 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
1178 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
1179
1180 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == 1.0);
1181 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == 0.0);
1182 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == 0.5);
1183 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == 0.5);
1184
1185 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == aColor.getC0_dbl(), boost::test_tools::tolerance(0.00001));
1186 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == aColor.getC1_dbl(), boost::test_tools::tolerance(0.00001));
1187 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == aColor.getC2_dbl(), boost::test_tools::tolerance(0.00001));
1188 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == aColor.getC3_dbl(), boost::test_tools::tolerance(0.00001));
1189
1190 aColor.setC0_dbl(0.0);
1191 aColor.setC1_dbl(1.0);
1192 aColor.setC2_dbl(1.0);
1193 aColor.setC3_dbl(0.0);
1194
1195 BOOST_TEST_CHECK(aColor.getChan(0) == mjr::color4c64F::minChanVal);
1196 BOOST_TEST_CHECK(aColor.getChan(1) == mjr::color4c64F::maxChanVal);
1197 BOOST_TEST_CHECK(aColor.getChan(2) == mjr::color4c64F::maxChanVal);
1198 BOOST_TEST_CHECK(aColor.getChan(3) == mjr::color4c64F::minChanVal);
1199
1200 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
1201 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
1202 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
1203 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
1204
1205 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 0);
1206 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 255);
1207 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 255);
1208 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 0);
1209
1210 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
1211 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
1212 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
1213 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
1214
1215 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == 0.0);
1216 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == 1.0);
1217 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == 1.0);
1218 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == 0.0);
1219
1220 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == aColor.getC0_dbl(), boost::test_tools::tolerance(0.00001));
1221 BOOST_TEST_CHECK(aColor.getChan_dbl(1) == aColor.getC1_dbl(), boost::test_tools::tolerance(0.00001));
1222 BOOST_TEST_CHECK(aColor.getChan_dbl(2) == aColor.getC2_dbl(), boost::test_tools::tolerance(0.00001));
1223 BOOST_TEST_CHECK(aColor.getChan_dbl(3) == aColor.getC3_dbl(), boost::test_tools::tolerance(0.00001));
1224
1225}
1226
1227////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1228BOOST_AUTO_TEST_CASE(set_chan_byte_8) {
1229
1230 mjr::color4c8b aColor;
1231
1232 aColor.setToBlack();
1233 aColor.setChan_byte(0, 11);
1234 aColor.setChan_byte(1, 22);
1235 aColor.setChan_byte(2, 33);
1236 aColor.setChan_byte(3, 44);
1237
1238 BOOST_TEST_CHECK(aColor.getChan(0) == 11);
1239 BOOST_TEST_CHECK(aColor.getChan(1) == 22);
1240 BOOST_TEST_CHECK(aColor.getChan(2) == 33);
1241 BOOST_TEST_CHECK(aColor.getChan(3) == 44);
1242
1243 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
1244 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
1245 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
1246 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
1247
1248 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 11);
1249 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 22);
1250 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 33);
1251 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 44);
1252
1253 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
1254 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
1255 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
1256 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
1257
1258 aColor.setC0_byte(55);
1259 aColor.setC1_byte(66);
1260 aColor.setC2_byte(77);
1261 aColor.setC3_byte(88);
1262
1263 BOOST_TEST_CHECK(aColor.getChan(0) == 55);
1264 BOOST_TEST_CHECK(aColor.getChan(1) == 66);
1265 BOOST_TEST_CHECK(aColor.getChan(2) == 77);
1266 BOOST_TEST_CHECK(aColor.getChan(3) == 88);
1267
1268 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
1269 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
1270 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
1271 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
1272
1273 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 55);
1274 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 66);
1275 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 77);
1276 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 88);
1277
1278 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
1279 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
1280 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
1281 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
1282
1283 aColor.setChans_byte(99);
1284
1285 BOOST_TEST_CHECK(aColor.getChan(0) == 99);
1286 BOOST_TEST_CHECK(aColor.getChan(1) == 99);
1287 BOOST_TEST_CHECK(aColor.getChan(2) == 99);
1288 BOOST_TEST_CHECK(aColor.getChan(3) == 99);
1289
1290 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
1291 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
1292 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
1293 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
1294
1295 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 99);
1296 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 99);
1297 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 99);
1298 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 99);
1299
1300 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
1301 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
1302 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
1303 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
1304
1305 aColor.setChansRGB_byte(33, 44, 55);
1306
1307 BOOST_TEST_CHECK(aColor.getChan(0) == 33);
1308 BOOST_TEST_CHECK(aColor.getChan(1) == 44);
1309 BOOST_TEST_CHECK(aColor.getChan(2) == 55);
1310 BOOST_TEST_CHECK(aColor.getChan(3) == 99);
1311
1312 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
1313 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
1314 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
1315 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
1316
1317 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 33);
1318 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 44);
1319 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 55);
1320 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 99);
1321
1322 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
1323 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
1324 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
1325 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
1326
1327 aColor.setChansRGBA_byte(11, 22, 33, 44);
1328
1329 BOOST_TEST_CHECK(aColor.getChan(0) == 11);
1330 BOOST_TEST_CHECK(aColor.getChan(1) == 22);
1331 BOOST_TEST_CHECK(aColor.getChan(2) == 33);
1332 BOOST_TEST_CHECK(aColor.getChan(3) == 44);
1333
1334 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
1335 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
1336 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
1337 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
1338
1339 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 11);
1340 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 22);
1341 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 33);
1342 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 44);
1343
1344 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
1345 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
1346 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
1347 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
1348
1349 // Test that max & min are hit
1350 aColor.setChansRGBA_byte(0, 255, 0, 255);
1351
1352 BOOST_TEST_CHECK(aColor.getChan(0) == mjr::color4c8b::minChanVal);
1353 BOOST_TEST_CHECK(aColor.getChan(1) == mjr::color4c8b::maxChanVal);
1354 BOOST_TEST_CHECK(aColor.getChan(2) == mjr::color4c8b::minChanVal);
1355 BOOST_TEST_CHECK(aColor.getChan(3) == mjr::color4c8b::maxChanVal);
1356
1357}
1358
1359////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1360BOOST_AUTO_TEST_CASE(set_chan_byte_16) {
1361
1362 mjr::color4c16b aColor;
1363
1364 aColor.setToBlack();
1365 aColor.setChan_byte(0, 11);
1366 aColor.setChan_byte(1, 22);
1367 aColor.setChan_byte(2, 33);
1368 aColor.setChan_byte(3, 44);
1369
1370 BOOST_TEST_CHECK(aColor.getChan(0) == 0xB0B);
1371 BOOST_TEST_CHECK(aColor.getChan(1) == 0x1616);
1372 BOOST_TEST_CHECK(aColor.getChan(2) == 0x2121);
1373 BOOST_TEST_CHECK(aColor.getChan(3) == 0x2C2C);
1374
1375 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
1376 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
1377 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
1378 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
1379
1380 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 11);
1381 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 22);
1382 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 33);
1383 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 44);
1384
1385 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
1386 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
1387 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
1388 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
1389
1390 aColor.setC0_byte(55);
1391 aColor.setC1_byte(66);
1392 aColor.setC2_byte(77);
1393 aColor.setC3_byte(88);
1394
1395 BOOST_TEST_CHECK(aColor.getChan(0) == 14135);
1396 BOOST_TEST_CHECK(aColor.getChan(1) == 16962);
1397 BOOST_TEST_CHECK(aColor.getChan(2) == 19789);
1398 BOOST_TEST_CHECK(aColor.getChan(3) == 22616);
1399
1400 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
1401 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
1402 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
1403 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
1404
1405 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 55);
1406 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 66);
1407 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 77);
1408 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 88);
1409
1410 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
1411 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
1412 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
1413 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
1414
1415 aColor.setChans_byte(99);
1416
1417 BOOST_TEST_CHECK(aColor.getChan(0) == 25443);
1418 BOOST_TEST_CHECK(aColor.getChan(1) == 25443);
1419 BOOST_TEST_CHECK(aColor.getChan(2) == 25443);
1420 BOOST_TEST_CHECK(aColor.getChan(3) == 25443);
1421
1422 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
1423 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
1424 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
1425 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
1426
1427 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 99);
1428 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 99);
1429 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 99);
1430 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 99);
1431
1432 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
1433 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
1434 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
1435 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
1436
1437 aColor.setChansRGB_byte(33, 44, 55);
1438
1439 BOOST_TEST_CHECK(aColor.getChan(0) == 8481);
1440 BOOST_TEST_CHECK(aColor.getChan(1) == 11308);
1441 BOOST_TEST_CHECK(aColor.getChan(2) == 14135);
1442 BOOST_TEST_CHECK(aColor.getChan(3) == 25443);
1443
1444 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
1445 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
1446 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
1447 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
1448
1449 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 33);
1450 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 44);
1451 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 55);
1452 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 99);
1453
1454 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
1455 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
1456 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
1457 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
1458
1459 aColor.setChansRGBA_byte(11, 22, 33, 44);
1460
1461 BOOST_TEST_CHECK(aColor.getChan(0) == 2827);
1462 BOOST_TEST_CHECK(aColor.getChan(1) == 5654);
1463 BOOST_TEST_CHECK(aColor.getChan(2) == 8481);
1464 BOOST_TEST_CHECK(aColor.getChan(3) == 11308);
1465
1466 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
1467 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
1468 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
1469 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
1470
1471 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 11);
1472 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 22);
1473 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 33);
1474 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 44);
1475
1476 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
1477 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
1478 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
1479 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
1480
1481 // Test that max & min are hit
1482 aColor.setChansRGBA_byte(0, 255, 0, 255);
1483
1484 BOOST_TEST_CHECK(aColor.getChan(0) == mjr::color4c16b::minChanVal);
1485 BOOST_TEST_CHECK(aColor.getChan(1) == mjr::color4c16b::maxChanVal);
1486 BOOST_TEST_CHECK(aColor.getChan(2) == mjr::color4c16b::minChanVal);
1487 BOOST_TEST_CHECK(aColor.getChan(3) == mjr::color4c16b::maxChanVal);
1488
1489}
1490
1491////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1492BOOST_AUTO_TEST_CASE(set_chan_byte_64F, * boost::unit_test::tolerance(0.0001)) {
1493
1494 mjr::color4c64F aColor;
1495
1496 aColor.setToBlack();
1497 aColor.setChan_byte(0, 11);
1498 aColor.setChan_byte(1, 22);
1499 aColor.setChan_byte(2, 34); // 33 has a rounding error :)
1500 aColor.setChan_byte(3, 44);
1501
1502 BOOST_TEST_CHECK(aColor.getChan(0) == 0.043137254902);
1503 BOOST_TEST_CHECK(aColor.getChan(1) == 0.0862745098039);
1504 BOOST_TEST_CHECK(aColor.getChan(2) == 0.133333333333);
1505 BOOST_TEST_CHECK(aColor.getChan(3) == 0.172549019608);
1506
1507 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
1508 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
1509 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
1510 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
1511
1512 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 11);
1513 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 22);
1514 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 34);
1515 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 44);
1516
1517 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
1518 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
1519 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
1520 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
1521
1522 aColor.setC0_byte(55);
1523 aColor.setC1_byte(65); // 66 has rounding error :)
1524 aColor.setC2_byte(77);
1525 aColor.setC3_byte(88);
1526
1527 BOOST_TEST_CHECK(aColor.getChan(0) == 0.21568627450980393);
1528 BOOST_TEST_CHECK(aColor.getChan(1) == 0.254901960784);
1529 BOOST_TEST_CHECK(aColor.getChan(2) == 0.30196078431372547);
1530 BOOST_TEST_CHECK(aColor.getChan(3) == 0.34509803921568627);
1531
1532 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
1533 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
1534 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
1535 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
1536
1537 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 55);
1538 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 65);
1539 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 77);
1540 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 88);
1541
1542 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
1543 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
1544 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
1545 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
1546
1547 aColor.setChans_byte(99);
1548
1549 BOOST_TEST_CHECK(aColor.getChan(0) == 0.38823529411764707);
1550 BOOST_TEST_CHECK(aColor.getChan(1) == 0.38823529411764707);
1551 BOOST_TEST_CHECK(aColor.getChan(2) == 0.38823529411764707);
1552 BOOST_TEST_CHECK(aColor.getChan(3) == 0.38823529411764707);
1553
1554 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
1555 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
1556 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
1557 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
1558
1559 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 99);
1560 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 99);
1561 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 99);
1562 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 99);
1563
1564 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
1565 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
1566 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
1567 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
1568
1569 aColor.setChansRGB_byte(34, 44, 55);
1570
1571 BOOST_TEST_CHECK(aColor.getChan(0) == 0.133333333333);
1572 BOOST_TEST_CHECK(aColor.getChan(1) == 0.17254901960784313);
1573 BOOST_TEST_CHECK(aColor.getChan(2) == 0.21568627450980393);
1574 BOOST_TEST_CHECK(aColor.getChan(3) == 0.38823529411764707);
1575
1576 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
1577 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
1578 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
1579 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
1580
1581 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 34);
1582 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 44);
1583 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 55);
1584 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 99);
1585
1586 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
1587 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
1588 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
1589 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
1590
1591 aColor.setChansRGBA_byte(11, 22, 34, 44);
1592
1593 BOOST_TEST_CHECK(aColor.getChan(0) == 0.043137254902);
1594 BOOST_TEST_CHECK(aColor.getChan(1) == 0.08627450980392157);
1595 BOOST_TEST_CHECK(aColor.getChan(2) == 0.133333333333);
1596 BOOST_TEST_CHECK(aColor.getChan(3) == 0.17254901960784313);
1597
1598 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
1599 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
1600 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
1601 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
1602
1603 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 11);
1604 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 22);
1605 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 34);
1606 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 44);
1607
1608 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
1609 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
1610 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
1611 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
1612
1613 // Test that max & min are hit
1614 aColor.setChansRGBA_byte(0, 255, 0, 255);
1615
1616 BOOST_TEST_CHECK(aColor.getChan(0) == mjr::color4c64F::minChanVal);
1617 BOOST_TEST_CHECK(aColor.getChan(1) == mjr::color4c64F::maxChanVal);
1618 BOOST_TEST_CHECK(aColor.getChan(2) == mjr::color4c64F::minChanVal);
1619 BOOST_TEST_CHECK(aColor.getChan(3) == mjr::color4c64F::maxChanVal);
1620}
1621
1622////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1623BOOST_AUTO_TEST_CASE(set_chan_8) {
1624
1625 mjr::color4c8b aColor;
1626
1627 aColor.setToBlack();
1628 aColor.setChan(0, 11);
1629 aColor.setChan(1, 22);
1630 aColor.setChan(2, 33);
1631 aColor.setChan(3, 44);
1632
1633 BOOST_TEST_CHECK(aColor.getChan(0) == 11);
1634 BOOST_TEST_CHECK(aColor.getChan(1) == 22);
1635 BOOST_TEST_CHECK(aColor.getChan(2) == 33);
1636 BOOST_TEST_CHECK(aColor.getChan(3) == 44);
1637
1638 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
1639 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
1640 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
1641 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
1642
1643 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 11);
1644 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 22);
1645 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 33);
1646 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 44);
1647
1648 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
1649 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
1650 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
1651 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
1652
1653 aColor.setC0(55);
1654 aColor.setC1(66);
1655 aColor.setC2(77);
1656 aColor.setC3(88);
1657
1658 BOOST_TEST_CHECK(aColor.getChan(0) == 55);
1659 BOOST_TEST_CHECK(aColor.getChan(1) == 66);
1660 BOOST_TEST_CHECK(aColor.getChan(2) == 77);
1661 BOOST_TEST_CHECK(aColor.getChan(3) == 88);
1662
1663 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
1664 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
1665 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
1666 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
1667
1668 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 55);
1669 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 66);
1670 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 77);
1671 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 88);
1672
1673 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
1674 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
1675 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
1676 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
1677
1678 aColor.setChans(99);
1679
1680 BOOST_TEST_CHECK(aColor.getChan(0) == 99);
1681 BOOST_TEST_CHECK(aColor.getChan(1) == 99);
1682 BOOST_TEST_CHECK(aColor.getChan(2) == 99);
1683 BOOST_TEST_CHECK(aColor.getChan(3) == 99);
1684
1685 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
1686 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
1687 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
1688 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
1689
1690 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 99);
1691 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 99);
1692 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 99);
1693 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 99);
1694
1695 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
1696 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
1697 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
1698 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
1699
1700 aColor.setChansRGB(33, 44, 55);
1701
1702 BOOST_TEST_CHECK(aColor.getChan(0) == 33);
1703 BOOST_TEST_CHECK(aColor.getChan(1) == 44);
1704 BOOST_TEST_CHECK(aColor.getChan(2) == 55);
1705 BOOST_TEST_CHECK(aColor.getChan(3) == 99);
1706
1707 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
1708 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
1709 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
1710 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
1711
1712 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 33);
1713 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 44);
1714 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 55);
1715 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 99);
1716
1717 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
1718 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
1719 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
1720 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
1721
1722 aColor.setChansRGBA(11, 22, 33, 44);
1723
1724 BOOST_TEST_CHECK(aColor.getChan(0) == 11);
1725 BOOST_TEST_CHECK(aColor.getChan(1) == 22);
1726 BOOST_TEST_CHECK(aColor.getChan(2) == 33);
1727 BOOST_TEST_CHECK(aColor.getChan(3) == 44);
1728
1729 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
1730 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
1731 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
1732 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
1733
1734 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 11);
1735 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 22);
1736 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 33);
1737 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 44);
1738
1739 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
1740 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
1741 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
1742 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
1743}
1744
1745////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1746BOOST_AUTO_TEST_CASE(set_chan_16) {
1747
1748 mjr::color4c16b aColor;
1749
1750 aColor.setToBlack();
1751 aColor.setChan(0, 1024);
1752 aColor.setChan(1, 2048);
1753 aColor.setChan(2, 4096);
1754 aColor.setChan(3, 8192);
1755
1756 BOOST_TEST_CHECK(aColor.getChan(0) == 1024);
1757 BOOST_TEST_CHECK(aColor.getChan(1) == 2048);
1758 BOOST_TEST_CHECK(aColor.getChan(2) == 4096);
1759 BOOST_TEST_CHECK(aColor.getChan(3) == 8192);
1760
1761 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
1762 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
1763 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
1764 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
1765
1766 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 0x03);
1767 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 0x07);
1768 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 0x0f);
1769 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 0x1f);
1770
1771 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
1772 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
1773 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
1774 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
1775
1776 aColor.setC0(8192);
1777 aColor.setC1(4096);
1778 aColor.setC2(2048);
1779 aColor.setC3(1024);
1780
1781 BOOST_TEST_CHECK(aColor.getChan(0) == 8192);
1782 BOOST_TEST_CHECK(aColor.getChan(1) == 4096);
1783 BOOST_TEST_CHECK(aColor.getChan(2) == 2048);
1784 BOOST_TEST_CHECK(aColor.getChan(3) == 1024);
1785
1786 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
1787 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
1788 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
1789 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
1790
1791 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 0x1f);
1792 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 0x0f);
1793 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 0x07);
1794 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 0x03);
1795
1796 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
1797 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
1798 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
1799 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
1800
1801 aColor.setChans(32768);
1802
1803 BOOST_TEST_CHECK(aColor.getChan(0) == 32768);
1804 BOOST_TEST_CHECK(aColor.getChan(1) == 32768);
1805 BOOST_TEST_CHECK(aColor.getChan(2) == 32768);
1806 BOOST_TEST_CHECK(aColor.getChan(3) == 32768);
1807
1808 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
1809 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
1810 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
1811 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
1812
1813 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 0x7f);
1814 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 0x7f);
1815 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 0x7f);
1816 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 0x7f);
1817
1818 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
1819 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
1820 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
1821 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
1822
1823 aColor.setChansRGB(4096, 8192, 16384);
1824
1825 BOOST_TEST_CHECK(aColor.getChan(0) == 4096);
1826 BOOST_TEST_CHECK(aColor.getChan(1) == 8192);
1827 BOOST_TEST_CHECK(aColor.getChan(2) == 16384);
1828 BOOST_TEST_CHECK(aColor.getChan(3) == 32768);
1829
1830 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
1831 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
1832 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
1833 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
1834
1835 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 0x0f);
1836 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 0x1f);
1837 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 0x3f);
1838 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 0x7f);
1839
1840 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
1841 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
1842 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
1843 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
1844
1845 aColor.setChansRGBA(1024, 2048, 4096, 8192);
1846
1847 BOOST_TEST_CHECK(aColor.getChan(0) == 1024);
1848 BOOST_TEST_CHECK(aColor.getChan(1) == 2048);
1849 BOOST_TEST_CHECK(aColor.getChan(2) == 4096);
1850 BOOST_TEST_CHECK(aColor.getChan(3) == 8192);
1851
1852 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
1853 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
1854 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
1855 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
1856
1857 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 0x03);
1858 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 0x07);
1859 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 0x0f);
1860 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 0x1f);
1861
1862 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
1863 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
1864 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
1865 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
1866
1867 //Corners
1868 aColor.setChans(0);
1869
1870 BOOST_TEST_CHECK(aColor.getChan(0) == 0);
1871 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
1872
1873 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 0);
1874 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
1875
1876 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == 0.0);
1877 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == aColor.getC0_dbl());
1878
1879 aColor.setChans(65535);
1880
1881 BOOST_TEST_CHECK(aColor.getChan(0) == 65535);
1882 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC1());
1883
1884 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 255);
1885 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC1_byte());
1886
1887 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == 1.0);
1888 BOOST_TEST_CHECK(aColor.getChan_dbl(0) == aColor.getC1_dbl());
1889
1890 }
1891
1892////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1893BOOST_AUTO_TEST_CASE(set_chan_64F) {
1894
1895 mjr::color4c64F aColor;
1896
1897 aColor.setToBlack();
1898 aColor.setChan(0, 0.25);
1899 aColor.setChan(1, 0.50);
1900 aColor.setChan(2, 0.75);
1901 aColor.setChan(3, 1.00);
1902
1903 BOOST_TEST_CHECK(aColor.getChan(0) == 0.25);
1904 BOOST_TEST_CHECK(aColor.getChan(1) == 0.50);
1905 BOOST_TEST_CHECK(aColor.getChan(2) == 0.75);
1906 BOOST_TEST_CHECK(aColor.getChan(3) == 1.00);
1907
1908 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
1909 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
1910 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
1911 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
1912
1913 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 63);
1914 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 127);
1915 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 191);
1916 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 255);
1917
1918 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
1919 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
1920 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
1921 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
1922
1923 aColor.setC0(1.00);
1924 aColor.setC1(0.75);
1925 aColor.setC2(0.50);
1926 aColor.setC3(0.25);
1927
1928 BOOST_TEST_CHECK(aColor.getChan(0) == 1.00);
1929 BOOST_TEST_CHECK(aColor.getChan(1) == 0.75);
1930 BOOST_TEST_CHECK(aColor.getChan(2) == 0.50);
1931 BOOST_TEST_CHECK(aColor.getChan(3) == 0.25);
1932
1933 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
1934 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
1935 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
1936 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
1937
1938 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 255);
1939 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 191);
1940 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 127);
1941 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 63);
1942
1943 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
1944 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
1945 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
1946 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
1947
1948 aColor.setChans(0.0);
1949
1950 BOOST_TEST_CHECK(aColor.getChan(0) == 0.0);
1951 BOOST_TEST_CHECK(aColor.getChan(1) == 0.0);
1952 BOOST_TEST_CHECK(aColor.getChan(2) == 0.0);
1953 BOOST_TEST_CHECK(aColor.getChan(3) == 0.0);
1954
1955 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
1956 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
1957 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
1958 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
1959
1960 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 0);
1961 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 0);
1962 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 0);
1963 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 0);
1964
1965 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
1966 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
1967 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
1968 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
1969
1970 aColor.setChansRGB(0.75, 0.50, 1.0);
1971
1972 BOOST_TEST_CHECK(aColor.getChan(0) == 0.75);
1973 BOOST_TEST_CHECK(aColor.getChan(1) == 0.50);
1974 BOOST_TEST_CHECK(aColor.getChan(2) == 1.00);
1975 BOOST_TEST_CHECK(aColor.getChan(3) == 0.00);
1976
1977 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
1978 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
1979 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
1980 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
1981
1982 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 191);
1983 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 127);
1984 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 255);
1985 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 0);
1986
1987 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
1988 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
1989 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
1990 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
1991
1992 aColor.setChansRGBA(0.25, 0.50, 0.75, 1.00);
1993
1994 BOOST_TEST_CHECK(aColor.getChan(0) == 0.25);
1995 BOOST_TEST_CHECK(aColor.getChan(1) == 0.50);
1996 BOOST_TEST_CHECK(aColor.getChan(2) == 0.75);
1997 BOOST_TEST_CHECK(aColor.getChan(3) == 1.00);
1998
1999 BOOST_TEST_CHECK(aColor.getChan(0) == aColor.getC0());
2000 BOOST_TEST_CHECK(aColor.getChan(1) == aColor.getC1());
2001 BOOST_TEST_CHECK(aColor.getChan(2) == aColor.getC2());
2002 BOOST_TEST_CHECK(aColor.getChan(3) == aColor.getC3());
2003
2004 BOOST_TEST_CHECK(aColor.getChan_byte(0) == 63);
2005 BOOST_TEST_CHECK(aColor.getChan_byte(1) == 127);
2006 BOOST_TEST_CHECK(aColor.getChan_byte(2) == 191);
2007 BOOST_TEST_CHECK(aColor.getChan_byte(3) == 255);
2008
2009 BOOST_TEST_CHECK(aColor.getChan_byte(0) == aColor.getC0_byte());
2010 BOOST_TEST_CHECK(aColor.getChan_byte(1) == aColor.getC1_byte());
2011 BOOST_TEST_CHECK(aColor.getChan_byte(2) == aColor.getC2_byte());
2012 BOOST_TEST_CHECK(aColor.getChan_byte(3) == aColor.getC3_byte());
2013 }
2014
2015////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2016BOOST_AUTO_TEST_CASE(constr_64F) {
2017
2018 mjr::color4c64F aColor(0.25);
2019 BOOST_TEST_CHECK(aColor.getChan(0) == 0.25);
2020 BOOST_TEST_CHECK(aColor.getChan(1) == 0.25);
2021 BOOST_TEST_CHECK(aColor.getChan(2) == 0.25);
2022 BOOST_TEST_CHECK(aColor.getChan(3) == 0.25);
2023
2024 mjr::color4c64F cColor(0.25, 0.50, 0.75);
2025 BOOST_TEST_CHECK(cColor.getChan(0) == 0.25);
2026 BOOST_TEST_CHECK(cColor.getChan(1) == 0.50);
2027 BOOST_TEST_CHECK(cColor.getChan(2) == 0.75);
2028 BOOST_TEST_CHECK(cColor.getChan(3) == 0.00);
2029
2030 mjr::color4c64F dColor(1.00, 0.75, 0.50, 0.25);
2031 BOOST_TEST_CHECK(dColor.getChan(0) == 1.00);
2032 BOOST_TEST_CHECK(dColor.getChan(1) == 0.75);
2033 BOOST_TEST_CHECK(dColor.getChan(2) == 0.50);
2034 BOOST_TEST_CHECK(dColor.getChan(3) == 0.25);
2035
2036 mjr::color4c64F eColor(dColor);
2037 BOOST_TEST_CHECK(eColor.getChan(0) == 1.00);
2038 BOOST_TEST_CHECK(eColor.getChan(1) == 0.75);
2039 BOOST_TEST_CHECK(eColor.getChan(2) == 0.50);
2040 BOOST_TEST_CHECK(eColor.getChan(3) == 0.25);
2041
2042 mjr::color4c64F f0Color(mjr::color4c64F::cornerColorEnum::BLACK);
2043 mjr::color4c64F fRColor(mjr::color4c64F::cornerColorEnum::RED);
2044 mjr::color4c64F fGColor(mjr::color4c64F::cornerColorEnum::GREEN);
2045 mjr::color4c64F fBColor(mjr::color4c64F::cornerColorEnum::BLUE);
2046 mjr::color4c64F fYColor(mjr::color4c64F::cornerColorEnum::YELLOW);
2047 mjr::color4c64F fCColor(mjr::color4c64F::cornerColorEnum::CYAN);
2048 mjr::color4c64F fMColor(mjr::color4c64F::cornerColorEnum::MAGENTA);
2049 mjr::color4c64F f1Color(mjr::color4c64F::cornerColorEnum::WHITE);
2050
2051 BOOST_TEST_CHECK(f0Color.getC0() == 0.0);
2052 BOOST_TEST_CHECK(fRColor.getC0() == 1.0);
2053 BOOST_TEST_CHECK(fGColor.getC0() == 0.0);
2054 BOOST_TEST_CHECK(fBColor.getC0() == 0.0);
2055 BOOST_TEST_CHECK(fYColor.getC0() == 1.0);
2056 BOOST_TEST_CHECK(fCColor.getC0() == 0.0);
2057 BOOST_TEST_CHECK(fMColor.getC0() == 1.0);
2058 BOOST_TEST_CHECK(f1Color.getC0() == 1.0);
2059
2060 BOOST_TEST_CHECK(f0Color.getC1() == 0.0);
2061 BOOST_TEST_CHECK(fRColor.getC1() == 0.0);
2062 BOOST_TEST_CHECK(fGColor.getC1() == 1.0);
2063 BOOST_TEST_CHECK(fBColor.getC1() == 0.0);
2064 BOOST_TEST_CHECK(fYColor.getC1() == 1.0);
2065 BOOST_TEST_CHECK(fCColor.getC1() == 1.0);
2066 BOOST_TEST_CHECK(fMColor.getC1() == 0.0);
2067 BOOST_TEST_CHECK(f1Color.getC1() == 1.0);
2068
2069 BOOST_TEST_CHECK(f0Color.getC2() == 0.0);
2070 BOOST_TEST_CHECK(fRColor.getC2() == 0.0);
2071 BOOST_TEST_CHECK(fGColor.getC2() == 0.0);
2072 BOOST_TEST_CHECK(fBColor.getC2() == 1.0);
2073 BOOST_TEST_CHECK(fYColor.getC2() == 0.0);
2074 BOOST_TEST_CHECK(fCColor.getC2() == 1.0);
2075 BOOST_TEST_CHECK(fMColor.getC2() == 1.0);
2076 BOOST_TEST_CHECK(f1Color.getC2() == 1.0);
2077
2078 BOOST_TEST_CHECK(f0Color.getC3() == 0.0);
2079 BOOST_TEST_CHECK(fRColor.getC3() == 0.0); // primary
2080 BOOST_TEST_CHECK(fGColor.getC3() == 0.0); // primary
2081 BOOST_TEST_CHECK(fBColor.getC3() == 0.0); // primary
2082 BOOST_TEST_CHECK(fYColor.getC3() == 1.0); // secondary
2083 BOOST_TEST_CHECK(fCColor.getC3() == 1.0); // secondary
2084 BOOST_TEST_CHECK(fMColor.getC3() == 1.0); // secondary
2085 BOOST_TEST_CHECK(f1Color.getC3() == 1.0);
2086
2087 // magic string -- corner with single character.
2088
2089 mjr::color4c64F g0Color("0");
2090 mjr::color4c64F gRColor("R");
2091 mjr::color4c64F gGColor("G");
2092 mjr::color4c64F gBColor("B");
2093 mjr::color4c64F gYColor("Y");
2094 mjr::color4c64F gCColor("C");
2095 mjr::color4c64F gMColor("M");
2096 mjr::color4c64F g1Color("W");
2097
2098 BOOST_TEST_CHECK(g0Color.getC0() == 0.0);
2099 BOOST_TEST_CHECK(gRColor.getC0() == 1.0);
2100 BOOST_TEST_CHECK(gGColor.getC0() == 0.0);
2101 BOOST_TEST_CHECK(gBColor.getC0() == 0.0);
2102 BOOST_TEST_CHECK(gYColor.getC0() == 1.0);
2103 BOOST_TEST_CHECK(gCColor.getC0() == 0.0);
2104 BOOST_TEST_CHECK(gMColor.getC0() == 1.0);
2105 BOOST_TEST_CHECK(g1Color.getC0() == 1.0);
2106
2107 BOOST_TEST_CHECK(g0Color.getC1() == 0.0);
2108 BOOST_TEST_CHECK(gRColor.getC1() == 0.0);
2109 BOOST_TEST_CHECK(gGColor.getC1() == 1.0);
2110 BOOST_TEST_CHECK(gBColor.getC1() == 0.0);
2111 BOOST_TEST_CHECK(gYColor.getC1() == 1.0);
2112 BOOST_TEST_CHECK(gCColor.getC1() == 1.0);
2113 BOOST_TEST_CHECK(gMColor.getC1() == 0.0);
2114 BOOST_TEST_CHECK(g1Color.getC1() == 1.0);
2115
2116 BOOST_TEST_CHECK(g0Color.getC2() == 0.0);
2117 BOOST_TEST_CHECK(gRColor.getC2() == 0.0);
2118 BOOST_TEST_CHECK(gGColor.getC2() == 0.0);
2119 BOOST_TEST_CHECK(gBColor.getC2() == 1.0);
2120 BOOST_TEST_CHECK(gYColor.getC2() == 0.0);
2121 BOOST_TEST_CHECK(gCColor.getC2() == 1.0);
2122 BOOST_TEST_CHECK(gMColor.getC2() == 1.0);
2123 BOOST_TEST_CHECK(g1Color.getC2() == 1.0);
2124
2125 BOOST_TEST_CHECK(g0Color.getC3() == 0.0);
2126 BOOST_TEST_CHECK(gRColor.getC3() == 0.0); // primary
2127 BOOST_TEST_CHECK(gGColor.getC3() == 0.0); // primary
2128 BOOST_TEST_CHECK(gBColor.getC3() == 0.0); // primary
2129 BOOST_TEST_CHECK(gYColor.getC3() == 1.0); // secondary
2130 BOOST_TEST_CHECK(gCColor.getC3() == 1.0); // secondary
2131 BOOST_TEST_CHECK(gMColor.getC3() == 1.0); // secondary
2132 BOOST_TEST_CHECK(g1Color.getC3() == 1.0);
2133
2134 // magic string -- corner with full name
2135
2136 mjr::color4c64F h0Color("black");
2137 mjr::color4c64F hRColor("Red");
2138 mjr::color4c64F hGColor("GREEN");
2139 mjr::color4c64F hBColor("blue");
2140 mjr::color4c64F hYColor("YeLLoW");
2141 mjr::color4c64F hCColor("CYAN");
2142 mjr::color4c64F hMColor("MAGENTA");
2143 mjr::color4c64F h1Color("White");
2144
2145 BOOST_TEST_CHECK(h0Color.getC0() == 0.0);
2146 BOOST_TEST_CHECK(hRColor.getC0() == 1.0);
2147 BOOST_TEST_CHECK(hGColor.getC0() == 0.0);
2148 BOOST_TEST_CHECK(hBColor.getC0() == 0.0);
2149 BOOST_TEST_CHECK(hYColor.getC0() == 1.0);
2150 BOOST_TEST_CHECK(hCColor.getC0() == 0.0);
2151 BOOST_TEST_CHECK(hMColor.getC0() == 1.0);
2152 BOOST_TEST_CHECK(h1Color.getC0() == 1.0);
2153
2154 BOOST_TEST_CHECK(h0Color.getC1() == 0.0);
2155 BOOST_TEST_CHECK(hRColor.getC1() == 0.0);
2156 BOOST_TEST_CHECK(hGColor.getC1() == 1.0);
2157 BOOST_TEST_CHECK(hBColor.getC1() == 0.0);
2158 BOOST_TEST_CHECK(hYColor.getC1() == 1.0);
2159 BOOST_TEST_CHECK(hCColor.getC1() == 1.0);
2160 BOOST_TEST_CHECK(hMColor.getC1() == 0.0);
2161 BOOST_TEST_CHECK(h1Color.getC1() == 1.0);
2162
2163 BOOST_TEST_CHECK(h0Color.getC2() == 0.0);
2164 BOOST_TEST_CHECK(hRColor.getC2() == 0.0);
2165 BOOST_TEST_CHECK(hGColor.getC2() == 0.0);
2166 BOOST_TEST_CHECK(hBColor.getC2() == 1.0);
2167 BOOST_TEST_CHECK(hYColor.getC2() == 0.0);
2168 BOOST_TEST_CHECK(hCColor.getC2() == 1.0);
2169 BOOST_TEST_CHECK(hMColor.getC2() == 1.0);
2170 BOOST_TEST_CHECK(h1Color.getC2() == 1.0);
2171
2172 BOOST_TEST_CHECK(h0Color.getC3() == 0.0);
2173 BOOST_TEST_CHECK(hRColor.getC3() == 0.0); // primary
2174 BOOST_TEST_CHECK(hGColor.getC3() == 0.0); // primary
2175 BOOST_TEST_CHECK(hBColor.getC3() == 0.0); // primary
2176 BOOST_TEST_CHECK(hYColor.getC3() == 1.0); // secondary
2177 BOOST_TEST_CHECK(hCColor.getC3() == 1.0); // secondary
2178 BOOST_TEST_CHECK(hMColor.getC3() == 1.0); // secondary
2179 BOOST_TEST_CHECK(h1Color.getC3() == 1.0);
2180
2181 mjr::color4c64F iColor("zoogo"); // unknown color => black
2182 BOOST_TEST_CHECK(iColor.getC0() == 0.0);
2183 BOOST_TEST_CHECK(iColor.getC1() == 0.0);
2184 BOOST_TEST_CHECK(iColor.getC2() == 0.0);
2185 BOOST_TEST_CHECK(iColor.getC3() == 0.0);
2186
2187 mjr::color4c64F jColor("z"); // unknown color => black
2188 BOOST_TEST_CHECK(jColor.getC0() == 0.0);
2189 BOOST_TEST_CHECK(jColor.getC1() == 0.0);
2190 BOOST_TEST_CHECK(jColor.getC2() == 0.0);
2191 BOOST_TEST_CHECK(jColor.getC3() == 0.0);
2192
2193 // magic string -- hex color string
2194
2195 mjr::color4c64F kColor("#aaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbccccccccccccccccdddddddddddddddd");
2196 BOOST_TEST_CHECK(kColor.getC0() == 0.66666666666, boost::test_tools::tolerance(0.00001));
2197 BOOST_TEST_CHECK(kColor.getC1() == 0.73333333333, boost::test_tools::tolerance(0.00001));
2198 BOOST_TEST_CHECK(kColor.getC2() == 0.80000000000, boost::test_tools::tolerance(0.00001));
2199 BOOST_TEST_CHECK(kColor.getC3() == 0.86666666666, boost::test_tools::tolerance(0.00001));
2200
2201 // Init List
2202
2203 mjr::color4c64F oColor({1, 2, 3, 4});
2204 BOOST_TEST_CHECK(oColor.getChan(0) == 1);
2205 BOOST_TEST_CHECK(oColor.getChan(1) == 2);
2206 BOOST_TEST_CHECK(oColor.getChan(2) == 3);
2207 BOOST_TEST_CHECK(oColor.getChan(3) == 4);
2208
2209 mjr::color4c64F pColor({1, 2, 3}); // size mismatch -> all chans to zero
2210 BOOST_TEST_CHECK(pColor.getChan(0) == 1);
2211 BOOST_TEST_CHECK(pColor.getChan(1) == 2);
2212 BOOST_TEST_CHECK(pColor.getChan(2) == 3);
2213 BOOST_TEST_CHECK(pColor.getChan(3) == 0);
2214 }
2215
2216////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2217BOOST_AUTO_TEST_CASE(constr_8b) {
2218
2219 mjr::color4c8b aColor(123);
2220 BOOST_TEST_CHECK(aColor.getChan(0) == 123);
2221 BOOST_TEST_CHECK(aColor.getChan(1) == 123);
2222 BOOST_TEST_CHECK(aColor.getChan(2) == 123);
2223 BOOST_TEST_CHECK(aColor.getChan(3) == 123);
2224
2225 mjr::color4c8b cColor(33, 44, 55);
2226 BOOST_TEST_CHECK(cColor.getChan(0) == 33);
2227 BOOST_TEST_CHECK(cColor.getChan(1) == 44);
2228 BOOST_TEST_CHECK(cColor.getChan(2) == 55);
2229 BOOST_TEST_CHECK(cColor.getChan(3) == 0);
2230
2231 mjr::color4c8b dColor(66, 77, 88, 99);
2232 BOOST_TEST_CHECK(dColor.getChan(0) == 66);
2233 BOOST_TEST_CHECK(dColor.getChan(1) == 77);
2234 BOOST_TEST_CHECK(dColor.getChan(2) == 88);
2235 BOOST_TEST_CHECK(dColor.getChan(3) == 99);
2236
2237 mjr::color4c8b eColor(dColor);
2238 BOOST_TEST_CHECK(eColor.getChan(0) == 66);
2239 BOOST_TEST_CHECK(eColor.getChan(1) == 77);
2240 BOOST_TEST_CHECK(eColor.getChan(2) == 88);
2241 BOOST_TEST_CHECK(eColor.getChan(3) == 99);
2242
2243 mjr::color4c8b f0Color(mjr::color4c8b::cornerColorEnum::BLACK);
2244 mjr::color4c8b fRColor(mjr::color4c8b::cornerColorEnum::RED);
2245 mjr::color4c8b fGColor(mjr::color4c8b::cornerColorEnum::GREEN);
2246 mjr::color4c8b fBColor(mjr::color4c8b::cornerColorEnum::BLUE);
2247 mjr::color4c8b fYColor(mjr::color4c8b::cornerColorEnum::YELLOW);
2248 mjr::color4c8b fCColor(mjr::color4c8b::cornerColorEnum::CYAN);
2249 mjr::color4c8b fMColor(mjr::color4c8b::cornerColorEnum::MAGENTA);
2250 mjr::color4c8b f1Color(mjr::color4c8b::cornerColorEnum::WHITE);
2251
2252 BOOST_TEST_CHECK(f0Color.getC0() == 0);
2253 BOOST_TEST_CHECK(fRColor.getC0() == 255);
2254 BOOST_TEST_CHECK(fGColor.getC0() == 0);
2255 BOOST_TEST_CHECK(fBColor.getC0() == 0);
2256 BOOST_TEST_CHECK(fYColor.getC0() == 255);
2257 BOOST_TEST_CHECK(fCColor.getC0() == 0);
2258 BOOST_TEST_CHECK(fMColor.getC0() == 255);
2259 BOOST_TEST_CHECK(f1Color.getC0() == 255);
2260
2261 BOOST_TEST_CHECK(f0Color.getC1() == 0);
2262 BOOST_TEST_CHECK(fRColor.getC1() == 0);
2263 BOOST_TEST_CHECK(fGColor.getC1() == 255);
2264 BOOST_TEST_CHECK(fBColor.getC1() == 0);
2265 BOOST_TEST_CHECK(fYColor.getC1() == 255);
2266 BOOST_TEST_CHECK(fCColor.getC1() == 255);
2267 BOOST_TEST_CHECK(fMColor.getC1() == 0);
2268 BOOST_TEST_CHECK(f1Color.getC1() == 255);
2269
2270 BOOST_TEST_CHECK(f0Color.getC2() == 0);
2271 BOOST_TEST_CHECK(fRColor.getC2() == 0);
2272 BOOST_TEST_CHECK(fGColor.getC2() == 0);
2273 BOOST_TEST_CHECK(fBColor.getC2() == 255);
2274 BOOST_TEST_CHECK(fYColor.getC2() == 0);
2275 BOOST_TEST_CHECK(fCColor.getC2() == 255);
2276 BOOST_TEST_CHECK(fMColor.getC2() == 255);
2277 BOOST_TEST_CHECK(f1Color.getC2() == 255);
2278
2279 BOOST_TEST_CHECK(f0Color.getC3() == 0);
2280 BOOST_TEST_CHECK(fRColor.getC3() == 0); // primary
2281 BOOST_TEST_CHECK(fGColor.getC3() == 0); // primary
2282 BOOST_TEST_CHECK(fBColor.getC3() == 0); // primary
2283 BOOST_TEST_CHECK(fYColor.getC3() == 255); // secondary
2284 BOOST_TEST_CHECK(fCColor.getC3() == 255); // secondary
2285 BOOST_TEST_CHECK(fMColor.getC3() == 255); // secondary
2286 BOOST_TEST_CHECK(f1Color.getC3() == 255);
2287
2288 // magic string -- corner with single character.
2289
2290 mjr::color4c8b g0Color("0");
2291 mjr::color4c8b gRColor("R");
2292 mjr::color4c8b gGColor("G");
2293 mjr::color4c8b gBColor("B");
2294 mjr::color4c8b gYColor("Y");
2295 mjr::color4c8b gCColor("C");
2296 mjr::color4c8b gMColor("M");
2297 mjr::color4c8b g1Color("W");
2298
2299 BOOST_TEST_CHECK(g0Color.getC0() == 0);
2300 BOOST_TEST_CHECK(gRColor.getC0() == 255);
2301 BOOST_TEST_CHECK(gGColor.getC0() == 0);
2302 BOOST_TEST_CHECK(gBColor.getC0() == 0);
2303 BOOST_TEST_CHECK(gYColor.getC0() == 255);
2304 BOOST_TEST_CHECK(gCColor.getC0() == 0);
2305 BOOST_TEST_CHECK(gMColor.getC0() == 255);
2306 BOOST_TEST_CHECK(g1Color.getC0() == 255);
2307
2308 BOOST_TEST_CHECK(g0Color.getC1() == 0);
2309 BOOST_TEST_CHECK(gRColor.getC1() == 0);
2310 BOOST_TEST_CHECK(gGColor.getC1() == 255);
2311 BOOST_TEST_CHECK(gBColor.getC1() == 0);
2312 BOOST_TEST_CHECK(gYColor.getC1() == 255);
2313 BOOST_TEST_CHECK(gCColor.getC1() == 255);
2314 BOOST_TEST_CHECK(gMColor.getC1() == 0);
2315 BOOST_TEST_CHECK(g1Color.getC1() == 255);
2316
2317 BOOST_TEST_CHECK(g0Color.getC2() == 0);
2318 BOOST_TEST_CHECK(gRColor.getC2() == 0);
2319 BOOST_TEST_CHECK(gGColor.getC2() == 0);
2320 BOOST_TEST_CHECK(gBColor.getC2() == 255);
2321 BOOST_TEST_CHECK(gYColor.getC2() == 0);
2322 BOOST_TEST_CHECK(gCColor.getC2() == 255);
2323 BOOST_TEST_CHECK(gMColor.getC2() == 255);
2324 BOOST_TEST_CHECK(g1Color.getC2() == 255);
2325
2326 BOOST_TEST_CHECK(g0Color.getC3() == 0);
2327 BOOST_TEST_CHECK(gRColor.getC3() == 0); // primary
2328 BOOST_TEST_CHECK(gGColor.getC3() == 0); // primary
2329 BOOST_TEST_CHECK(gBColor.getC3() == 0); // primary
2330 BOOST_TEST_CHECK(gYColor.getC3() == 255); // secondary
2331 BOOST_TEST_CHECK(gCColor.getC3() == 255); // secondary
2332 BOOST_TEST_CHECK(gMColor.getC3() == 255); // secondary
2333 BOOST_TEST_CHECK(g1Color.getC3() == 255);
2334
2335 // magic string -- corner with full name
2336
2337 mjr::color4c8b h0Color("black");
2338 mjr::color4c8b hRColor("Red");
2339 mjr::color4c8b hGColor("GREEN");
2340 mjr::color4c8b hBColor("blue");
2341 mjr::color4c8b hYColor("YeLLoW");
2342 mjr::color4c8b hCColor("CYAN");
2343 mjr::color4c8b hMColor("MAGENTA");
2344 mjr::color4c8b h1Color("White");
2345
2346 BOOST_TEST_CHECK(h0Color.getC0() == 0);
2347 BOOST_TEST_CHECK(hRColor.getC0() == 255);
2348 BOOST_TEST_CHECK(hGColor.getC0() == 0);
2349 BOOST_TEST_CHECK(hBColor.getC0() == 0);
2350 BOOST_TEST_CHECK(hYColor.getC0() == 255);
2351 BOOST_TEST_CHECK(hCColor.getC0() == 0);
2352 BOOST_TEST_CHECK(hMColor.getC0() == 255);
2353 BOOST_TEST_CHECK(h1Color.getC0() == 255);
2354
2355 BOOST_TEST_CHECK(h0Color.getC1() == 0);
2356 BOOST_TEST_CHECK(hRColor.getC1() == 0);
2357 BOOST_TEST_CHECK(hGColor.getC1() == 255);
2358 BOOST_TEST_CHECK(hBColor.getC1() == 0);
2359 BOOST_TEST_CHECK(hYColor.getC1() == 255);
2360 BOOST_TEST_CHECK(hCColor.getC1() == 255);
2361 BOOST_TEST_CHECK(hMColor.getC1() == 0);
2362 BOOST_TEST_CHECK(h1Color.getC1() == 255);
2363
2364 BOOST_TEST_CHECK(h0Color.getC2() == 0);
2365 BOOST_TEST_CHECK(hRColor.getC2() == 0);
2366 BOOST_TEST_CHECK(hGColor.getC2() == 0);
2367 BOOST_TEST_CHECK(hBColor.getC2() == 255);
2368 BOOST_TEST_CHECK(hYColor.getC2() == 0);
2369 BOOST_TEST_CHECK(hCColor.getC2() == 255);
2370 BOOST_TEST_CHECK(hMColor.getC2() == 255);
2371 BOOST_TEST_CHECK(h1Color.getC2() == 255);
2372
2373 BOOST_TEST_CHECK(h0Color.getC3() == 0);
2374 BOOST_TEST_CHECK(hRColor.getC3() == 0); // primary
2375 BOOST_TEST_CHECK(hGColor.getC3() == 0); // primary
2376 BOOST_TEST_CHECK(hBColor.getC3() == 0); // primary
2377 BOOST_TEST_CHECK(hYColor.getC3() == 255); // secondary
2378 BOOST_TEST_CHECK(hCColor.getC3() == 255); // secondary
2379 BOOST_TEST_CHECK(hMColor.getC3() == 255); // secondary
2380 BOOST_TEST_CHECK(h1Color.getC3() == 255);
2381
2382 mjr::color4c8b iColor("zoogo"); // unknown color => black
2383 BOOST_TEST_CHECK(iColor.getC0() == 0);
2384 BOOST_TEST_CHECK(iColor.getC1() == 0);
2385 BOOST_TEST_CHECK(iColor.getC2() == 0);
2386 BOOST_TEST_CHECK(iColor.getC3() == 0);
2387
2388 mjr::color4c8b jColor("z"); // unknown color => black
2389 BOOST_TEST_CHECK(jColor.getC0() == 0);
2390 BOOST_TEST_CHECK(jColor.getC1() == 0);
2391 BOOST_TEST_CHECK(jColor.getC2() == 0);
2392 BOOST_TEST_CHECK(jColor.getC3() == 0);
2393
2394 // magic string -- hex color strings
2395
2396 mjr::color4c8b kColor("#aabbccdd");
2397 BOOST_TEST_CHECK(kColor.getC0() == 0xAA);
2398 BOOST_TEST_CHECK(kColor.getC1() == 0xBB);
2399 BOOST_TEST_CHECK(kColor.getC2() == 0xCC);
2400 BOOST_TEST_CHECK(kColor.getC3() == 0xDD);
2401
2402 mjr::color4c8b lColor("#bbccdd");
2403 BOOST_TEST_CHECK(lColor.getC0() == 0xBB);
2404 BOOST_TEST_CHECK(lColor.getC1() == 0xCC);
2405 BOOST_TEST_CHECK(lColor.getC2() == 0xDD);
2406 BOOST_TEST_CHECK(lColor.getC3() == 0x0);
2407
2408 mjr::color4c8b mColor("#aa");
2409 BOOST_TEST_CHECK(mColor.getC0() == 0xAA);
2410 BOOST_TEST_CHECK(mColor.getC1() == 0x0);
2411 BOOST_TEST_CHECK(mColor.getC2() == 0x0);
2412 BOOST_TEST_CHECK(mColor.getC3() == 0x0);
2413
2414 mjr::color4c8b nColor("#a");
2415 BOOST_TEST_CHECK(nColor.getC0() == 0x0);
2416 BOOST_TEST_CHECK(nColor.getC1() == 0x0);
2417 BOOST_TEST_CHECK(nColor.getC2() == 0x0);
2418 BOOST_TEST_CHECK(nColor.getC3() == 0x0);
2419
2420 // Init List
2421
2422 mjr::color4c8b oColor({1, 2, 3, 4});
2423 BOOST_TEST_CHECK(oColor.getChan(0) == 1);
2424 BOOST_TEST_CHECK(oColor.getChan(1) == 2);
2425 BOOST_TEST_CHECK(oColor.getChan(2) == 3);
2426 BOOST_TEST_CHECK(oColor.getChan(3) == 4);
2427
2428 mjr::color4c8b pColor({1, 2, 3});
2429 BOOST_TEST_CHECK(pColor.getChan(0) == 1);
2430 BOOST_TEST_CHECK(pColor.getChan(1) == 2);
2431 BOOST_TEST_CHECK(pColor.getChan(2) == 3);
2432 BOOST_TEST_CHECK(pColor.getChan(3) == 0); // unsp -> zero
2433
2434 mjr::color4c8b qColor({1});
2435 BOOST_TEST_CHECK(qColor.getChan(0) == 1);
2436 BOOST_TEST_CHECK(qColor.getChan(1) == 0); // unsp -> zero
2437 BOOST_TEST_CHECK(qColor.getChan(2) == 0); // unsp -> zero
2438 BOOST_TEST_CHECK(qColor.getChan(3) == 0); // unsp -> zero
2439
2440 mjr::color4c8b rColor({1, 2, 3, 4, 5, 6});
2441 BOOST_TEST_CHECK(rColor.getChan(0) == 1);
2442 BOOST_TEST_CHECK(rColor.getChan(1) == 2);
2443 BOOST_TEST_CHECK(rColor.getChan(2) == 3);
2444 BOOST_TEST_CHECK(rColor.getChan(3) == 4);
2445 }
2446
2447////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2448BOOST_AUTO_TEST_CASE(constr_16b) {
2449
2450 mjr::color4c16b aColor(123);
2451 BOOST_TEST_CHECK(aColor.getChan(0) == 123);
2452 BOOST_TEST_CHECK(aColor.getChan(1) == 123);
2453 BOOST_TEST_CHECK(aColor.getChan(2) == 123);
2454 BOOST_TEST_CHECK(aColor.getChan(3) == 123);
2455
2456 mjr::color4c16b cColor(33, 44, 55);
2457 BOOST_TEST_CHECK(cColor.getChan(0) == 33);
2458 BOOST_TEST_CHECK(cColor.getChan(1) == 44);
2459 BOOST_TEST_CHECK(cColor.getChan(2) == 55);
2460 BOOST_TEST_CHECK(cColor.getChan(3) == 0);
2461
2462 mjr::color4c16b dColor(66, 77, 88, 99);
2463 BOOST_TEST_CHECK(dColor.getChan(0) == 66);
2464 BOOST_TEST_CHECK(dColor.getChan(1) == 77);
2465 BOOST_TEST_CHECK(dColor.getChan(2) == 88);
2466 BOOST_TEST_CHECK(dColor.getChan(3) == 99);
2467
2468 mjr::color4c16b eColor(dColor);
2469 BOOST_TEST_CHECK(eColor.getChan(0) == 66);
2470 BOOST_TEST_CHECK(eColor.getChan(1) == 77);
2471 BOOST_TEST_CHECK(eColor.getChan(2) == 88);
2472 BOOST_TEST_CHECK(eColor.getChan(3) == 99);
2473
2474 mjr::color4c16b f0Color(mjr::color4c16b::cornerColorEnum::BLACK);
2475 mjr::color4c16b fRColor(mjr::color4c16b::cornerColorEnum::RED);
2476 mjr::color4c16b fGColor(mjr::color4c16b::cornerColorEnum::GREEN);
2477 mjr::color4c16b fBColor(mjr::color4c16b::cornerColorEnum::BLUE);
2478 mjr::color4c16b fYColor(mjr::color4c16b::cornerColorEnum::YELLOW);
2479 mjr::color4c16b fCColor(mjr::color4c16b::cornerColorEnum::CYAN);
2480 mjr::color4c16b fMColor(mjr::color4c16b::cornerColorEnum::MAGENTA);
2481 mjr::color4c16b f1Color(mjr::color4c16b::cornerColorEnum::WHITE);
2482
2483 BOOST_TEST_CHECK(f0Color.getC0() == 0);
2484 BOOST_TEST_CHECK(fRColor.getC0() == 65535);
2485 BOOST_TEST_CHECK(fGColor.getC0() == 0);
2486 BOOST_TEST_CHECK(fBColor.getC0() == 0);
2487 BOOST_TEST_CHECK(fYColor.getC0() == 65535);
2488 BOOST_TEST_CHECK(fCColor.getC0() == 0);
2489 BOOST_TEST_CHECK(fMColor.getC0() == 65535);
2490 BOOST_TEST_CHECK(f1Color.getC0() == 65535);
2491
2492 BOOST_TEST_CHECK(f0Color.getC1() == 0);
2493 BOOST_TEST_CHECK(fRColor.getC1() == 0);
2494 BOOST_TEST_CHECK(fGColor.getC1() == 65535);
2495 BOOST_TEST_CHECK(fBColor.getC1() == 0);
2496 BOOST_TEST_CHECK(fYColor.getC1() == 65535);
2497 BOOST_TEST_CHECK(fCColor.getC1() == 65535);
2498 BOOST_TEST_CHECK(fMColor.getC1() == 0);
2499 BOOST_TEST_CHECK(f1Color.getC1() == 65535);
2500
2501 BOOST_TEST_CHECK(f0Color.getC2() == 0);
2502 BOOST_TEST_CHECK(fRColor.getC2() == 0);
2503 BOOST_TEST_CHECK(fGColor.getC2() == 0);
2504 BOOST_TEST_CHECK(fBColor.getC2() == 65535);
2505 BOOST_TEST_CHECK(fYColor.getC2() == 0);
2506 BOOST_TEST_CHECK(fCColor.getC2() == 65535);
2507 BOOST_TEST_CHECK(fMColor.getC2() == 65535);
2508 BOOST_TEST_CHECK(f1Color.getC2() == 65535);
2509
2510 BOOST_TEST_CHECK(f0Color.getC3() == 0);
2511 BOOST_TEST_CHECK(fRColor.getC3() == 0); // primary
2512 BOOST_TEST_CHECK(fGColor.getC3() == 0); // primary
2513 BOOST_TEST_CHECK(fBColor.getC3() == 0); // primary
2514 BOOST_TEST_CHECK(fYColor.getC3() == 65535); // secondary
2515 BOOST_TEST_CHECK(fCColor.getC3() == 65535); // secondary
2516 BOOST_TEST_CHECK(fMColor.getC3() == 65535); // secondary
2517 BOOST_TEST_CHECK(f1Color.getC3() == 65535);
2518
2519 // magic string -- corner with single character.
2520
2521 mjr::color4c16b g0Color("0");
2522 mjr::color4c16b gRColor("R");
2523 mjr::color4c16b gGColor("G");
2524 mjr::color4c16b gBColor("B");
2525 mjr::color4c16b gYColor("Y");
2526 mjr::color4c16b gCColor("C");
2527 mjr::color4c16b gMColor("M");
2528 mjr::color4c16b g1Color("W");
2529
2530 BOOST_TEST_CHECK(g0Color.getC0() == 0);
2531 BOOST_TEST_CHECK(gRColor.getC0() == 65535);
2532 BOOST_TEST_CHECK(gGColor.getC0() == 0);
2533 BOOST_TEST_CHECK(gBColor.getC0() == 0);
2534 BOOST_TEST_CHECK(gYColor.getC0() == 65535);
2535 BOOST_TEST_CHECK(gCColor.getC0() == 0);
2536 BOOST_TEST_CHECK(gMColor.getC0() == 65535);
2537 BOOST_TEST_CHECK(g1Color.getC0() == 65535);
2538
2539 BOOST_TEST_CHECK(g0Color.getC1() == 0);
2540 BOOST_TEST_CHECK(gRColor.getC1() == 0);
2541 BOOST_TEST_CHECK(gGColor.getC1() == 65535);
2542 BOOST_TEST_CHECK(gBColor.getC1() == 0);
2543 BOOST_TEST_CHECK(gYColor.getC1() == 65535);
2544 BOOST_TEST_CHECK(gCColor.getC1() == 65535);
2545 BOOST_TEST_CHECK(gMColor.getC1() == 0);
2546 BOOST_TEST_CHECK(g1Color.getC1() == 65535);
2547
2548 BOOST_TEST_CHECK(g0Color.getC2() == 0);
2549 BOOST_TEST_CHECK(gRColor.getC2() == 0);
2550 BOOST_TEST_CHECK(gGColor.getC2() == 0);
2551 BOOST_TEST_CHECK(gBColor.getC2() == 65535);
2552 BOOST_TEST_CHECK(gYColor.getC2() == 0);
2553 BOOST_TEST_CHECK(gCColor.getC2() == 65535);
2554 BOOST_TEST_CHECK(gMColor.getC2() == 65535);
2555 BOOST_TEST_CHECK(g1Color.getC2() == 65535);
2556
2557 BOOST_TEST_CHECK(g0Color.getC3() == 0);
2558 BOOST_TEST_CHECK(gRColor.getC3() == 0); // primary
2559 BOOST_TEST_CHECK(gGColor.getC3() == 0); // primary
2560 BOOST_TEST_CHECK(gBColor.getC3() == 0); // primary
2561 BOOST_TEST_CHECK(gYColor.getC3() == 65535); // secondary
2562 BOOST_TEST_CHECK(gCColor.getC3() == 65535); // secondary
2563 BOOST_TEST_CHECK(gMColor.getC3() == 65535); // secondary
2564 BOOST_TEST_CHECK(g1Color.getC3() == 65535);
2565
2566 // magic string -- corner with full name
2567
2568 mjr::color4c16b h0Color("black");
2569 mjr::color4c16b hRColor("Red");
2570 mjr::color4c16b hGColor("GREEN");
2571 mjr::color4c16b hBColor("blue");
2572 mjr::color4c16b hYColor("YeLLoW");
2573 mjr::color4c16b hCColor("CYAN");
2574 mjr::color4c16b hMColor("MAGENTA");
2575 mjr::color4c16b h1Color("White");
2576
2577 BOOST_TEST_CHECK(h0Color.getC0() == 0);
2578 BOOST_TEST_CHECK(hRColor.getC0() == 65535);
2579 BOOST_TEST_CHECK(hGColor.getC0() == 0);
2580 BOOST_TEST_CHECK(hBColor.getC0() == 0);
2581 BOOST_TEST_CHECK(hYColor.getC0() == 65535);
2582 BOOST_TEST_CHECK(hCColor.getC0() == 0);
2583 BOOST_TEST_CHECK(hMColor.getC0() == 65535);
2584 BOOST_TEST_CHECK(h1Color.getC0() == 65535);
2585
2586 BOOST_TEST_CHECK(h0Color.getC1() == 0);
2587 BOOST_TEST_CHECK(hRColor.getC1() == 0);
2588 BOOST_TEST_CHECK(hGColor.getC1() == 65535);
2589 BOOST_TEST_CHECK(hBColor.getC1() == 0);
2590 BOOST_TEST_CHECK(hYColor.getC1() == 65535);
2591 BOOST_TEST_CHECK(hCColor.getC1() == 65535);
2592 BOOST_TEST_CHECK(hMColor.getC1() == 0);
2593 BOOST_TEST_CHECK(h1Color.getC1() == 65535);
2594
2595 BOOST_TEST_CHECK(h0Color.getC2() == 0);
2596 BOOST_TEST_CHECK(hRColor.getC2() == 0);
2597 BOOST_TEST_CHECK(hGColor.getC2() == 0);
2598 BOOST_TEST_CHECK(hBColor.getC2() == 65535);
2599 BOOST_TEST_CHECK(hYColor.getC2() == 0);
2600 BOOST_TEST_CHECK(hCColor.getC2() == 65535);
2601 BOOST_TEST_CHECK(hMColor.getC2() == 65535);
2602 BOOST_TEST_CHECK(h1Color.getC2() == 65535);
2603
2604 BOOST_TEST_CHECK(h0Color.getC3() == 0);
2605 BOOST_TEST_CHECK(hRColor.getC3() == 0); // primary
2606 BOOST_TEST_CHECK(hGColor.getC3() == 0); // primary
2607 BOOST_TEST_CHECK(hBColor.getC3() == 0); // primary
2608 BOOST_TEST_CHECK(hYColor.getC3() == 65535); // secondary
2609 BOOST_TEST_CHECK(hCColor.getC3() == 65535); // secondary
2610 BOOST_TEST_CHECK(hMColor.getC3() == 65535); // secondary
2611 BOOST_TEST_CHECK(h1Color.getC3() == 65535);
2612
2613 mjr::color4c16b iColor("zoogo"); // unknown color => black
2614 BOOST_TEST_CHECK(iColor.getC0() == 0);
2615 BOOST_TEST_CHECK(iColor.getC1() == 0);
2616 BOOST_TEST_CHECK(iColor.getC2() == 0);
2617 BOOST_TEST_CHECK(iColor.getC3() == 0);
2618
2619 mjr::color4c16b jColor("z"); // unknown color => black
2620 BOOST_TEST_CHECK(jColor.getC0() == 0);
2621 BOOST_TEST_CHECK(jColor.getC1() == 0);
2622 BOOST_TEST_CHECK(jColor.getC2() == 0);
2623 BOOST_TEST_CHECK(jColor.getC3() == 0);
2624
2625 // magic string -- hex color string
2626
2627 mjr::color4c16b kColor("#aaaabbbbccccdddd");
2628 BOOST_TEST_CHECK(kColor.getC0() == 0xAAAA);
2629 BOOST_TEST_CHECK(kColor.getC1() == 0xBBBB);
2630 BOOST_TEST_CHECK(kColor.getC2() == 0xCCCC);
2631 BOOST_TEST_CHECK(kColor.getC3() == 0xDDDD);
2632
2633 mjr::color4c16b lColor("#bbbbccccdddd");
2634 BOOST_TEST_CHECK(lColor.getC0() == 0xBBBB);
2635 BOOST_TEST_CHECK(lColor.getC1() == 0xCCCC);
2636 BOOST_TEST_CHECK(lColor.getC2() == 0xDDDD);
2637 BOOST_TEST_CHECK(lColor.getC3() == 0x0);
2638
2639 mjr::color4c16b mColor("#aaaa");
2640 BOOST_TEST_CHECK(mColor.getC0() == 0xAAAA);
2641 BOOST_TEST_CHECK(mColor.getC1() == 0x0);
2642 BOOST_TEST_CHECK(mColor.getC2() == 0x0);
2643 BOOST_TEST_CHECK(mColor.getC3() == 0x0);
2644
2645 mjr::color4c16b nColor("#aaa");
2646 BOOST_TEST_CHECK(nColor.getC0() == 0x0);
2647 BOOST_TEST_CHECK(nColor.getC1() == 0x0);
2648 BOOST_TEST_CHECK(nColor.getC2() == 0x0);
2649 BOOST_TEST_CHECK(nColor.getC3() == 0x0);
2650
2651 // Init List
2652
2653 mjr::color4c16b oColor({1, 2, 3, 4});
2654 BOOST_TEST_CHECK(oColor.getChan(0) == 1);
2655 BOOST_TEST_CHECK(oColor.getChan(1) == 2);
2656 BOOST_TEST_CHECK(oColor.getChan(2) == 3);
2657 BOOST_TEST_CHECK(oColor.getChan(3) == 4);
2658
2659 mjr::color4c16b pColor({1, 2, 3}); // size mismatch -> all chans to zero
2660 BOOST_TEST_CHECK(pColor.getChan(0) == 1);
2661 BOOST_TEST_CHECK(pColor.getChan(1) == 2);
2662 BOOST_TEST_CHECK(pColor.getChan(2) == 3);
2663 BOOST_TEST_CHECK(pColor.getChan(3) == 0);
2664 }
2665
2666
2667////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2668BOOST_AUTO_TEST_CASE(set_chans_hex_8b) {
2669
2670 mjr::color4c8b aColor("0");
2671 aColor.setToWhite();
2672 aColor.setChans("#aabbccdd");
2673 BOOST_TEST_CHECK(aColor.getC0() == 0xAA);
2674 BOOST_TEST_CHECK(aColor.getC1() == 0xBB);
2675 BOOST_TEST_CHECK(aColor.getC2() == 0xCC);
2676 BOOST_TEST_CHECK(aColor.getC3() == 0xDD);
2677
2678 // undefined chans left alown
2679 aColor.setToWhite();
2680 aColor.setChans("#bbccdd");
2681 BOOST_TEST_CHECK(aColor.getC0() == 0xBB);
2682 BOOST_TEST_CHECK(aColor.getC1() == 0xCC);
2683 BOOST_TEST_CHECK(aColor.getC2() == 0xDD);
2684 BOOST_TEST_CHECK(aColor.getC3() == 0xFF);
2685
2686 aColor.setToWhite();
2687 aColor.setChans("#aa");
2688 BOOST_TEST_CHECK(aColor.getC0() == 0xAA);
2689 BOOST_TEST_CHECK(aColor.getC1() == 0xFF);
2690 BOOST_TEST_CHECK(aColor.getC2() == 0xFF);
2691 BOOST_TEST_CHECK(aColor.getC3() == 0xFF);
2692
2693 aColor.setToWhite();
2694 aColor.setChans("#aaa");
2695 BOOST_TEST_CHECK(aColor.getC0() == 0xFF);
2696 BOOST_TEST_CHECK(aColor.getC1() == 0xFF);
2697 BOOST_TEST_CHECK(aColor.getC2() == 0xFF);
2698 BOOST_TEST_CHECK(aColor.getC3() == 0xFF);
2699
2700 // undefined chans set to min
2701 aColor.setToWhite();
2702 aColor.setChans("#bbccdd", true);
2703 BOOST_TEST_CHECK(aColor.getC0() == 0xBB);
2704 BOOST_TEST_CHECK(aColor.getC1() == 0xCC);
2705 BOOST_TEST_CHECK(aColor.getC2() == 0xDD);
2706 BOOST_TEST_CHECK(aColor.getC3() == 0x0000);
2707
2708 aColor.setToWhite();
2709 aColor.setChans("#aa", true);
2710 BOOST_TEST_CHECK(aColor.getC0() == 0xAA);
2711 BOOST_TEST_CHECK(aColor.getC1() == 0x0000);
2712 BOOST_TEST_CHECK(aColor.getC2() == 0x0000);
2713 BOOST_TEST_CHECK(aColor.getC3() == 0x0000);
2714
2715 aColor.setToWhite();
2716 aColor.setChans("#a", true);
2717 BOOST_TEST_CHECK(aColor.getC0() == 0x0000);
2718 BOOST_TEST_CHECK(aColor.getC1() == 0x0000);
2719 BOOST_TEST_CHECK(aColor.getC2() == 0x0000);
2720 BOOST_TEST_CHECK(aColor.getC3() == 0x0000);
2721 }
2722
2723////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2724BOOST_AUTO_TEST_CASE(set_chans_hex_16b) {
2725
2726 mjr::color4c16b aColor("0");
2727 aColor.setToWhite();
2728 aColor.setChans("#aaaabbbbccccdddd");
2729 BOOST_TEST_CHECK(aColor.getC0() == 0xAAAA);
2730 BOOST_TEST_CHECK(aColor.getC1() == 0xBBBB);
2731 BOOST_TEST_CHECK(aColor.getC2() == 0xCCCC);
2732 BOOST_TEST_CHECK(aColor.getC3() == 0xDDDD);
2733
2734 // undefined chans left alown
2735 aColor.setToWhite();
2736 aColor.setChans("#bbbbccccdddd");
2737 BOOST_TEST_CHECK(aColor.getC0() == 0xBBBB);
2738 BOOST_TEST_CHECK(aColor.getC1() == 0xCCCC);
2739 BOOST_TEST_CHECK(aColor.getC2() == 0xDDDD);
2740 BOOST_TEST_CHECK(aColor.getC3() == 0xFFFF);
2741
2742 aColor.setToWhite();
2743 aColor.setChans("#aaaa");
2744 BOOST_TEST_CHECK(aColor.getC0() == 0xAAAA);
2745 BOOST_TEST_CHECK(aColor.getC1() == 0xFFFF);
2746 BOOST_TEST_CHECK(aColor.getC2() == 0xFFFF);
2747 BOOST_TEST_CHECK(aColor.getC3() == 0xFFFF);
2748
2749 aColor.setToWhite();
2750 aColor.setChans("#aaa");
2751 BOOST_TEST_CHECK(aColor.getC0() == 0xFFFF);
2752 BOOST_TEST_CHECK(aColor.getC1() == 0xFFFF);
2753 BOOST_TEST_CHECK(aColor.getC2() == 0xFFFF);
2754 BOOST_TEST_CHECK(aColor.getC3() == 0xFFFF);
2755
2756 // undefined chans set to min
2757 aColor.setToWhite();
2758 aColor.setChans("#bbbbccccdddd", true);
2759 BOOST_TEST_CHECK(aColor.getC0() == 0xBBBB);
2760 BOOST_TEST_CHECK(aColor.getC1() == 0xCCCC);
2761 BOOST_TEST_CHECK(aColor.getC2() == 0xDDDD);
2762 BOOST_TEST_CHECK(aColor.getC3() == 0x0000);
2763
2764 aColor.setToWhite();
2765 aColor.setChans("#aaaa", true);
2766 BOOST_TEST_CHECK(aColor.getC0() == 0xAAAA);
2767 BOOST_TEST_CHECK(aColor.getC1() == 0x0000);
2768 BOOST_TEST_CHECK(aColor.getC2() == 0x0000);
2769 BOOST_TEST_CHECK(aColor.getC3() == 0x0000);
2770
2771 aColor.setToWhite();
2772 aColor.setChans("#aaa", true);
2773 BOOST_TEST_CHECK(aColor.getC0() == 0x0000);
2774 BOOST_TEST_CHECK(aColor.getC1() == 0x0000);
2775 BOOST_TEST_CHECK(aColor.getC2() == 0x0000);
2776 BOOST_TEST_CHECK(aColor.getC3() == 0x0000);
2777 }
2778
2779////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2780BOOST_AUTO_TEST_CASE(set_chans_hex_64F) {
2781
2782 mjr::color4c64F aColor("0");
2783 aColor.setToWhite();
2784 aColor.setChans("#aaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbccccccccccccccccdddddddddddddddd");
2785 BOOST_TEST_CHECK(aColor.getC0() == 0.66666666666, boost::test_tools::tolerance(0.00001));
2786 BOOST_TEST_CHECK(aColor.getC1() == 0.73333333333, boost::test_tools::tolerance(0.00001));
2787 BOOST_TEST_CHECK(aColor.getC2() == 0.80000000000, boost::test_tools::tolerance(0.00001));
2788 BOOST_TEST_CHECK(aColor.getC3() == 0.86666666666, boost::test_tools::tolerance(0.00001));
2789
2790 // undefined chans left alown
2791 aColor.setToWhite();
2792 aColor.setChans("#bbbbbbbbbbbbbbbbccccccccccccccccdddddddddddddddd");
2793 BOOST_TEST_CHECK(aColor.getC0() == 0.73333333333, boost::test_tools::tolerance(0.00001));
2794 BOOST_TEST_CHECK(aColor.getC1() == 0.80000000000, boost::test_tools::tolerance(0.00001));
2795 BOOST_TEST_CHECK(aColor.getC2() == 0.86666666666, boost::test_tools::tolerance(0.00001));
2796 BOOST_TEST_CHECK(aColor.getC3() == 1.00000000000, boost::test_tools::tolerance(0.00001));
2797
2798 aColor.setToWhite();
2799 aColor.setChans("#aaaaaaaaaaaaaaaa");
2800 BOOST_TEST_CHECK(aColor.getC0() == 0.66666666666, boost::test_tools::tolerance(0.00001));
2801 BOOST_TEST_CHECK(aColor.getC1() == 1.00000000000, boost::test_tools::tolerance(0.00001));
2802 BOOST_TEST_CHECK(aColor.getC2() == 1.00000000000, boost::test_tools::tolerance(0.00001));
2803 BOOST_TEST_CHECK(aColor.getC3() == 1.00000000000, boost::test_tools::tolerance(0.00001));
2804
2805 aColor.setToWhite();
2806 aColor.setChans("#aaa");
2807 BOOST_TEST_CHECK(aColor.getC0() == 1.00000000000, boost::test_tools::tolerance(0.00001));
2808 BOOST_TEST_CHECK(aColor.getC1() == 1.00000000000, boost::test_tools::tolerance(0.00001));
2809 BOOST_TEST_CHECK(aColor.getC2() == 1.00000000000, boost::test_tools::tolerance(0.00001));
2810 BOOST_TEST_CHECK(aColor.getC3() == 1.00000000000, boost::test_tools::tolerance(0.00001));
2811
2812 // undefined chans set to min
2813 aColor.setToWhite();
2814 aColor.setChans("#bbbbbbbbbbbbbbbbccccccccccccccccdddddddddddddddd", true);
2815 BOOST_TEST_CHECK(aColor.getC0() == 0.73333333333, boost::test_tools::tolerance(0.00001));
2816 BOOST_TEST_CHECK(aColor.getC1() == 0.80000000000, boost::test_tools::tolerance(0.00001));
2817 BOOST_TEST_CHECK(aColor.getC2() == 0.86666666666, boost::test_tools::tolerance(0.00001));
2818 BOOST_TEST_CHECK(aColor.getC3() == 0.00000000000, boost::test_tools::tolerance(0.00001));
2819
2820 aColor.setToWhite();
2821 aColor.setChans("#aaaaaaaaaaaaaaaa", true);
2822 BOOST_TEST_CHECK(aColor.getC0() == 0.66666666666, boost::test_tools::tolerance(0.00001));
2823 BOOST_TEST_CHECK(aColor.getC1() == 0.00000000000, boost::test_tools::tolerance(0.00001));
2824 BOOST_TEST_CHECK(aColor.getC2() == 0.00000000000, boost::test_tools::tolerance(0.00001));
2825 BOOST_TEST_CHECK(aColor.getC3() == 0.00000000000, boost::test_tools::tolerance(0.00001));
2826
2827 aColor.setToWhite();
2828 aColor.setChans("#aaa", true);
2829 BOOST_TEST_CHECK(aColor.getC0() == 0.00000000000, boost::test_tools::tolerance(0.00001));
2830 BOOST_TEST_CHECK(aColor.getC1() == 0.00000000000, boost::test_tools::tolerance(0.00001));
2831 BOOST_TEST_CHECK(aColor.getC2() == 0.00000000000, boost::test_tools::tolerance(0.00001));
2832 BOOST_TEST_CHECK(aColor.getC3() == 0.00000000000, boost::test_tools::tolerance(0.00001));
2833
2834 }
2835
2836////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2837BOOST_AUTO_TEST_CASE(set_chan_8_RGB) {
2838
2839 // For these tests we are mostly concerned with R, G, B, & A being
2840 // put in the right places. Conversions between double/byte and
2841 // clrChanT are tested pretty well elsewhere.
2842
2843 typedef mjr::colorTpl<mjr::colChanI8, 4, 1, 2, 3, 0> colorARGB8;
2844 colorARGB8 aColor;
2845
2846 aColor.setToBlack();
2847 aColor.setRed(colorARGB8::maxChanVal);
2848
2849 BOOST_TEST_CHECK(aColor.getChan(0) == colorARGB8::minChanVal);
2850 BOOST_TEST_CHECK(aColor.getChan(1) == colorARGB8::maxChanVal);
2851 BOOST_TEST_CHECK(aColor.getChan(2) == colorARGB8::minChanVal);
2852 BOOST_TEST_CHECK(aColor.getChan(3) == colorARGB8::minChanVal);
2853
2854 aColor.setToBlack();
2855 aColor.setGreen(colorARGB8::maxChanVal);
2856
2857 BOOST_TEST_CHECK(aColor.getChan(0) == colorARGB8::minChanVal);
2858 BOOST_TEST_CHECK(aColor.getChan(1) == colorARGB8::minChanVal);
2859 BOOST_TEST_CHECK(aColor.getChan(2) == colorARGB8::maxChanVal);
2860 BOOST_TEST_CHECK(aColor.getChan(3) == colorARGB8::minChanVal);
2861
2862 aColor.setToBlack();
2863 aColor.setBlue(colorARGB8::maxChanVal);
2864
2865 BOOST_TEST_CHECK(aColor.getChan(0) == colorARGB8::minChanVal);
2866 BOOST_TEST_CHECK(aColor.getChan(1) == colorARGB8::minChanVal);
2867 BOOST_TEST_CHECK(aColor.getChan(2) == colorARGB8::minChanVal);
2868 BOOST_TEST_CHECK(aColor.getChan(3) == colorARGB8::maxChanVal);
2869
2870 aColor.setToBlack();
2871 aColor.setAlpha(colorARGB8::maxChanVal);
2872
2873 BOOST_TEST_CHECK(aColor.getChan(0) == colorARGB8::maxChanVal);
2874 BOOST_TEST_CHECK(aColor.getChan(1) == colorARGB8::minChanVal);
2875 BOOST_TEST_CHECK(aColor.getChan(2) == colorARGB8::minChanVal);
2876 BOOST_TEST_CHECK(aColor.getChan(3) == colorARGB8::minChanVal);
2877
2878//////////////////////////////////////////////////////////////////////
2879
2880 aColor.setToBlack();
2881 aColor.setRed_byte(255);
2882
2883 BOOST_TEST_CHECK(aColor.getChan(0) == colorARGB8::minChanVal);
2884 BOOST_TEST_CHECK(aColor.getChan(1) == colorARGB8::maxChanVal);
2885 BOOST_TEST_CHECK(aColor.getChan(2) == colorARGB8::minChanVal);
2886 BOOST_TEST_CHECK(aColor.getChan(3) == colorARGB8::minChanVal);
2887
2888 aColor.setToBlack();
2889 aColor.setGreen_byte(255);
2890
2891 BOOST_TEST_CHECK(aColor.getChan(0) == colorARGB8::minChanVal);
2892 BOOST_TEST_CHECK(aColor.getChan(1) == colorARGB8::minChanVal);
2893 BOOST_TEST_CHECK(aColor.getChan(2) == colorARGB8::maxChanVal);
2894 BOOST_TEST_CHECK(aColor.getChan(3) == colorARGB8::minChanVal);
2895
2896 aColor.setToBlack();
2897 aColor.setBlue_byte(255);
2898
2899 BOOST_TEST_CHECK(aColor.getChan(0) == colorARGB8::minChanVal);
2900 BOOST_TEST_CHECK(aColor.getChan(1) == colorARGB8::minChanVal);
2901 BOOST_TEST_CHECK(aColor.getChan(2) == colorARGB8::minChanVal);
2902 BOOST_TEST_CHECK(aColor.getChan(3) == colorARGB8::maxChanVal);
2903
2904 aColor.setToBlack();
2905 aColor.setAlpha_byte(255);
2906
2907 BOOST_TEST_CHECK(aColor.getChan(0) == colorARGB8::maxChanVal);
2908 BOOST_TEST_CHECK(aColor.getChan(1) == colorARGB8::minChanVal);
2909 BOOST_TEST_CHECK(aColor.getChan(2) == colorARGB8::minChanVal);
2910 BOOST_TEST_CHECK(aColor.getChan(3) == colorARGB8::minChanVal);
2911
2912//////////////////////////////////////////////////////////////////////
2913
2914 aColor.setToBlack();
2915 aColor.setRed_dbl(1.0);
2916
2917 BOOST_TEST_CHECK(aColor.getChan(0) == colorARGB8::minChanVal);
2918 BOOST_TEST_CHECK(aColor.getChan(1) == colorARGB8::maxChanVal);
2919 BOOST_TEST_CHECK(aColor.getChan(2) == colorARGB8::minChanVal);
2920 BOOST_TEST_CHECK(aColor.getChan(3) == colorARGB8::minChanVal);
2921
2922 aColor.setToBlack();
2923 aColor.setGreen_dbl(1.0);
2924
2925 BOOST_TEST_CHECK(aColor.getChan(0) == colorARGB8::minChanVal);
2926 BOOST_TEST_CHECK(aColor.getChan(1) == colorARGB8::minChanVal);
2927 BOOST_TEST_CHECK(aColor.getChan(2) == colorARGB8::maxChanVal);
2928 BOOST_TEST_CHECK(aColor.getChan(3) == colorARGB8::minChanVal);
2929
2930 aColor.setToBlack();
2931 aColor.setBlue_dbl(1.0);
2932
2933 BOOST_TEST_CHECK(aColor.getChan(0) == colorARGB8::minChanVal);
2934 BOOST_TEST_CHECK(aColor.getChan(1) == colorARGB8::minChanVal);
2935 BOOST_TEST_CHECK(aColor.getChan(2) == colorARGB8::minChanVal);
2936 BOOST_TEST_CHECK(aColor.getChan(3) == colorARGB8::maxChanVal);
2937
2938 aColor.setToBlack();
2939 aColor.setAlpha_dbl(1.0);
2940
2941 BOOST_TEST_CHECK(aColor.getChan(0) == colorARGB8::maxChanVal);
2942 BOOST_TEST_CHECK(aColor.getChan(1) == colorARGB8::minChanVal);
2943 BOOST_TEST_CHECK(aColor.getChan(2) == colorARGB8::minChanVal);
2944 BOOST_TEST_CHECK(aColor.getChan(3) == colorARGB8::minChanVal);
2945
2946//////////////////////////////////////////////////////////////////////
2947
2948 aColor.setToBlack();
2949 aColor.setChansRGBA(1, 2, 3, 4);
2950
2951 BOOST_TEST_CHECK(aColor.getChan(0) == 4);
2952 BOOST_TEST_CHECK(aColor.getChan(1) == 1);
2953 BOOST_TEST_CHECK(aColor.getChan(2) == 2);
2954 BOOST_TEST_CHECK(aColor.getChan(3) == 3);
2955
2956//////////////////////////////////////////////////////////////////////
2957
2958 aColor.setToBlack();
2959 aColor.setChansRGB(1, 2, 3);
2960
2961 BOOST_TEST_CHECK(aColor.getChan(0) == 0);
2962 BOOST_TEST_CHECK(aColor.getChan(1) == 1);
2963 BOOST_TEST_CHECK(aColor.getChan(2) == 2);
2964 BOOST_TEST_CHECK(aColor.getChan(3) == 3);
2965
2966//////////////////////////////////////////////////////////////////////
2967
2968 aColor.setToBlack();
2969 aColor.setChansRGBA_byte(1, 2, 3, 4);
2970
2971 BOOST_TEST_CHECK(aColor.getChan(0) == 4);
2972 BOOST_TEST_CHECK(aColor.getChan(1) == 1);
2973 BOOST_TEST_CHECK(aColor.getChan(2) == 2);
2974 BOOST_TEST_CHECK(aColor.getChan(3) == 3);
2975
2976//////////////////////////////////////////////////////////////////////
2977
2978 aColor.setToBlack();
2979 aColor.setChansRGB_byte(1, 2, 3);
2980
2981 BOOST_TEST_CHECK(aColor.getChan(0) == 0);
2982 BOOST_TEST_CHECK(aColor.getChan(1) == 1);
2983 BOOST_TEST_CHECK(aColor.getChan(2) == 2);
2984 BOOST_TEST_CHECK(aColor.getChan(3) == 3);
2985
2986//////////////////////////////////////////////////////////////////////
2987
2988 aColor.setToBlack();
2989 aColor.setChansRGBA_dbl(0.25, 0.50, 0.75, 1.00);
2990
2991 BOOST_TEST_CHECK(aColor.getChan(0) == 0xFF);
2992 BOOST_TEST_CHECK(aColor.getChan(1) == 0x3F);
2993 BOOST_TEST_CHECK(aColor.getChan(2) == 0x7F);
2994 BOOST_TEST_CHECK(aColor.getChan(3) == 0xBF);
2995
2996//////////////////////////////////////////////////////////////////////
2997
2998 aColor.setToBlack();
2999 aColor.setChansRGB_dbl(1.00, 0.25, 0.50);
3000
3001 BOOST_TEST_CHECK(aColor.getChan(0) == 0x00);
3002 BOOST_TEST_CHECK(aColor.getChan(1) == 0xFF);
3003 BOOST_TEST_CHECK(aColor.getChan(2) == 0x3F);
3004 BOOST_TEST_CHECK(aColor.getChan(3) == 0x7F);
3005
3006//////////////////////////////////////////////////////////////////////
3007
3008 aColor.setToBlack();
3009 aColor.setChansRGBA(colorARGB8::clrChanTup4(1, 2, 3, 4));
3010
3011 BOOST_TEST_CHECK(aColor.getChan(0) == 4);
3012 BOOST_TEST_CHECK(aColor.getChan(1) == 1);
3013 BOOST_TEST_CHECK(aColor.getChan(2) == 2);
3014 BOOST_TEST_CHECK(aColor.getChan(3) == 3);
3015
3016//////////////////////////////////////////////////////////////////////
3017
3018 aColor.setToBlack();
3019 aColor.setChansRGB(colorARGB8::clrChanTup3(1, 2, 3));
3020
3021 BOOST_TEST_CHECK(aColor.getChan(0) == 0);
3022 BOOST_TEST_CHECK(aColor.getChan(1) == 1);
3023 BOOST_TEST_CHECK(aColor.getChan(2) == 2);
3024 BOOST_TEST_CHECK(aColor.getChan(3) == 3);
3025
3026}
3027
3028////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
3029BOOST_AUTO_TEST_CASE(set_chan_16_RGB) {
3030
3031 typedef mjr::colorTpl<mjr::colChanI16, 4, 1, 2, 3, 0> colorARGB8;
3032 colorARGB8 aColor;
3033
3034 aColor.setToBlack();
3035 aColor.setRed(colorARGB8::maxChanVal);
3036
3037 BOOST_TEST_CHECK(aColor.getChan(0) == colorARGB8::minChanVal);
3038 BOOST_TEST_CHECK(aColor.getChan(1) == colorARGB8::maxChanVal);
3039 BOOST_TEST_CHECK(aColor.getChan(2) == colorARGB8::minChanVal);
3040 BOOST_TEST_CHECK(aColor.getChan(3) == colorARGB8::minChanVal);
3041
3042 aColor.setToBlack();
3043 aColor.setGreen(colorARGB8::maxChanVal);
3044
3045 BOOST_TEST_CHECK(aColor.getChan(0) == colorARGB8::minChanVal);
3046 BOOST_TEST_CHECK(aColor.getChan(1) == colorARGB8::minChanVal);
3047 BOOST_TEST_CHECK(aColor.getChan(2) == colorARGB8::maxChanVal);
3048 BOOST_TEST_CHECK(aColor.getChan(3) == colorARGB8::minChanVal);
3049
3050 aColor.setToBlack();
3051 aColor.setBlue(colorARGB8::maxChanVal);
3052
3053 BOOST_TEST_CHECK(aColor.getChan(0) == colorARGB8::minChanVal);
3054 BOOST_TEST_CHECK(aColor.getChan(1) == colorARGB8::minChanVal);
3055 BOOST_TEST_CHECK(aColor.getChan(2) == colorARGB8::minChanVal);
3056 BOOST_TEST_CHECK(aColor.getChan(3) == colorARGB8::maxChanVal);
3057
3058 aColor.setToBlack();
3059 aColor.setAlpha(colorARGB8::maxChanVal);
3060
3061 BOOST_TEST_CHECK(aColor.getChan(0) == colorARGB8::maxChanVal);
3062 BOOST_TEST_CHECK(aColor.getChan(1) == colorARGB8::minChanVal);
3063 BOOST_TEST_CHECK(aColor.getChan(2) == colorARGB8::minChanVal);
3064 BOOST_TEST_CHECK(aColor.getChan(3) == colorARGB8::minChanVal);
3065
3066//////////////////////////////////////////////////////////////////////
3067
3068 aColor.setToBlack();
3069 aColor.setRed_byte(255);
3070
3071 BOOST_TEST_CHECK(aColor.getChan(0) == colorARGB8::minChanVal);
3072 BOOST_TEST_CHECK(aColor.getChan(1) == colorARGB8::maxChanVal);
3073 BOOST_TEST_CHECK(aColor.getChan(2) == colorARGB8::minChanVal);
3074 BOOST_TEST_CHECK(aColor.getChan(3) == colorARGB8::minChanVal);
3075
3076 aColor.setToBlack();
3077 aColor.setGreen_byte(255);
3078
3079 BOOST_TEST_CHECK(aColor.getChan(0) == colorARGB8::minChanVal);
3080 BOOST_TEST_CHECK(aColor.getChan(1) == colorARGB8::minChanVal);
3081 BOOST_TEST_CHECK(aColor.getChan(2) == colorARGB8::maxChanVal);
3082 BOOST_TEST_CHECK(aColor.getChan(3) == colorARGB8::minChanVal);
3083
3084 aColor.setToBlack();
3085 aColor.setBlue_byte(255);
3086
3087 BOOST_TEST_CHECK(aColor.getChan(0) == colorARGB8::minChanVal);
3088 BOOST_TEST_CHECK(aColor.getChan(1) == colorARGB8::minChanVal);
3089 BOOST_TEST_CHECK(aColor.getChan(2) == colorARGB8::minChanVal);
3090 BOOST_TEST_CHECK(aColor.getChan(3) == colorARGB8::maxChanVal);
3091
3092 aColor.setToBlack();
3093 aColor.setAlpha_byte(255);
3094
3095 BOOST_TEST_CHECK(aColor.getChan(0) == colorARGB8::maxChanVal);
3096 BOOST_TEST_CHECK(aColor.getChan(1) == colorARGB8::minChanVal);
3097 BOOST_TEST_CHECK(aColor.getChan(2) == colorARGB8::minChanVal);
3098 BOOST_TEST_CHECK(aColor.getChan(3) == colorARGB8::minChanVal);
3099
3100//////////////////////////////////////////////////////////////////////
3101
3102 aColor.setToBlack();
3103 aColor.setRed_dbl(1.0);
3104
3105 BOOST_TEST_CHECK(aColor.getChan(0) == colorARGB8::minChanVal);
3106 BOOST_TEST_CHECK(aColor.getChan(1) == colorARGB8::maxChanVal);
3107 BOOST_TEST_CHECK(aColor.getChan(2) == colorARGB8::minChanVal);
3108 BOOST_TEST_CHECK(aColor.getChan(3) == colorARGB8::minChanVal);
3109
3110 aColor.setToBlack();
3111 aColor.setGreen_dbl(1.0);
3112
3113 BOOST_TEST_CHECK(aColor.getChan(0) == colorARGB8::minChanVal);
3114 BOOST_TEST_CHECK(aColor.getChan(1) == colorARGB8::minChanVal);
3115 BOOST_TEST_CHECK(aColor.getChan(2) == colorARGB8::maxChanVal);
3116 BOOST_TEST_CHECK(aColor.getChan(3) == colorARGB8::minChanVal);
3117
3118 aColor.setToBlack();
3119 aColor.setBlue_dbl(1.0);
3120
3121 BOOST_TEST_CHECK(aColor.getChan(0) == colorARGB8::minChanVal);
3122 BOOST_TEST_CHECK(aColor.getChan(1) == colorARGB8::minChanVal);
3123 BOOST_TEST_CHECK(aColor.getChan(2) == colorARGB8::minChanVal);
3124 BOOST_TEST_CHECK(aColor.getChan(3) == colorARGB8::maxChanVal);
3125
3126 aColor.setToBlack();
3127 aColor.setAlpha_dbl(1.0);
3128
3129 BOOST_TEST_CHECK(aColor.getChan(0) == colorARGB8::maxChanVal);
3130 BOOST_TEST_CHECK(aColor.getChan(1) == colorARGB8::minChanVal);
3131 BOOST_TEST_CHECK(aColor.getChan(2) == colorARGB8::minChanVal);
3132 BOOST_TEST_CHECK(aColor.getChan(3) == colorARGB8::minChanVal);
3133
3134//////////////////////////////////////////////////////////////////////
3135
3136 aColor.setToBlack();
3137 aColor.setChansRGBA(1, 2, 3, 4);
3138
3139 BOOST_TEST_CHECK(aColor.getChan(0) == 4);
3140 BOOST_TEST_CHECK(aColor.getChan(1) == 1);
3141 BOOST_TEST_CHECK(aColor.getChan(2) == 2);
3142 BOOST_TEST_CHECK(aColor.getChan(3) == 3);
3143
3144//////////////////////////////////////////////////////////////////////
3145
3146 aColor.setToBlack();
3147 aColor.setChansRGB(1, 2, 3);
3148
3149 BOOST_TEST_CHECK(aColor.getChan(0) == 0);
3150 BOOST_TEST_CHECK(aColor.getChan(1) == 1);
3151 BOOST_TEST_CHECK(aColor.getChan(2) == 2);
3152 BOOST_TEST_CHECK(aColor.getChan(3) == 3);
3153
3154//////////////////////////////////////////////////////////////////////
3155
3156 aColor.setToBlack();
3157 aColor.setChansRGBA_byte(1, 2, 3, 4);
3158
3159 BOOST_TEST_CHECK(aColor.getChan(0) == 1028);
3160 BOOST_TEST_CHECK(aColor.getChan(1) == 257);
3161 BOOST_TEST_CHECK(aColor.getChan(2) == 514);
3162 BOOST_TEST_CHECK(aColor.getChan(3) == 771);
3163
3164//////////////////////////////////////////////////////////////////////
3165
3166 aColor.setToBlack();
3167 aColor.setChansRGB_byte(1, 2, 3);
3168
3169 BOOST_TEST_CHECK(aColor.getChan(0) == 0);
3170 BOOST_TEST_CHECK(aColor.getChan(1) == 257);
3171 BOOST_TEST_CHECK(aColor.getChan(2) == 514);
3172 BOOST_TEST_CHECK(aColor.getChan(3) == 771);
3173
3174//////////////////////////////////////////////////////////////////////
3175
3176 aColor.setToBlack();
3177 aColor.setChansRGBA_dbl(0.25, 0.50, 0.75, 1.00);
3178
3179 BOOST_TEST_CHECK(aColor.getChan(0) == 0xFFFF);
3180 BOOST_TEST_CHECK(aColor.getChan(1) == 0x3FFF);
3181 BOOST_TEST_CHECK(aColor.getChan(2) == 0x7FFF);
3182 BOOST_TEST_CHECK(aColor.getChan(3) == 0xBFFF);
3183
3184//////////////////////////////////////////////////////////////////////
3185
3186 aColor.setToBlack();
3187 aColor.setChansRGB_dbl(1.00, 0.25, 0.50);
3188
3189 BOOST_TEST_CHECK(aColor.getChan(0) == 0x0000);
3190 BOOST_TEST_CHECK(aColor.getChan(1) == 0xFFFF);
3191 BOOST_TEST_CHECK(aColor.getChan(2) == 0x3FFF);
3192 BOOST_TEST_CHECK(aColor.getChan(3) == 0x7FFF);
3193
3194//////////////////////////////////////////////////////////////////////
3195
3196 aColor.setToBlack();
3197 aColor.setChansRGBA(colorARGB8::clrChanTup4(1, 2, 3, 4));
3198
3199 BOOST_TEST_CHECK(aColor.getChan(0) == 4);
3200 BOOST_TEST_CHECK(aColor.getChan(1) == 1);
3201 BOOST_TEST_CHECK(aColor.getChan(2) == 2);
3202 BOOST_TEST_CHECK(aColor.getChan(3) == 3);
3203
3204//////////////////////////////////////////////////////////////////////
3205
3206 aColor.setToBlack();
3207 aColor.setChansRGB(colorARGB8::clrChanTup3(1, 2, 3));
3208
3209 BOOST_TEST_CHECK(aColor.getChan(0) == 0);
3210 BOOST_TEST_CHECK(aColor.getChan(1) == 1);
3211 BOOST_TEST_CHECK(aColor.getChan(2) == 2);
3212 BOOST_TEST_CHECK(aColor.getChan(3) == 3);
3213
3214}
3215
3216////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
3217BOOST_AUTO_TEST_CASE(set8_fromLogPackIntARGB) {
3218
3219 mjr::colorARGB8b aColor;
3220 mjr::colorRGBA8b bColor;
3221 mjr::colorBGRA8b cColor;
3222 mjr::colorABGR8b dColor;
3223
3224 mjr::colorRGB8b eColor;
3225 mjr::colorBGR8b fColor;
3226
3227 aColor.setRGBAfromLogPackIntARGB(0xAABBCCDD);
3228
3229 BOOST_TEST_CHECK(aColor.getRed() == 0xBB);
3230 BOOST_TEST_CHECK(aColor.getGreen() == 0xCC);
3231 BOOST_TEST_CHECK(aColor.getBlue() == 0xDD);
3232 BOOST_TEST_CHECK(aColor.getAlpha() == 0xAA);
3233
3234 BOOST_TEST_CHECK(aColor.getC1() == 0xBB);
3235 BOOST_TEST_CHECK(aColor.getC2() == 0xCC);
3236 BOOST_TEST_CHECK(aColor.getC3() == 0xDD);
3237 BOOST_TEST_CHECK(aColor.getC0() == 0xAA);
3238
3239 aColor.setRGBfromLogPackIntARGB(0x00DDCCBB);
3240
3241 BOOST_TEST_CHECK(aColor.getRed() == 0xDD);
3242 BOOST_TEST_CHECK(aColor.getGreen() == 0xCC);
3243 BOOST_TEST_CHECK(aColor.getBlue() == 0xBB);
3244 BOOST_TEST_CHECK(aColor.getAlpha() == 0xAA); // From before
3245
3246 BOOST_TEST_CHECK(aColor.getC1() == 0xDD);
3247 BOOST_TEST_CHECK(aColor.getC2() == 0xCC);
3248 BOOST_TEST_CHECK(aColor.getC3() == 0xBB);
3249 BOOST_TEST_CHECK(aColor.getC0() == 0xAA); // From before
3250
3251 eColor.setRGBfromLogPackIntARGB(0x00DDCCBB);
3252
3253 BOOST_TEST_CHECK(eColor.getRed() == 0xDD);
3254 BOOST_TEST_CHECK(eColor.getGreen() == 0xCC);
3255 BOOST_TEST_CHECK(eColor.getBlue() == 0xBB);
3256
3257 BOOST_TEST_CHECK(eColor.getC0() == 0xDD);
3258 BOOST_TEST_CHECK(eColor.getC1() == 0xCC);
3259 BOOST_TEST_CHECK(eColor.getC2() == 0xBB);
3260
3261 bColor.setRGBAfromLogPackIntARGB(0xAABBCCDD);
3262
3263 BOOST_TEST_CHECK(bColor.getRed() == 0xBB);
3264 BOOST_TEST_CHECK(bColor.getGreen() == 0xCC);
3265 BOOST_TEST_CHECK(bColor.getBlue() == 0xDD);
3266 BOOST_TEST_CHECK(bColor.getAlpha() == 0xAA);
3267
3268 BOOST_TEST_CHECK(bColor.getC0() == 0xBB);
3269 BOOST_TEST_CHECK(bColor.getC1() == 0xCC);
3270 BOOST_TEST_CHECK(bColor.getC2() == 0xDD);
3271 BOOST_TEST_CHECK(bColor.getC3() == 0xAA);
3272
3273 bColor.setRGBfromLogPackIntARGB(0x00DDCCBB);
3274
3275 BOOST_TEST_CHECK(bColor.getRed() == 0xDD);
3276 BOOST_TEST_CHECK(bColor.getGreen() == 0xCC);
3277 BOOST_TEST_CHECK(bColor.getBlue() == 0xBB);
3278 BOOST_TEST_CHECK(bColor.getAlpha() == 0xAA); // From before
3279
3280 BOOST_TEST_CHECK(bColor.getC0() == 0xDD);
3281 BOOST_TEST_CHECK(bColor.getC1() == 0xCC);
3282 BOOST_TEST_CHECK(bColor.getC2() == 0xBB);
3283 BOOST_TEST_CHECK(bColor.getC3() == 0xAA); // From before
3284
3285 fColor.setRGBfromLogPackIntARGB(0x00DDCCBB);
3286
3287 BOOST_TEST_CHECK(fColor.getRed() == 0xDD);
3288 BOOST_TEST_CHECK(fColor.getGreen() == 0xCC);
3289 BOOST_TEST_CHECK(fColor.getBlue() == 0xBB);
3290
3291 BOOST_TEST_CHECK(fColor.getC2() == 0xDD);
3292 BOOST_TEST_CHECK(fColor.getC1() == 0xCC);
3293 BOOST_TEST_CHECK(fColor.getC0() == 0xBB);
3294
3295 cColor.setRGBAfromLogPackIntARGB(0xAABBCCDD);
3296
3297 BOOST_TEST_CHECK(cColor.getRed() == 0xBB);
3298 BOOST_TEST_CHECK(cColor.getGreen() == 0xCC);
3299 BOOST_TEST_CHECK(cColor.getBlue() == 0xDD);
3300 BOOST_TEST_CHECK(cColor.getAlpha() == 0xAA);
3301
3302 BOOST_TEST_CHECK(cColor.getC2() == 0xBB);
3303 BOOST_TEST_CHECK(cColor.getC1() == 0xCC);
3304 BOOST_TEST_CHECK(cColor.getC0() == 0xDD);
3305 BOOST_TEST_CHECK(cColor.getC3() == 0xAA);
3306
3307 cColor.setRGBfromLogPackIntARGB(0x00DDCCBB);
3308
3309 BOOST_TEST_CHECK(cColor.getRed() == 0xDD);
3310 BOOST_TEST_CHECK(cColor.getGreen() == 0xCC);
3311 BOOST_TEST_CHECK(cColor.getBlue() == 0xBB);
3312 BOOST_TEST_CHECK(cColor.getAlpha() == 0xAA); // From before
3313
3314 BOOST_TEST_CHECK(cColor.getC2() == 0xDD);
3315 BOOST_TEST_CHECK(cColor.getC1() == 0xCC);
3316 BOOST_TEST_CHECK(cColor.getC0() == 0xBB);
3317 BOOST_TEST_CHECK(cColor.getC3() == 0xAA); // From before
3318
3319 dColor.setRGBAfromLogPackIntARGB(0xAABBCCDD);
3320
3321 BOOST_TEST_CHECK(dColor.getRed() == 0xBB);
3322 BOOST_TEST_CHECK(dColor.getGreen() == 0xCC);
3323 BOOST_TEST_CHECK(dColor.getBlue() == 0xDD);
3324 BOOST_TEST_CHECK(dColor.getAlpha() == 0xAA);
3325
3326 BOOST_TEST_CHECK(dColor.getC3() == 0xBB);
3327 BOOST_TEST_CHECK(dColor.getC2() == 0xCC);
3328 BOOST_TEST_CHECK(dColor.getC1() == 0xDD);
3329 BOOST_TEST_CHECK(dColor.getC0() == 0xAA);
3330
3331 dColor.setRGBfromLogPackIntARGB(0x00DDCCBB);
3332
3333 BOOST_TEST_CHECK(dColor.getRed() == 0xDD);
3334 BOOST_TEST_CHECK(dColor.getGreen() == 0xCC);
3335 BOOST_TEST_CHECK(dColor.getBlue() == 0xBB);
3336 BOOST_TEST_CHECK(dColor.getAlpha() == 0xAA); // From before
3337
3338 BOOST_TEST_CHECK(dColor.getC3() == 0xDD);
3339 BOOST_TEST_CHECK(dColor.getC2() == 0xCC);
3340 BOOST_TEST_CHECK(dColor.getC1() == 0xBB);
3341 BOOST_TEST_CHECK(dColor.getC0() == 0xAA); // From before
3342}
3343
3344////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
3345BOOST_AUTO_TEST_CASE(set8_fromLogPackIntRGBA) {
3346
3347 mjr::colorARGB8b aColor;
3348 mjr::colorRGBA8b bColor;
3349 mjr::colorBGRA8b cColor;
3350 mjr::colorABGR8b dColor;
3351
3352 mjr::colorRGB8b eColor;
3353 mjr::colorBGR8b fColor;
3354
3355 aColor.setRGBAfromLogPackIntRGBA(0xBBCCDDAA);
3356
3357 BOOST_TEST_CHECK(aColor.getRed() == 0xBB);
3358 BOOST_TEST_CHECK(aColor.getGreen() == 0xCC);
3359 BOOST_TEST_CHECK(aColor.getBlue() == 0xDD);
3360 BOOST_TEST_CHECK(aColor.getAlpha() == 0xAA);
3361
3362 BOOST_TEST_CHECK(aColor.getC1() == 0xBB);
3363 BOOST_TEST_CHECK(aColor.getC2() == 0xCC);
3364 BOOST_TEST_CHECK(aColor.getC3() == 0xDD);
3365 BOOST_TEST_CHECK(aColor.getC0() == 0xAA);
3366
3367 aColor.setRGBfromLogPackIntRGBA(0xDDCCBB00);
3368
3369 BOOST_TEST_CHECK(aColor.getRed() == 0xDD);
3370 BOOST_TEST_CHECK(aColor.getGreen() == 0xCC);
3371 BOOST_TEST_CHECK(aColor.getBlue() == 0xBB);
3372 BOOST_TEST_CHECK(aColor.getAlpha() == 0xAA); // From before
3373
3374 BOOST_TEST_CHECK(aColor.getC1() == 0xDD);
3375 BOOST_TEST_CHECK(aColor.getC2() == 0xCC);
3376 BOOST_TEST_CHECK(aColor.getC3() == 0xBB);
3377 BOOST_TEST_CHECK(aColor.getC0() == 0xAA); // From before
3378
3379 eColor.setRGBfromLogPackIntRGBA(0xDDCCBB00);
3380
3381 BOOST_TEST_CHECK(eColor.getRed() == 0xDD);
3382 BOOST_TEST_CHECK(eColor.getGreen() == 0xCC);
3383 BOOST_TEST_CHECK(eColor.getBlue() == 0xBB);
3384
3385 BOOST_TEST_CHECK(eColor.getC0() == 0xDD);
3386 BOOST_TEST_CHECK(eColor.getC1() == 0xCC);
3387 BOOST_TEST_CHECK(eColor.getC2() == 0xBB);
3388
3389 bColor.setRGBAfromLogPackIntRGBA(0xBBCCDDAA);
3390
3391 BOOST_TEST_CHECK(bColor.getRed() == 0xBB);
3392 BOOST_TEST_CHECK(bColor.getGreen() == 0xCC);
3393 BOOST_TEST_CHECK(bColor.getBlue() == 0xDD);
3394 BOOST_TEST_CHECK(bColor.getAlpha() == 0xAA);
3395
3396 BOOST_TEST_CHECK(bColor.getC0() == 0xBB);
3397 BOOST_TEST_CHECK(bColor.getC1() == 0xCC);
3398 BOOST_TEST_CHECK(bColor.getC2() == 0xDD);
3399 BOOST_TEST_CHECK(bColor.getC3() == 0xAA);
3400
3401 bColor.setRGBfromLogPackIntRGBA(0xDDCCBB00);
3402
3403 BOOST_TEST_CHECK(bColor.getRed() == 0xDD);
3404 BOOST_TEST_CHECK(bColor.getGreen() == 0xCC);
3405 BOOST_TEST_CHECK(bColor.getBlue() == 0xBB);
3406 BOOST_TEST_CHECK(bColor.getAlpha() == 0xAA); // From before
3407
3408 BOOST_TEST_CHECK(bColor.getC0() == 0xDD);
3409 BOOST_TEST_CHECK(bColor.getC1() == 0xCC);
3410 BOOST_TEST_CHECK(bColor.getC2() == 0xBB);
3411 BOOST_TEST_CHECK(bColor.getC3() == 0xAA); // From before
3412
3413 fColor.setRGBfromLogPackIntRGBA(0xDDCCBB00);
3414
3415 BOOST_TEST_CHECK(fColor.getRed() == 0xDD);
3416 BOOST_TEST_CHECK(fColor.getGreen() == 0xCC);
3417 BOOST_TEST_CHECK(fColor.getBlue() == 0xBB);
3418
3419 BOOST_TEST_CHECK(fColor.getC2() == 0xDD);
3420 BOOST_TEST_CHECK(fColor.getC1() == 0xCC);
3421 BOOST_TEST_CHECK(fColor.getC0() == 0xBB);
3422
3423 cColor.setRGBAfromLogPackIntRGBA(0xBBCCDDAA);
3424
3425 BOOST_TEST_CHECK(cColor.getRed() == 0xBB);
3426 BOOST_TEST_CHECK(cColor.getGreen() == 0xCC);
3427 BOOST_TEST_CHECK(cColor.getBlue() == 0xDD);
3428 BOOST_TEST_CHECK(cColor.getAlpha() == 0xAA);
3429
3430 BOOST_TEST_CHECK(cColor.getC2() == 0xBB);
3431 BOOST_TEST_CHECK(cColor.getC1() == 0xCC);
3432 BOOST_TEST_CHECK(cColor.getC0() == 0xDD);
3433 BOOST_TEST_CHECK(cColor.getC3() == 0xAA);
3434
3435 cColor.setRGBfromLogPackIntRGBA(0xDDCCBB00);
3436
3437 BOOST_TEST_CHECK(cColor.getRed() == 0xDD);
3438 BOOST_TEST_CHECK(cColor.getGreen() == 0xCC);
3439 BOOST_TEST_CHECK(cColor.getBlue() == 0xBB);
3440 BOOST_TEST_CHECK(cColor.getAlpha() == 0xAA); // From before
3441
3442 BOOST_TEST_CHECK(cColor.getC2() == 0xDD);
3443 BOOST_TEST_CHECK(cColor.getC1() == 0xCC);
3444 BOOST_TEST_CHECK(cColor.getC0() == 0xBB);
3445 BOOST_TEST_CHECK(cColor.getC3() == 0xAA); // From before
3446
3447 dColor.setRGBAfromLogPackIntRGBA(0xBBCCDDAA);
3448
3449 BOOST_TEST_CHECK(dColor.getRed() == 0xBB);
3450 BOOST_TEST_CHECK(dColor.getGreen() == 0xCC);
3451 BOOST_TEST_CHECK(dColor.getBlue() == 0xDD);
3452 BOOST_TEST_CHECK(dColor.getAlpha() == 0xAA);
3453
3454 BOOST_TEST_CHECK(dColor.getC3() == 0xBB);
3455 BOOST_TEST_CHECK(dColor.getC2() == 0xCC);
3456 BOOST_TEST_CHECK(dColor.getC1() == 0xDD);
3457 BOOST_TEST_CHECK(dColor.getC0() == 0xAA);
3458
3459 dColor.setRGBfromLogPackIntRGBA(0xDDCCBB00);
3460
3461 BOOST_TEST_CHECK(dColor.getRed() == 0xDD);
3462 BOOST_TEST_CHECK(dColor.getGreen() == 0xCC);
3463 BOOST_TEST_CHECK(dColor.getBlue() == 0xBB);
3464 BOOST_TEST_CHECK(dColor.getAlpha() == 0xAA); // From before
3465
3466 BOOST_TEST_CHECK(dColor.getC3() == 0xDD);
3467 BOOST_TEST_CHECK(dColor.getC2() == 0xCC);
3468 BOOST_TEST_CHECK(dColor.getC1() == 0xBB);
3469 BOOST_TEST_CHECK(dColor.getC0() == 0xAA); // From before
3470}
3471
3472////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
3473BOOST_AUTO_TEST_CASE(set8_fromLogPackIntABGR) {
3474
3475 mjr::colorARGB8b aColor;
3476 mjr::colorRGBA8b bColor;
3477 mjr::colorBGRA8b cColor;
3478 mjr::colorABGR8b dColor;
3479
3480 mjr::colorRGB8b eColor;
3481 mjr::colorBGR8b fColor;
3482
3483 aColor.setRGBAfromLogPackIntABGR(0xAADDCCBB);
3484
3485 BOOST_TEST_CHECK(aColor.getRed() == 0xBB);
3486 BOOST_TEST_CHECK(aColor.getGreen() == 0xCC);
3487 BOOST_TEST_CHECK(aColor.getBlue() == 0xDD);
3488 BOOST_TEST_CHECK(aColor.getAlpha() == 0xAA);
3489
3490 BOOST_TEST_CHECK(aColor.getC1() == 0xBB);
3491 BOOST_TEST_CHECK(aColor.getC2() == 0xCC);
3492 BOOST_TEST_CHECK(aColor.getC3() == 0xDD);
3493 BOOST_TEST_CHECK(aColor.getC0() == 0xAA);
3494
3495 aColor.setRGBfromLogPackIntABGR(0x00BBCCDD);
3496
3497 BOOST_TEST_CHECK(aColor.getRed() == 0xDD);
3498 BOOST_TEST_CHECK(aColor.getGreen() == 0xCC);
3499 BOOST_TEST_CHECK(aColor.getBlue() == 0xBB);
3500 BOOST_TEST_CHECK(aColor.getAlpha() == 0xAA); // From before
3501
3502 BOOST_TEST_CHECK(aColor.getC1() == 0xDD);
3503 BOOST_TEST_CHECK(aColor.getC2() == 0xCC);
3504 BOOST_TEST_CHECK(aColor.getC3() == 0xBB);
3505 BOOST_TEST_CHECK(aColor.getC0() == 0xAA); // From before
3506
3507 eColor.setRGBfromLogPackIntABGR(0x00BBCCDD);
3508
3509 BOOST_TEST_CHECK(eColor.getRed() == 0xDD);
3510 BOOST_TEST_CHECK(eColor.getGreen() == 0xCC);
3511 BOOST_TEST_CHECK(eColor.getBlue() == 0xBB);
3512
3513 BOOST_TEST_CHECK(eColor.getC0() == 0xDD);
3514 BOOST_TEST_CHECK(eColor.getC1() == 0xCC);
3515 BOOST_TEST_CHECK(eColor.getC2() == 0xBB);
3516
3517 bColor.setRGBAfromLogPackIntABGR(0xAADDCCBB);
3518
3519 BOOST_TEST_CHECK(bColor.getRed() == 0xBB);
3520 BOOST_TEST_CHECK(bColor.getGreen() == 0xCC);
3521 BOOST_TEST_CHECK(bColor.getBlue() == 0xDD);
3522 BOOST_TEST_CHECK(bColor.getAlpha() == 0xAA);
3523
3524 BOOST_TEST_CHECK(bColor.getC0() == 0xBB);
3525 BOOST_TEST_CHECK(bColor.getC1() == 0xCC);
3526 BOOST_TEST_CHECK(bColor.getC2() == 0xDD);
3527 BOOST_TEST_CHECK(bColor.getC3() == 0xAA);
3528
3529 bColor.setRGBfromLogPackIntABGR(0x00BBCCDD);
3530
3531 BOOST_TEST_CHECK(bColor.getRed() == 0xDD);
3532 BOOST_TEST_CHECK(bColor.getGreen() == 0xCC);
3533 BOOST_TEST_CHECK(bColor.getBlue() == 0xBB);
3534 BOOST_TEST_CHECK(bColor.getAlpha() == 0xAA); // From before
3535
3536 BOOST_TEST_CHECK(bColor.getC0() == 0xDD);
3537 BOOST_TEST_CHECK(bColor.getC1() == 0xCC);
3538 BOOST_TEST_CHECK(bColor.getC2() == 0xBB);
3539 BOOST_TEST_CHECK(bColor.getC3() == 0xAA); // From before
3540
3541 fColor.setRGBfromLogPackIntABGR(0x00BBCCDD);
3542
3543 BOOST_TEST_CHECK(fColor.getRed() == 0xDD);
3544 BOOST_TEST_CHECK(fColor.getGreen() == 0xCC);
3545 BOOST_TEST_CHECK(fColor.getBlue() == 0xBB);
3546
3547 BOOST_TEST_CHECK(fColor.getC2() == 0xDD);
3548 BOOST_TEST_CHECK(fColor.getC1() == 0xCC);
3549 BOOST_TEST_CHECK(fColor.getC0() == 0xBB);
3550
3551 cColor.setRGBAfromLogPackIntABGR(0xAADDCCBB);
3552
3553 BOOST_TEST_CHECK(cColor.getRed() == 0xBB);
3554 BOOST_TEST_CHECK(cColor.getGreen() == 0xCC);
3555 BOOST_TEST_CHECK(cColor.getBlue() == 0xDD);
3556 BOOST_TEST_CHECK(cColor.getAlpha() == 0xAA);
3557
3558 BOOST_TEST_CHECK(cColor.getC2() == 0xBB);
3559 BOOST_TEST_CHECK(cColor.getC1() == 0xCC);
3560 BOOST_TEST_CHECK(cColor.getC0() == 0xDD);
3561 BOOST_TEST_CHECK(cColor.getC3() == 0xAA);
3562
3563 cColor.setRGBfromLogPackIntABGR(0x00BBCCDD);
3564
3565 BOOST_TEST_CHECK(cColor.getRed() == 0xDD);
3566 BOOST_TEST_CHECK(cColor.getGreen() == 0xCC);
3567 BOOST_TEST_CHECK(cColor.getBlue() == 0xBB);
3568 BOOST_TEST_CHECK(cColor.getAlpha() == 0xAA); // From before
3569
3570 BOOST_TEST_CHECK(cColor.getC2() == 0xDD);
3571 BOOST_TEST_CHECK(cColor.getC1() == 0xCC);
3572 BOOST_TEST_CHECK(cColor.getC0() == 0xBB);
3573 BOOST_TEST_CHECK(cColor.getC3() == 0xAA); // From before
3574
3575 dColor.setRGBAfromLogPackIntABGR(0xAADDCCBB);
3576
3577 BOOST_TEST_CHECK(dColor.getRed() == 0xBB);
3578 BOOST_TEST_CHECK(dColor.getGreen() == 0xCC);
3579 BOOST_TEST_CHECK(dColor.getBlue() == 0xDD);
3580 BOOST_TEST_CHECK(dColor.getAlpha() == 0xAA);
3581
3582 BOOST_TEST_CHECK(dColor.getC3() == 0xBB);
3583 BOOST_TEST_CHECK(dColor.getC2() == 0xCC);
3584 BOOST_TEST_CHECK(dColor.getC1() == 0xDD);
3585 BOOST_TEST_CHECK(dColor.getC0() == 0xAA);
3586
3587 dColor.setRGBfromLogPackIntABGR(0x00BBCCDD);
3588
3589 BOOST_TEST_CHECK(dColor.getRed() == 0xDD);
3590 BOOST_TEST_CHECK(dColor.getGreen() == 0xCC);
3591 BOOST_TEST_CHECK(dColor.getBlue() == 0xBB);
3592 BOOST_TEST_CHECK(dColor.getAlpha() == 0xAA); // From before
3593
3594 BOOST_TEST_CHECK(dColor.getC3() == 0xDD);
3595 BOOST_TEST_CHECK(dColor.getC2() == 0xCC);
3596 BOOST_TEST_CHECK(dColor.getC1() == 0xBB);
3597 BOOST_TEST_CHECK(dColor.getC0() == 0xAA); // From before
3598}
3599
3600////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
3601BOOST_AUTO_TEST_CASE(set8_fromLogPackIntABRG) {
3602
3603 mjr::colorARGB8b aColor;
3604 mjr::colorRGBA8b bColor;
3605 mjr::colorBGRA8b cColor;
3606 mjr::colorABGR8b dColor;
3607
3608 mjr::colorRGB8b eColor;
3609 mjr::colorBGR8b fColor;
3610
3611 aColor.setRGBAfromLogPackIntABRG(0xAADDBBCC);
3612
3613 BOOST_TEST_CHECK(aColor.getRed() == 0xBB);
3614 BOOST_TEST_CHECK(aColor.getGreen() == 0xCC);
3615 BOOST_TEST_CHECK(aColor.getBlue() == 0xDD);
3616 BOOST_TEST_CHECK(aColor.getAlpha() == 0xAA);
3617
3618 BOOST_TEST_CHECK(aColor.getC1() == 0xBB);
3619 BOOST_TEST_CHECK(aColor.getC2() == 0xCC);
3620 BOOST_TEST_CHECK(aColor.getC3() == 0xDD);
3621 BOOST_TEST_CHECK(aColor.getC0() == 0xAA);
3622
3623 aColor.setRGBfromLogPackIntABRG(0x00BBDDCC);
3624
3625 BOOST_TEST_CHECK(aColor.getRed() == 0xDD);
3626 BOOST_TEST_CHECK(aColor.getGreen() == 0xCC);
3627 BOOST_TEST_CHECK(aColor.getBlue() == 0xBB);
3628 BOOST_TEST_CHECK(aColor.getAlpha() == 0xAA); // From before
3629
3630 BOOST_TEST_CHECK(aColor.getC1() == 0xDD);
3631 BOOST_TEST_CHECK(aColor.getC2() == 0xCC);
3632 BOOST_TEST_CHECK(aColor.getC3() == 0xBB);
3633 BOOST_TEST_CHECK(aColor.getC0() == 0xAA); // From before
3634
3635 eColor.setRGBfromLogPackIntABRG(0x00BBDDCC);
3636
3637 BOOST_TEST_CHECK(eColor.getRed() == 0xDD);
3638 BOOST_TEST_CHECK(eColor.getGreen() == 0xCC);
3639 BOOST_TEST_CHECK(eColor.getBlue() == 0xBB);
3640
3641 BOOST_TEST_CHECK(eColor.getC0() == 0xDD);
3642 BOOST_TEST_CHECK(eColor.getC1() == 0xCC);
3643 BOOST_TEST_CHECK(eColor.getC2() == 0xBB);
3644
3645 bColor.setRGBAfromLogPackIntABRG(0xAADDBBCC);
3646
3647 BOOST_TEST_CHECK(bColor.getRed() == 0xBB);
3648 BOOST_TEST_CHECK(bColor.getGreen() == 0xCC);
3649 BOOST_TEST_CHECK(bColor.getBlue() == 0xDD);
3650 BOOST_TEST_CHECK(bColor.getAlpha() == 0xAA);
3651
3652 BOOST_TEST_CHECK(bColor.getC0() == 0xBB);
3653 BOOST_TEST_CHECK(bColor.getC1() == 0xCC);
3654 BOOST_TEST_CHECK(bColor.getC2() == 0xDD);
3655 BOOST_TEST_CHECK(bColor.getC3() == 0xAA);
3656
3657 bColor.setRGBfromLogPackIntABRG(0x00BBDDCC);
3658
3659 BOOST_TEST_CHECK(bColor.getRed() == 0xDD);
3660 BOOST_TEST_CHECK(bColor.getGreen() == 0xCC);
3661 BOOST_TEST_CHECK(bColor.getBlue() == 0xBB);
3662 BOOST_TEST_CHECK(bColor.getAlpha() == 0xAA); // From before
3663
3664 BOOST_TEST_CHECK(bColor.getC0() == 0xDD);
3665 BOOST_TEST_CHECK(bColor.getC1() == 0xCC);
3666 BOOST_TEST_CHECK(bColor.getC2() == 0xBB);
3667 BOOST_TEST_CHECK(bColor.getC3() == 0xAA); // From before
3668
3669 fColor.setRGBfromLogPackIntABRG(0x00BBDDCC);
3670
3671 BOOST_TEST_CHECK(fColor.getRed() == 0xDD);
3672 BOOST_TEST_CHECK(fColor.getGreen() == 0xCC);
3673 BOOST_TEST_CHECK(fColor.getBlue() == 0xBB);
3674
3675 BOOST_TEST_CHECK(fColor.getC2() == 0xDD);
3676 BOOST_TEST_CHECK(fColor.getC1() == 0xCC);
3677 BOOST_TEST_CHECK(fColor.getC0() == 0xBB);
3678
3679 cColor.setRGBAfromLogPackIntABRG(0xAADDBBCC);
3680
3681 BOOST_TEST_CHECK(cColor.getRed() == 0xBB);
3682 BOOST_TEST_CHECK(cColor.getGreen() == 0xCC);
3683 BOOST_TEST_CHECK(cColor.getBlue() == 0xDD);
3684 BOOST_TEST_CHECK(cColor.getAlpha() == 0xAA);
3685
3686 BOOST_TEST_CHECK(cColor.getC2() == 0xBB);
3687 BOOST_TEST_CHECK(cColor.getC1() == 0xCC);
3688 BOOST_TEST_CHECK(cColor.getC0() == 0xDD);
3689 BOOST_TEST_CHECK(cColor.getC3() == 0xAA);
3690
3691 cColor.setRGBfromLogPackIntABRG(0x00BBDDCC);
3692
3693 BOOST_TEST_CHECK(cColor.getRed() == 0xDD);
3694 BOOST_TEST_CHECK(cColor.getGreen() == 0xCC);
3695 BOOST_TEST_CHECK(cColor.getBlue() == 0xBB);
3696 BOOST_TEST_CHECK(cColor.getAlpha() == 0xAA); // From before
3697
3698 BOOST_TEST_CHECK(cColor.getC2() == 0xDD);
3699 BOOST_TEST_CHECK(cColor.getC1() == 0xCC);
3700 BOOST_TEST_CHECK(cColor.getC0() == 0xBB);
3701 BOOST_TEST_CHECK(cColor.getC3() == 0xAA); // From before
3702
3703 dColor.setRGBAfromLogPackIntABRG(0xAADDBBCC);
3704
3705 BOOST_TEST_CHECK(dColor.getRed() == 0xBB);
3706 BOOST_TEST_CHECK(dColor.getGreen() == 0xCC);
3707 BOOST_TEST_CHECK(dColor.getBlue() == 0xDD);
3708 BOOST_TEST_CHECK(dColor.getAlpha() == 0xAA);
3709
3710 BOOST_TEST_CHECK(dColor.getC3() == 0xBB);
3711 BOOST_TEST_CHECK(dColor.getC2() == 0xCC);
3712 BOOST_TEST_CHECK(dColor.getC1() == 0xDD);
3713 BOOST_TEST_CHECK(dColor.getC0() == 0xAA);
3714
3715 dColor.setRGBfromLogPackIntABRG(0x00BBDDCC);
3716
3717 BOOST_TEST_CHECK(dColor.getRed() == 0xDD);
3718 BOOST_TEST_CHECK(dColor.getGreen() == 0xCC);
3719 BOOST_TEST_CHECK(dColor.getBlue() == 0xBB);
3720 BOOST_TEST_CHECK(dColor.getAlpha() == 0xAA); // From before
3721
3722 BOOST_TEST_CHECK(dColor.getC3() == 0xDD);
3723 BOOST_TEST_CHECK(dColor.getC2() == 0xCC);
3724 BOOST_TEST_CHECK(dColor.getC1() == 0xBB);
3725 BOOST_TEST_CHECK(dColor.getC0() == 0xAA); // From before
3726}
3727
3728////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
3729BOOST_AUTO_TEST_CASE(set8_fromLogPackIntBGRA) {
3730
3731 mjr::colorARGB8b aColor;
3732 mjr::colorRGBA8b bColor;
3733 mjr::colorBGRA8b cColor;
3734 mjr::colorBGRA8b dColor;
3735
3736 mjr::colorRGB8b eColor;
3737 mjr::colorBGR8b fColor;
3738
3739 aColor.setRGBAfromLogPackIntBGRA(0xDDCCBBAA);
3740
3741 BOOST_TEST_CHECK(aColor.getRed() == 0xBB);
3742 BOOST_TEST_CHECK(aColor.getGreen() == 0xCC);
3743 BOOST_TEST_CHECK(aColor.getBlue() == 0xDD);
3744 BOOST_TEST_CHECK(aColor.getAlpha() == 0xAA);
3745
3746 BOOST_TEST_CHECK(aColor.getC1() == 0xBB);
3747 BOOST_TEST_CHECK(aColor.getC2() == 0xCC);
3748 BOOST_TEST_CHECK(aColor.getC3() == 0xDD);
3749 BOOST_TEST_CHECK(aColor.getC0() == 0xAA);
3750
3751 aColor.setRGBfromLogPackIntBGRA(0xBBCCDD00);
3752
3753 BOOST_TEST_CHECK(aColor.getRed() == 0xDD);
3754 BOOST_TEST_CHECK(aColor.getGreen() == 0xCC);
3755 BOOST_TEST_CHECK(aColor.getBlue() == 0xBB);
3756 BOOST_TEST_CHECK(aColor.getAlpha() == 0xAA); // From before
3757
3758 BOOST_TEST_CHECK(aColor.getC1() == 0xDD);
3759 BOOST_TEST_CHECK(aColor.getC2() == 0xCC);
3760 BOOST_TEST_CHECK(aColor.getC3() == 0xBB);
3761 BOOST_TEST_CHECK(aColor.getC0() == 0xAA); // From before
3762
3763 eColor.setRGBfromLogPackIntBGRA(0xBBCCDD00);
3764
3765 BOOST_TEST_CHECK(eColor.getRed() == 0xDD);
3766 BOOST_TEST_CHECK(eColor.getGreen() == 0xCC);
3767 BOOST_TEST_CHECK(eColor.getBlue() == 0xBB);
3768
3769 BOOST_TEST_CHECK(eColor.getC0() == 0xDD);
3770 BOOST_TEST_CHECK(eColor.getC1() == 0xCC);
3771 BOOST_TEST_CHECK(eColor.getC2() == 0xBB);
3772
3773 bColor.setRGBAfromLogPackIntBGRA(0xDDCCBBAA);
3774
3775 BOOST_TEST_CHECK(bColor.getRed() == 0xBB);
3776 BOOST_TEST_CHECK(bColor.getGreen() == 0xCC);
3777 BOOST_TEST_CHECK(bColor.getBlue() == 0xDD);
3778 BOOST_TEST_CHECK(bColor.getAlpha() == 0xAA);
3779
3780 BOOST_TEST_CHECK(bColor.getC0() == 0xBB);
3781 BOOST_TEST_CHECK(bColor.getC1() == 0xCC);
3782 BOOST_TEST_CHECK(bColor.getC2() == 0xDD);
3783 BOOST_TEST_CHECK(bColor.getC3() == 0xAA);
3784
3785 bColor.setRGBfromLogPackIntBGRA(0xBBCCDD00);
3786
3787 BOOST_TEST_CHECK(bColor.getRed() == 0xDD);
3788 BOOST_TEST_CHECK(bColor.getGreen() == 0xCC);
3789 BOOST_TEST_CHECK(bColor.getBlue() == 0xBB);
3790 BOOST_TEST_CHECK(bColor.getAlpha() == 0xAA); // From before
3791
3792 BOOST_TEST_CHECK(bColor.getC0() == 0xDD);
3793 BOOST_TEST_CHECK(bColor.getC1() == 0xCC);
3794 BOOST_TEST_CHECK(bColor.getC2() == 0xBB);
3795 BOOST_TEST_CHECK(bColor.getC3() == 0xAA); // From before
3796
3797 fColor.setRGBfromLogPackIntBGRA(0xBBCCDD00);
3798
3799 BOOST_TEST_CHECK(fColor.getRed() == 0xDD);
3800 BOOST_TEST_CHECK(fColor.getGreen() == 0xCC);
3801 BOOST_TEST_CHECK(fColor.getBlue() == 0xBB);
3802
3803 BOOST_TEST_CHECK(fColor.getC2() == 0xDD);
3804 BOOST_TEST_CHECK(fColor.getC1() == 0xCC);
3805 BOOST_TEST_CHECK(fColor.getC0() == 0xBB);
3806
3807 cColor.setRGBAfromLogPackIntBGRA(0xDDCCBBAA);
3808
3809 BOOST_TEST_CHECK(cColor.getRed() == 0xBB);
3810 BOOST_TEST_CHECK(cColor.getGreen() == 0xCC);
3811 BOOST_TEST_CHECK(cColor.getBlue() == 0xDD);
3812 BOOST_TEST_CHECK(cColor.getAlpha() == 0xAA);
3813
3814 BOOST_TEST_CHECK(cColor.getC2() == 0xBB);
3815 BOOST_TEST_CHECK(cColor.getC1() == 0xCC);
3816 BOOST_TEST_CHECK(cColor.getC0() == 0xDD);
3817 BOOST_TEST_CHECK(cColor.getC3() == 0xAA);
3818
3819 cColor.setRGBfromLogPackIntBGRA(0xBBCCDD00);
3820
3821 BOOST_TEST_CHECK(cColor.getRed() == 0xDD);
3822 BOOST_TEST_CHECK(cColor.getGreen() == 0xCC);
3823 BOOST_TEST_CHECK(cColor.getBlue() == 0xBB);
3824 BOOST_TEST_CHECK(cColor.getAlpha() == 0xAA); // From before
3825
3826 BOOST_TEST_CHECK(cColor.getC2() == 0xDD);
3827 BOOST_TEST_CHECK(cColor.getC1() == 0xCC);
3828 BOOST_TEST_CHECK(cColor.getC0() == 0xBB);
3829 BOOST_TEST_CHECK(cColor.getC3() == 0xAA); // From before
3830
3831 dColor.setRGBAfromLogPackIntBGRA(0xDDCCBBAA);
3832
3833 BOOST_TEST_CHECK(dColor.getRed() == 0xBB);
3834 BOOST_TEST_CHECK(dColor.getGreen() == 0xCC);
3835 BOOST_TEST_CHECK(dColor.getBlue() == 0xDD);
3836 BOOST_TEST_CHECK(dColor.getAlpha() == 0xAA);
3837
3838 BOOST_TEST_CHECK(dColor.getC2() == 0xBB);
3839 BOOST_TEST_CHECK(dColor.getC1() == 0xCC);
3840 BOOST_TEST_CHECK(dColor.getC0() == 0xDD);
3841 BOOST_TEST_CHECK(dColor.getC3() == 0xAA);
3842
3843 dColor.setRGBfromLogPackIntBGRA(0xBBCCDD00);
3844
3845 BOOST_TEST_CHECK(dColor.getRed() == 0xDD);
3846 BOOST_TEST_CHECK(dColor.getGreen() == 0xCC);
3847 BOOST_TEST_CHECK(dColor.getBlue() == 0xBB);
3848 BOOST_TEST_CHECK(dColor.getAlpha() == 0xAA); // From before
3849
3850 BOOST_TEST_CHECK(dColor.getC2() == 0xDD);
3851 BOOST_TEST_CHECK(dColor.getC1() == 0xCC);
3852 BOOST_TEST_CHECK(dColor.getC0() == 0xBB);
3853 BOOST_TEST_CHECK(dColor.getC3() == 0xAA); // From before
3854}
3855
3856////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
3857BOOST_AUTO_TEST_CASE(set16_fromLogPackIntARGB) {
3858
3859 // We really just need to make sure the scale works for 16bit -- i.e. that the bytes of the integer are truely inturprted by set*_byte() members.
3860
3861 mjr::colorRGBA16b bColor;
3862 mjr::colorRGB16b eColor;
3863
3864 bColor.setRGBAfromLogPackIntARGB(0xFF00FF80);
3865
3866 BOOST_TEST_CHECK(bColor.getRed() == mjr::colorRGBA16b::minChanVal);
3867 BOOST_TEST_CHECK(bColor.getGreen() == mjr::colorRGBA16b::maxChanVal);
3868 BOOST_TEST_CHECK(bColor.getBlue() == 0x8080);
3869 BOOST_TEST_CHECK(bColor.getAlpha() == mjr::colorRGBA16b::maxChanVal);
3870
3871 BOOST_TEST_CHECK(bColor.getC0() == mjr::colorRGBA16b::minChanVal);
3872 BOOST_TEST_CHECK(bColor.getC1() == mjr::colorRGBA16b::maxChanVal);
3873 BOOST_TEST_CHECK(bColor.getC2() == 0x8080);
3874 BOOST_TEST_CHECK(bColor.getC3() == mjr::colorRGBA16b::maxChanVal);
3875
3876 bColor.setRGBfromLogPackIntARGB(0x00FF00FF);
3877
3878 BOOST_TEST_CHECK(bColor.getRed() == mjr::colorRGBA16b::maxChanVal);
3879 BOOST_TEST_CHECK(bColor.getGreen() == mjr::colorRGBA16b::minChanVal);
3880 BOOST_TEST_CHECK(bColor.getBlue() == mjr::colorRGBA16b::maxChanVal);
3881 BOOST_TEST_CHECK(bColor.getAlpha() == mjr::colorRGBA16b::maxChanVal); // From before
3882
3883 BOOST_TEST_CHECK(bColor.getC0() == mjr::colorRGBA16b::maxChanVal);
3884 BOOST_TEST_CHECK(bColor.getC1() == mjr::colorRGBA16b::minChanVal);
3885 BOOST_TEST_CHECK(bColor.getC2() == mjr::colorRGBA16b::maxChanVal);
3886 BOOST_TEST_CHECK(bColor.getC3() == mjr::colorRGBA16b::maxChanVal); // From before
3887
3888 eColor.setRGBfromLogPackIntARGB(0x00FF00FF);
3889
3890 BOOST_TEST_CHECK(eColor.getRed() == mjr::colorRGBA16b::maxChanVal);
3891 BOOST_TEST_CHECK(eColor.getGreen() == mjr::colorRGBA16b::minChanVal);
3892 BOOST_TEST_CHECK(eColor.getBlue() == mjr::colorRGBA16b::maxChanVal);
3893
3894 BOOST_TEST_CHECK(eColor.getC0() == mjr::colorRGBA16b::maxChanVal);
3895 BOOST_TEST_CHECK(eColor.getC1() == mjr::colorRGBA16b::minChanVal);
3896 BOOST_TEST_CHECK(eColor.getC2() == mjr::colorRGBA16b::maxChanVal);
3897}
3898
3899////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
3900BOOST_AUTO_TEST_CASE(set8_saved_fromLogPackIntARGB) {
3901
3902 // Make sure channels that should not be changed are not.
3903
3904 mjr::colorRGBA8b bColor;
3905 mjr::color5c8b cColor;
3906
3907 bColor.setToWhite();
3908 bColor.setRGBfromLogPackIntARGB(0x00000000);
3909
3910 BOOST_TEST_CHECK(bColor.getRed() == mjr::colorRGBA8b::minChanVal);
3911 BOOST_TEST_CHECK(bColor.getGreen() == mjr::colorRGBA8b::minChanVal);
3912 BOOST_TEST_CHECK(bColor.getBlue() == mjr::colorRGBA8b::minChanVal);
3913 BOOST_TEST_CHECK(bColor.getAlpha() == mjr::colorRGBA8b::maxChanVal);
3914
3915 bColor.setToBlack();
3916 bColor.setRGBfromLogPackIntARGB(0xFFFFFFFF);
3917
3918 BOOST_TEST_CHECK(bColor.getRed() == mjr::colorRGBA8b::maxChanVal);
3919 BOOST_TEST_CHECK(bColor.getGreen() == mjr::colorRGBA8b::maxChanVal);
3920 BOOST_TEST_CHECK(bColor.getBlue() == mjr::colorRGBA8b::maxChanVal);
3921 BOOST_TEST_CHECK(bColor.getAlpha() == mjr::colorRGBA8b::minChanVal);
3922
3923 cColor.setToWhite();
3924 cColor.setRGBAfromLogPackIntARGB(0x00000000);
3925
3926 BOOST_TEST_CHECK(cColor.getRed() == mjr::colorRGBA8b::minChanVal);
3927 BOOST_TEST_CHECK(cColor.getGreen() == mjr::colorRGBA8b::minChanVal);
3928 BOOST_TEST_CHECK(cColor.getBlue() == mjr::colorRGBA8b::minChanVal);
3929 BOOST_TEST_CHECK(cColor.getAlpha() == mjr::colorRGBA8b::minChanVal);
3930 BOOST_TEST_CHECK(cColor.getChan(4) == mjr::colorRGBA8b::maxChanVal);
3931
3932 cColor.setToBlack();
3933 cColor.setRGBAfromLogPackIntARGB(0xFFFFFFFF);
3934
3935 BOOST_TEST_CHECK(cColor.getRed() == mjr::colorRGBA8b::maxChanVal);
3936 BOOST_TEST_CHECK(cColor.getGreen() == mjr::colorRGBA8b::maxChanVal);
3937 BOOST_TEST_CHECK(cColor.getBlue() == mjr::colorRGBA8b::maxChanVal);
3938 BOOST_TEST_CHECK(cColor.getAlpha() == mjr::colorRGBA8b::maxChanVal);
3939 BOOST_TEST_CHECK(cColor.getChan(4) == mjr::colorRGBA8b::minChanVal);
3940}
3941
3942////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
3943BOOST_AUTO_TEST_CASE(setRGBcmpGreyTGA16bit) {
3944
3945 mjr::colorRGBA8b aColor;
3946 mjr::colorRGB8b bColor;
3947
3948 bColor.setToBlack();
3949 bColor.setRGBcmpGreyTGA16bit(0x0000);
3950
3951 BOOST_TEST_CHECK(bColor.getRed() == 0x00);
3952 BOOST_TEST_CHECK(bColor.getGreen() == 0x00);
3953 BOOST_TEST_CHECK(bColor.getBlue() == 0x00);
3954
3955 BOOST_TEST_CHECK(bColor.getC0() == 0x00);
3956 BOOST_TEST_CHECK(bColor.getC1() == 0x00);
3957 BOOST_TEST_CHECK(bColor.getC2() == 0x00);
3958
3959 bColor.setToBlack();
3960 bColor.setRGBcmpGreyTGA16bit(0xFFFF);
3961
3962 BOOST_TEST_CHECK(bColor.getRed() == 0xFF);
3963 BOOST_TEST_CHECK(bColor.getGreen() == 0xFF);
3964 BOOST_TEST_CHECK(bColor.getBlue() == 0x00);
3965
3966 BOOST_TEST_CHECK(bColor.getC0() == 0xFF);
3967 BOOST_TEST_CHECK(bColor.getC1() == 0xFF);
3968 BOOST_TEST_CHECK(bColor.getC2() == 0x00);
3969
3970 bColor.setToBlack();
3971 bColor.setRGBcmpGreyTGA16bit(0xAABB);
3972
3973 BOOST_TEST_CHECK(bColor.getRed() == 0xAA);
3974 BOOST_TEST_CHECK(bColor.getGreen() == 0xBB);
3975 BOOST_TEST_CHECK(bColor.getBlue() == 0x00);
3976
3977 BOOST_TEST_CHECK(bColor.getC0() == 0xAA);
3978 BOOST_TEST_CHECK(bColor.getC1() == 0xBB);
3979 BOOST_TEST_CHECK(bColor.getC2() == 0x00);
3980
3981 bColor.setToWhite();
3982 bColor.setRGBcmpGreyTGA16bit(0x0000);
3983
3984 BOOST_TEST_CHECK(bColor.getRed() == 0x00);
3985 BOOST_TEST_CHECK(bColor.getGreen() == 0x00);
3986 BOOST_TEST_CHECK(bColor.getBlue() == 0x00);
3987
3988 BOOST_TEST_CHECK(bColor.getC0() == 0x00);
3989 BOOST_TEST_CHECK(bColor.getC1() == 0x00);
3990 BOOST_TEST_CHECK(bColor.getC2() == 0x00);
3991
3992 bColor.setToWhite();
3993 bColor.setRGBcmpGreyTGA16bit(0xFFFF);
3994
3995 BOOST_TEST_CHECK(bColor.getRed() == 0xFF);
3996 BOOST_TEST_CHECK(bColor.getGreen() == 0xFF);
3997 BOOST_TEST_CHECK(bColor.getBlue() == 0x00);
3998
3999 BOOST_TEST_CHECK(bColor.getC0() == 0xFF);
4000 BOOST_TEST_CHECK(bColor.getC1() == 0xFF);
4001 BOOST_TEST_CHECK(bColor.getC2() == 0x00);
4002
4003 bColor.setToWhite();
4004 bColor.setRGBcmpGreyTGA16bit(0xAABB);
4005
4006 BOOST_TEST_CHECK(bColor.getRed() == 0xAA);
4007 BOOST_TEST_CHECK(bColor.getGreen() == 0xBB);
4008 BOOST_TEST_CHECK(bColor.getBlue() == 0x00);
4009
4010 BOOST_TEST_CHECK(bColor.getC0() == 0xAA);
4011 BOOST_TEST_CHECK(bColor.getC1() == 0xBB);
4012 BOOST_TEST_CHECK(bColor.getC2() == 0x00);
4013
4014////////////////////////////////////////////////////////////////////////////////
4015
4016 aColor.setToBlack();
4017 aColor.setRGBcmpGreyTGA16bit(0x0000);
4018
4019 BOOST_TEST_CHECK(aColor.getRed() == 0x00);
4020 BOOST_TEST_CHECK(aColor.getGreen() == 0x00);
4021 BOOST_TEST_CHECK(aColor.getBlue() == 0x00);
4022 BOOST_TEST_CHECK(aColor.getAlpha() == 0x00);
4023
4024 BOOST_TEST_CHECK(aColor.getC0() == 0x00);
4025 BOOST_TEST_CHECK(aColor.getC1() == 0x00);
4026 BOOST_TEST_CHECK(aColor.getC2() == 0x00);
4027 BOOST_TEST_CHECK(aColor.getC3() == 0x00);
4028
4029 aColor.setToBlack();
4030 aColor.setRGBcmpGreyTGA16bit(0xFFFF);
4031
4032 BOOST_TEST_CHECK(aColor.getRed() == 0xFF);
4033 BOOST_TEST_CHECK(aColor.getGreen() == 0xFF);
4034 BOOST_TEST_CHECK(aColor.getBlue() == 0x00);
4035 BOOST_TEST_CHECK(aColor.getAlpha() == 0x00);
4036
4037 BOOST_TEST_CHECK(aColor.getC0() == 0xFF);
4038 BOOST_TEST_CHECK(aColor.getC1() == 0xFF);
4039 BOOST_TEST_CHECK(aColor.getC2() == 0x00);
4040 BOOST_TEST_CHECK(aColor.getC3() == 0x00);
4041
4042 aColor.setToBlack();
4043 aColor.setRGBcmpGreyTGA16bit(0xAABB);
4044
4045 BOOST_TEST_CHECK(aColor.getRed() == 0xAA);
4046 BOOST_TEST_CHECK(aColor.getGreen() == 0xBB);
4047 BOOST_TEST_CHECK(aColor.getBlue() == 0x00);
4048 BOOST_TEST_CHECK(aColor.getAlpha() == 0x00);
4049
4050 BOOST_TEST_CHECK(aColor.getC0() == 0xAA);
4051 BOOST_TEST_CHECK(aColor.getC1() == 0xBB);
4052 BOOST_TEST_CHECK(aColor.getC2() == 0x00);
4053 BOOST_TEST_CHECK(aColor.getC3() == 0x00);
4054
4055 aColor.setToWhite();
4056 aColor.setRGBcmpGreyTGA16bit(0x0000);
4057
4058 BOOST_TEST_CHECK(aColor.getRed() == 0x00);
4059 BOOST_TEST_CHECK(aColor.getGreen() == 0x00);
4060 BOOST_TEST_CHECK(aColor.getBlue() == 0x00);
4061 BOOST_TEST_CHECK(aColor.getAlpha() == 0xFF);
4062
4063 BOOST_TEST_CHECK(aColor.getC0() == 0x00);
4064 BOOST_TEST_CHECK(aColor.getC1() == 0x00);
4065 BOOST_TEST_CHECK(aColor.getC2() == 0x00);
4066 BOOST_TEST_CHECK(aColor.getC3() == 0xFF);
4067
4068 aColor.setToWhite();
4069 aColor.setRGBcmpGreyTGA16bit(0xFFFF);
4070
4071 BOOST_TEST_CHECK(aColor.getRed() == 0xFF);
4072 BOOST_TEST_CHECK(aColor.getGreen() == 0xFF);
4073 BOOST_TEST_CHECK(aColor.getBlue() == 0x00);
4074 BOOST_TEST_CHECK(aColor.getAlpha() == 0xFF);
4075
4076 BOOST_TEST_CHECK(aColor.getC0() == 0xFF);
4077 BOOST_TEST_CHECK(aColor.getC1() == 0xFF);
4078 BOOST_TEST_CHECK(aColor.getC2() == 0x00);
4079 BOOST_TEST_CHECK(aColor.getC3() == 0xFF);
4080
4081 aColor.setToWhite();
4082 aColor.setRGBcmpGreyTGA16bit(0xAABB);
4083
4084 BOOST_TEST_CHECK(aColor.getRed() == 0xAA);
4085 BOOST_TEST_CHECK(aColor.getGreen() == 0xBB);
4086 BOOST_TEST_CHECK(aColor.getBlue() == 0x00);
4087 BOOST_TEST_CHECK(aColor.getAlpha() == 0xFF);
4088
4089 BOOST_TEST_CHECK(aColor.getC0() == 0xAA);
4090 BOOST_TEST_CHECK(aColor.getC1() == 0xBB);
4091 BOOST_TEST_CHECK(aColor.getC2() == 0x00);
4092 BOOST_TEST_CHECK(aColor.getC3() == 0xFF);
4093
4094}
4095
4096////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
4097BOOST_AUTO_TEST_CASE(setRGBcmpGreyTGA24bit) {
4098
4099 mjr::colorRGBA8b aColor;
4100 mjr::colorRGB8b bColor;
4101
4102 bColor.setToBlack();
4103 bColor.setRGBcmpGreyTGA24bit(0x00000000);
4104
4105 BOOST_TEST_CHECK(bColor.getRed() == 0x00);
4106 BOOST_TEST_CHECK(bColor.getGreen() == 0x00);
4107 BOOST_TEST_CHECK(bColor.getBlue() == 0x00);
4108
4109 BOOST_TEST_CHECK(bColor.getC0() == 0x00);
4110 BOOST_TEST_CHECK(bColor.getC1() == 0x00);
4111 BOOST_TEST_CHECK(bColor.getC2() == 0x00);
4112
4113 bColor.setToBlack();
4114 bColor.setRGBcmpGreyTGA24bit(0x00FFFFFF);
4115
4116 BOOST_TEST_CHECK(bColor.getRed() == 0xFF);
4117 BOOST_TEST_CHECK(bColor.getGreen() == 0xFF);
4118 BOOST_TEST_CHECK(bColor.getBlue() == 0xFF);
4119
4120 BOOST_TEST_CHECK(bColor.getC0() == 0xFF);
4121 BOOST_TEST_CHECK(bColor.getC1() == 0xFF);
4122 BOOST_TEST_CHECK(bColor.getC2() == 0xFF);
4123
4124 bColor.setToBlack();
4125 bColor.setRGBcmpGreyTGA24bit(0x00CCAABB);
4126
4127 BOOST_TEST_CHECK(bColor.getRed() == 0xAA);
4128 BOOST_TEST_CHECK(bColor.getGreen() == 0xBB);
4129 BOOST_TEST_CHECK(bColor.getBlue() == 0xCC);
4130
4131 BOOST_TEST_CHECK(bColor.getC0() == 0xAA);
4132 BOOST_TEST_CHECK(bColor.getC1() == 0xBB);
4133 BOOST_TEST_CHECK(bColor.getC2() == 0xCC);
4134
4135 bColor.setToWhite();
4136 bColor.setRGBcmpGreyTGA24bit(0x00000000);
4137
4138 BOOST_TEST_CHECK(bColor.getRed() == 0x00);
4139 BOOST_TEST_CHECK(bColor.getGreen() == 0x00);
4140 BOOST_TEST_CHECK(bColor.getBlue() == 0x00);
4141
4142 BOOST_TEST_CHECK(bColor.getC0() == 0x00);
4143 BOOST_TEST_CHECK(bColor.getC1() == 0x00);
4144 BOOST_TEST_CHECK(bColor.getC2() == 0x00);
4145
4146 bColor.setToWhite();
4147 bColor.setRGBcmpGreyTGA24bit(0x00FFFFFF);
4148
4149 BOOST_TEST_CHECK(bColor.getRed() == 0xFF);
4150 BOOST_TEST_CHECK(bColor.getGreen() == 0xFF);
4151 BOOST_TEST_CHECK(bColor.getBlue() == 0xFF);
4152
4153 BOOST_TEST_CHECK(bColor.getC0() == 0xFF);
4154 BOOST_TEST_CHECK(bColor.getC1() == 0xFF);
4155 BOOST_TEST_CHECK(bColor.getC2() == 0xFF);
4156
4157 bColor.setToWhite();
4158 bColor.setRGBcmpGreyTGA24bit(0x00CCAABB);
4159
4160 BOOST_TEST_CHECK(bColor.getRed() == 0xAA);
4161 BOOST_TEST_CHECK(bColor.getGreen() == 0xBB);
4162 BOOST_TEST_CHECK(bColor.getBlue() == 0xCC);
4163
4164 BOOST_TEST_CHECK(bColor.getC0() == 0xAA);
4165 BOOST_TEST_CHECK(bColor.getC1() == 0xBB);
4166 BOOST_TEST_CHECK(bColor.getC2() == 0xCC);
4167
4168////////////////////////////////////////////////////////////////////////////////
4169
4170 aColor.setToBlack();
4171 aColor.setRGBcmpGreyTGA24bit(0x00000000);
4172
4173 BOOST_TEST_CHECK(aColor.getRed() == 0x00);
4174 BOOST_TEST_CHECK(aColor.getGreen() == 0x00);
4175 BOOST_TEST_CHECK(aColor.getBlue() == 0x00);
4176 BOOST_TEST_CHECK(aColor.getAlpha() == 0x00);
4177
4178 BOOST_TEST_CHECK(aColor.getC0() == 0x00);
4179 BOOST_TEST_CHECK(aColor.getC1() == 0x00);
4180 BOOST_TEST_CHECK(aColor.getC2() == 0x00);
4181 BOOST_TEST_CHECK(aColor.getC3() == 0x00);
4182
4183 aColor.setToBlack();
4184 aColor.setRGBcmpGreyTGA24bit(0x00FFFFFF);
4185
4186 BOOST_TEST_CHECK(aColor.getRed() == 0xFF);
4187 BOOST_TEST_CHECK(aColor.getGreen() == 0xFF);
4188 BOOST_TEST_CHECK(aColor.getBlue() == 0xFF);
4189 BOOST_TEST_CHECK(aColor.getAlpha() == 0x00);
4190
4191 BOOST_TEST_CHECK(aColor.getC0() == 0xFF);
4192 BOOST_TEST_CHECK(aColor.getC1() == 0xFF);
4193 BOOST_TEST_CHECK(aColor.getC2() == 0xFF);
4194 BOOST_TEST_CHECK(aColor.getC3() == 0x00);
4195
4196 aColor.setToBlack();
4197 aColor.setRGBcmpGreyTGA24bit(0x00CCAABB);
4198
4199 BOOST_TEST_CHECK(aColor.getRed() == 0xAA);
4200 BOOST_TEST_CHECK(aColor.getGreen() == 0xBB);
4201 BOOST_TEST_CHECK(aColor.getBlue() == 0xCC);
4202 BOOST_TEST_CHECK(aColor.getAlpha() == 0x00);
4203
4204 BOOST_TEST_CHECK(aColor.getC0() == 0xAA);
4205 BOOST_TEST_CHECK(aColor.getC1() == 0xBB);
4206 BOOST_TEST_CHECK(aColor.getC2() == 0xCC);
4207 BOOST_TEST_CHECK(aColor.getC3() == 0x00);
4208
4209 aColor.setToWhite();
4210 aColor.setRGBcmpGreyTGA24bit(0x00000000);
4211
4212 BOOST_TEST_CHECK(aColor.getRed() == 0x00);
4213 BOOST_TEST_CHECK(aColor.getGreen() == 0x00);
4214 BOOST_TEST_CHECK(aColor.getBlue() == 0x00);
4215 BOOST_TEST_CHECK(aColor.getAlpha() == 0xFF);
4216
4217 BOOST_TEST_CHECK(aColor.getC0() == 0x00);
4218 BOOST_TEST_CHECK(aColor.getC1() == 0x00);
4219 BOOST_TEST_CHECK(aColor.getC2() == 0x00);
4220 BOOST_TEST_CHECK(aColor.getC3() == 0xFF);
4221
4222 aColor.setToWhite();
4223 aColor.setRGBcmpGreyTGA24bit(0x00FFFFFF);
4224
4225 BOOST_TEST_CHECK(aColor.getRed() == 0xFF);
4226 BOOST_TEST_CHECK(aColor.getGreen() == 0xFF);
4227 BOOST_TEST_CHECK(aColor.getBlue() == 0xFF);
4228 BOOST_TEST_CHECK(aColor.getAlpha() == 0xFF);
4229
4230 BOOST_TEST_CHECK(aColor.getC0() == 0xFF);
4231 BOOST_TEST_CHECK(aColor.getC1() == 0xFF);
4232 BOOST_TEST_CHECK(aColor.getC2() == 0xFF);
4233 BOOST_TEST_CHECK(aColor.getC3() == 0xFF);
4234
4235 aColor.setToWhite();
4236 aColor.setRGBcmpGreyTGA24bit(0x00CCAABB);
4237
4238 BOOST_TEST_CHECK(aColor.getRed() == 0xAA);
4239 BOOST_TEST_CHECK(aColor.getGreen() == 0xBB);
4240 BOOST_TEST_CHECK(aColor.getBlue() == 0xCC);
4241 BOOST_TEST_CHECK(aColor.getAlpha() == 0xFF);
4242
4243 BOOST_TEST_CHECK(aColor.getC0() == 0xAA);
4244 BOOST_TEST_CHECK(aColor.getC1() == 0xBB);
4245 BOOST_TEST_CHECK(aColor.getC2() == 0xCC);
4246 BOOST_TEST_CHECK(aColor.getC3() == 0xFF);
4247}
4248
4249////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
4250BOOST_AUTO_TEST_CASE(tfrm_logic_cover) {
4251
4252 mjr::colorRGBA8b aColor;
4253 mjr::colorRGBA8b bColor;
4254 mjr::colorRGBA8b cColor;
4255
4256 aColor.setRGBAfromLogPackIntRGBA(0xAABBCCDD);
4257 bColor.setRGBAfromLogPackIntRGBA(0x11223344);
4258
4259 BOOST_TEST_CHECK(aColor.getRed() == 0xAA);
4260 BOOST_TEST_CHECK(aColor.getGreen() == 0xBB);
4261 BOOST_TEST_CHECK(aColor.getBlue() == 0xCC);
4262 BOOST_TEST_CHECK(aColor.getAlpha() == 0xDD);
4263
4264 BOOST_TEST_CHECK(bColor.getRed() == 0x11);
4265 BOOST_TEST_CHECK(bColor.getGreen() == 0x22);
4266 BOOST_TEST_CHECK(bColor.getBlue() == 0x33);
4267 BOOST_TEST_CHECK(bColor.getAlpha() == 0x44);
4268
4269 cColor = aColor;
4270 cColor.tfrmNot();
4271 BOOST_TEST_CHECK(cColor.getRed() == 0x55);
4272 BOOST_TEST_CHECK(cColor.getGreen() == 0x44);
4273 BOOST_TEST_CHECK(cColor.getBlue() == 0x33);
4274 BOOST_TEST_CHECK(cColor.getAlpha() == 0x22);
4275
4276 cColor = aColor;
4277 cColor.tfrmOr(bColor);
4278 BOOST_TEST_CHECK(cColor.getRed() == 0xBB);
4279 BOOST_TEST_CHECK(cColor.getGreen() == 0xBB);
4280 BOOST_TEST_CHECK(cColor.getBlue() == 0xFF);
4281 BOOST_TEST_CHECK(cColor.getAlpha() == 0xDD);
4282
4283 cColor = aColor;
4284 cColor.tfrmNor(bColor);
4285 BOOST_TEST_CHECK(cColor.getRed() == 0x44);
4286 BOOST_TEST_CHECK(cColor.getGreen() == 0x44);
4287 BOOST_TEST_CHECK(cColor.getBlue() == 0x00);
4288 BOOST_TEST_CHECK(cColor.getAlpha() == 0x22);
4289
4290 cColor = aColor;
4291 cColor.tfrmAnd(bColor);
4292 BOOST_TEST_CHECK(cColor.getRed() == 0x00);
4293 BOOST_TEST_CHECK(cColor.getGreen() == 0x22);
4294 BOOST_TEST_CHECK(cColor.getBlue() == 0x00);
4295 BOOST_TEST_CHECK(cColor.getAlpha() == 0x44);
4296
4297 cColor = aColor;
4298 cColor.tfrmNand(bColor);
4299 BOOST_TEST_CHECK(cColor.getRed() == 0xFF);
4300 BOOST_TEST_CHECK(cColor.getGreen() == 0xDD);
4301 BOOST_TEST_CHECK(cColor.getBlue() == 0xFF);
4302 BOOST_TEST_CHECK(cColor.getAlpha() == 0xBB);
4303
4304 cColor = aColor;
4305 cColor.tfrmXor(bColor);
4306 BOOST_TEST_CHECK(cColor.getRed() == 0xBB);
4307 BOOST_TEST_CHECK(cColor.getGreen() == 0x99);
4308 BOOST_TEST_CHECK(cColor.getBlue() == 0xFF);
4309 BOOST_TEST_CHECK(cColor.getAlpha() == 0x99);
4310
4311 cColor = aColor;
4312 cColor.tfrmNxor(bColor);
4313 BOOST_TEST_CHECK(cColor.getRed() == 0x44);
4314 BOOST_TEST_CHECK(cColor.getGreen() == 0x66);
4315 BOOST_TEST_CHECK(cColor.getBlue() == 0x00);
4316 BOOST_TEST_CHECK(cColor.getAlpha() == 0x66);
4317
4318// MJR TODO NOTE BOOST_AUTO_TEST_CASE: Add tfrmShiftL & tfrmShiftR
4319
4320}
4321
4322////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
4323BOOST_AUTO_TEST_CASE(tfrm_logic_noCover) {
4324
4325 mjr::colorRGBA64b aColor;
4326 mjr::colorRGBA64b bColor;
4327 mjr::colorRGBA64b cColor;
4328
4329 aColor.setChansRGBA(0xAAAAAAAAAAAAAAAAu, 0xBBBBBBBBBBBBBBBBu, 0xCCCCCCCCCCCCCCCCu, 0xDDDDDDDDDDDDDDDDu);
4330 bColor.setChansRGBA(0x1111111111111111u, 0x2222222222222222u, 0x3333333333333333u, 0x4444444444444444u);
4331
4332 BOOST_TEST_CHECK(aColor.getRed() == 0xAAAAAAAAAAAAAAAAu);
4333 BOOST_TEST_CHECK(aColor.getGreen() == 0xBBBBBBBBBBBBBBBBu);
4334 BOOST_TEST_CHECK(aColor.getBlue() == 0xCCCCCCCCCCCCCCCCu);
4335 BOOST_TEST_CHECK(aColor.getAlpha() == 0xDDDDDDDDDDDDDDDDu);
4336
4337 BOOST_TEST_CHECK(bColor.getRed() == 0x1111111111111111u);
4338 BOOST_TEST_CHECK(bColor.getGreen() == 0x2222222222222222u);
4339 BOOST_TEST_CHECK(bColor.getBlue() == 0x3333333333333333u);
4340 BOOST_TEST_CHECK(bColor.getAlpha() == 0x4444444444444444u);
4341
4342 cColor = aColor;
4343 cColor.tfrmNot();
4344 BOOST_TEST_CHECK(cColor.getRed() == 0x5555555555555555u);
4345 BOOST_TEST_CHECK(cColor.getGreen() == 0x4444444444444444u);
4346 BOOST_TEST_CHECK(cColor.getBlue() == 0x3333333333333333u);
4347 BOOST_TEST_CHECK(cColor.getAlpha() == 0x2222222222222222u);
4348
4349 cColor = aColor;
4350 cColor.tfrmOr(bColor);
4351 BOOST_TEST_CHECK(cColor.getRed() == 0xBBBBBBBBBBBBBBBBu);
4352 BOOST_TEST_CHECK(cColor.getGreen() == 0xBBBBBBBBBBBBBBBBu);
4353 BOOST_TEST_CHECK(cColor.getBlue() == 0xFFFFFFFFFFFFFFFFu);
4354 BOOST_TEST_CHECK(cColor.getAlpha() == 0xDDDDDDDDDDDDDDDDu);
4355
4356 cColor = aColor;
4357 cColor.tfrmNor(bColor);
4358 BOOST_TEST_CHECK(cColor.getRed() == 0x4444444444444444u);
4359 BOOST_TEST_CHECK(cColor.getGreen() == 0x4444444444444444u);
4360 BOOST_TEST_CHECK(cColor.getBlue() == 0x0000000000000000u);
4361 BOOST_TEST_CHECK(cColor.getAlpha() == 0x2222222222222222u);
4362
4363 cColor = aColor;
4364 cColor.tfrmAnd(bColor);
4365 BOOST_TEST_CHECK(cColor.getRed() == 0x0000000000000000u);
4366 BOOST_TEST_CHECK(cColor.getGreen() == 0x2222222222222222u);
4367 BOOST_TEST_CHECK(cColor.getBlue() == 0x0000000000000000u);
4368 BOOST_TEST_CHECK(cColor.getAlpha() == 0x4444444444444444u);
4369
4370 cColor = aColor;
4371 cColor.tfrmNand(bColor);
4372 BOOST_TEST_CHECK(cColor.getRed() == 0xFFFFFFFFFFFFFFFFu);
4373 BOOST_TEST_CHECK(cColor.getGreen() == 0xDDDDDDDDDDDDDDDDu);
4374 BOOST_TEST_CHECK(cColor.getBlue() == 0xFFFFFFFFFFFFFFFFu);
4375 BOOST_TEST_CHECK(cColor.getAlpha() == 0xBBBBBBBBBBBBBBBBu);
4376
4377 cColor = aColor;
4378 cColor.tfrmXor(bColor);
4379 BOOST_TEST_CHECK(cColor.getRed() == 0xBBBBBBBBBBBBBBBBu);
4380 BOOST_TEST_CHECK(cColor.getGreen() == 0x9999999999999999u);
4381 BOOST_TEST_CHECK(cColor.getBlue() == 0xFFFFFFFFFFFFFFFFu);
4382 BOOST_TEST_CHECK(cColor.getAlpha() == 0x9999999999999999u);
4383
4384 cColor = aColor;
4385 cColor.tfrmNxor(bColor);
4386 BOOST_TEST_CHECK(cColor.getRed() == 0x4444444444444444u);
4387 BOOST_TEST_CHECK(cColor.getGreen() == 0x6666666666666666u);
4388 BOOST_TEST_CHECK(cColor.getBlue() == 0x0000000000000000u);
4389 BOOST_TEST_CHECK(cColor.getAlpha() == 0x6666666666666666u);
4390
4391
4392// MJR TODO NOTE BOOST_AUTO_TEST_CASE: Add tfrmShiftL & tfrmShiftR
4393}
4394
4395////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
4396BOOST_AUTO_TEST_CASE(tfrm_arith) {
4397
4398 mjr::colorRGB8b aColor;
4399 mjr::colorRGB8b bColor;
4400 mjr::colorRGB8b dColor;
4401 mjr::colorRGB8b cColor;
4402
4403 aColor.setRGBfromLogPackIntARGB(0xFF00FF);
4404 bColor.setRGBfromLogPackIntARGB(0x00FFFF);
4405 dColor.setRGBfromLogPackIntARGB(0x0100FF);
4406
4407 BOOST_TEST_CHECK(aColor.getRed() == 0xFF);
4408 BOOST_TEST_CHECK(aColor.getGreen() == 0x00);
4409 BOOST_TEST_CHECK(aColor.getBlue() == 0xFF);
4410
4411 BOOST_TEST_CHECK(bColor.getRed() == 0x00);
4412 BOOST_TEST_CHECK(bColor.getGreen() == 0xFF);
4413 BOOST_TEST_CHECK(bColor.getBlue() == 0xFF);
4414
4415 BOOST_TEST_CHECK(dColor.getRed() == 0x01);
4416 BOOST_TEST_CHECK(dColor.getGreen() == 0x00);
4417 BOOST_TEST_CHECK(dColor.getBlue() == 0xFF);
4418
4419 cColor=aColor;
4420 cColor.tfrmMix(0.0, bColor);
4421 BOOST_TEST_CHECK(cColor.getC0() == 0xFF);
4422 BOOST_TEST_CHECK(cColor.getC1() == 0x00);
4423 BOOST_TEST_CHECK(cColor.getC2() == 0xFF);
4424
4425 cColor=aColor;
4426 cColor.tfrmMix(0.5, bColor);
4427 BOOST_TEST_CHECK(cColor.getC0() == 0x7F);
4428 BOOST_TEST_CHECK(cColor.getC1() == 0x7F);
4429 BOOST_TEST_CHECK(cColor.getC2() == 0xFF);
4430
4431 cColor=aColor;
4432 cColor.tfrmMix(1.0, bColor);
4433 BOOST_TEST_CHECK(cColor.getC0() == 0x00);
4434 BOOST_TEST_CHECK(cColor.getC1() == 0xFF);
4435 BOOST_TEST_CHECK(cColor.getC2() == 0xFF);
4436
4437 cColor = aColor;
4438 cColor.tfrmInvert();
4439 BOOST_TEST_CHECK(cColor.getRed() == 0x00);
4440 BOOST_TEST_CHECK(cColor.getGreen() == 0xFF);
4441 BOOST_TEST_CHECK(cColor.getBlue() == 0x00);
4442
4443 cColor = aColor;
4444 cColor.tfrmAdd(bColor);
4445 BOOST_TEST_CHECK(cColor.getRed() == 0xFF);
4446 BOOST_TEST_CHECK(cColor.getGreen() == 0xFF);
4447 BOOST_TEST_CHECK(cColor.getBlue() == 0xFE); // Overflow wrap
4448
4449 cColor = aColor;
4450 cColor.tfrmAddClamp(bColor);
4451 BOOST_TEST_CHECK(cColor.getRed() == 0xFF);
4452 BOOST_TEST_CHECK(cColor.getGreen() == 0xFF);
4453 BOOST_TEST_CHECK(cColor.getBlue() == 0xFF); // Overflow clamp
4454
4455 cColor = aColor;
4456 cColor.tfrmMult(bColor);
4457 BOOST_TEST_CHECK(cColor.getRed() == 0x00);
4458 BOOST_TEST_CHECK(cColor.getGreen() == 0x00);
4459 BOOST_TEST_CHECK(cColor.getBlue() == 0x01); // Overflow wrap
4460
4461 cColor = aColor;
4462 cColor.tfrmMultClamp(bColor);
4463 BOOST_TEST_CHECK(cColor.getRed() == 0x00);
4464 BOOST_TEST_CHECK(cColor.getGreen() == 0x00);
4465 BOOST_TEST_CHECK(cColor.getBlue() == 0xFF); // Overflow clamp
4466
4467 cColor = aColor;
4468 cColor.tfrmDiv(bColor);
4469 BOOST_TEST_CHECK(cColor.getRed() == 0xFF); // NOOP as bot=0
4470 BOOST_TEST_CHECK(cColor.getGreen() == 0x00);
4471 BOOST_TEST_CHECK(cColor.getBlue() == 0x01);
4472
4473 cColor = aColor;
4474 cColor.tfrmMod(bColor);
4475 BOOST_TEST_CHECK(cColor.getRed() == 0xFF); // NOOP as bot=0
4476 BOOST_TEST_CHECK(cColor.getGreen() == 0x00);
4477 BOOST_TEST_CHECK(cColor.getBlue() == 0x00);
4478
4479 cColor = aColor;
4480 cColor.tfrmDiff(bColor);
4481 BOOST_TEST_CHECK(cColor.getRed() == 0xFF);
4482 BOOST_TEST_CHECK(cColor.getGreen() == 0x01); // Underflow wrap
4483 BOOST_TEST_CHECK(cColor.getBlue() == 0x00);
4484
4485 cColor = aColor;
4486 cColor.tfrmDiffClamp(bColor);
4487 BOOST_TEST_CHECK(cColor.getRed() == 0xFF);
4488 BOOST_TEST_CHECK(cColor.getGreen() == 0x00); // Overflow clamp
4489 BOOST_TEST_CHECK(cColor.getBlue() == 0x00);
4490
4491 cColor = aColor;
4492 cColor.tfrmAbsDiff(bColor);
4493 BOOST_TEST_CHECK(cColor.getRed() == 0xFF);
4494 BOOST_TEST_CHECK(cColor.getGreen() == 0xFF);
4495 BOOST_TEST_CHECK(cColor.getBlue() == 0x00);
4496
4497 cColor = aColor;
4498 cColor.tfrmSqDiff(bColor);
4499 BOOST_TEST_CHECK(cColor.getRed() == 0x01); // Overflow wrap
4500 BOOST_TEST_CHECK(cColor.getGreen() == 0x01); // Overflow wrap
4501 BOOST_TEST_CHECK(cColor.getBlue() == 0x00);
4502
4503 cColor = aColor;
4504 cColor.tfrmNegDiffClamp(bColor);
4505 BOOST_TEST_CHECK(cColor.getRed() == 0x00); // Overflow clamp
4506 BOOST_TEST_CHECK(cColor.getGreen() == 0xFF);
4507 BOOST_TEST_CHECK(cColor.getBlue() == 0x00);
4508
4509 cColor = aColor;
4510 cColor.tfrmAddDivClamp(bColor, dColor);
4511 BOOST_TEST_CHECK(cColor.getRed() == 0xFF);
4512 BOOST_TEST_CHECK(cColor.getGreen() == 0x00);
4513 BOOST_TEST_CHECK(cColor.getBlue() == 0x02);
4514
4515 cColor = aColor;
4516 cColor.tfrmSignDiff(bColor);
4517 BOOST_TEST_CHECK(cColor.getRed() == 0xFF);
4518 BOOST_TEST_CHECK(cColor.getGreen() == 0x00);
4519 BOOST_TEST_CHECK(cColor.getBlue() == 0x7F);
4520}
4521
4522////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
4523BOOST_AUTO_TEST_CASE(tfrm_arith_FLT) {
4524
4525 mjr::colorRGB32F aColor;
4526 mjr::colorRGB32F bColor;
4527 mjr::colorRGB32F dColor;
4528 mjr::colorRGB32F cColor;
4529
4530 aColor.setChansRGB(2.0, 0.0, 2.0);
4531 bColor.setChansRGB(0.0, 2.0, 2.0);
4532 dColor.setChansRGB(0.0, 2.0, 2.0);
4533
4534 cColor=aColor;
4535 cColor.tfrmMix(0.0, bColor);
4536 BOOST_TEST_CHECK(cColor.getC0() == 2.0);
4537 BOOST_TEST_CHECK(cColor.getC1() == 0.0);
4538 BOOST_TEST_CHECK(cColor.getC2() == 2.0);
4539
4540 cColor=aColor;
4541 cColor.tfrmMix(0.5, bColor);
4542 BOOST_TEST_CHECK(cColor.getC0() == 1.0);
4543 BOOST_TEST_CHECK(cColor.getC1() == 1.0);
4544 BOOST_TEST_CHECK(cColor.getC2() == 2.0);
4545
4546 cColor=aColor;
4547 cColor.tfrmMix(1.0, bColor);
4548 BOOST_TEST_CHECK(cColor.getC0() == 0.0);
4549 BOOST_TEST_CHECK(cColor.getC1() == 2.0);
4550 BOOST_TEST_CHECK(cColor.getC2() == 2.0);
4551
4552 cColor = aColor;
4553 cColor.tfrmInvert();
4554 BOOST_TEST_CHECK(cColor.getC0() == -1.0);
4555 BOOST_TEST_CHECK(cColor.getC1() == 1.0);
4556 BOOST_TEST_CHECK(cColor.getC2() == -1.0);
4557
4558 cColor = aColor;
4559 cColor.tfrmAdd(bColor);
4560 BOOST_TEST_CHECK(cColor.getC0() == 2.0);
4561 BOOST_TEST_CHECK(cColor.getC1() == 2.0);
4562 BOOST_TEST_CHECK(cColor.getC2() == 4.0);
4563
4564 cColor = aColor;
4565 cColor.tfrmAddClamp(bColor);
4566 BOOST_TEST_CHECK(cColor.getC0() == 1.0); // clamped to maxChanVal
4567 BOOST_TEST_CHECK(cColor.getC1() == 1.0); // clamped to maxChanVal
4568 BOOST_TEST_CHECK(cColor.getC2() == 1.0); // clamped to maxChanVal
4569
4570 cColor = aColor;
4571 cColor.tfrmMult(bColor);
4572 BOOST_TEST_CHECK(cColor.getC0() == 0.0);
4573 BOOST_TEST_CHECK(cColor.getC1() == 0.0);
4574 BOOST_TEST_CHECK(cColor.getC2() == 4.0);
4575
4576 cColor = aColor;
4577 cColor.tfrmMultClamp(bColor);
4578 BOOST_TEST_CHECK(cColor.getC0() == 0.0);
4579 BOOST_TEST_CHECK(cColor.getC1() == 0.0);
4580 BOOST_TEST_CHECK(cColor.getC2() == 1.0); // clamped to maxChanVal
4581
4582 cColor = aColor;
4583 cColor.tfrmDiv(bColor);
4584 BOOST_TEST_CHECK(cColor.getC0() == 2.0); // NOOP as bot=0
4585 BOOST_TEST_CHECK(cColor.getC1() == 0.0);
4586 BOOST_TEST_CHECK(cColor.getC2() == 1.0);
4587
4588 cColor = aColor;
4589 cColor.tfrmMod(bColor);
4590 BOOST_TEST_CHECK(cColor.getC0() == 2.0); // NOOP as bot=0
4591 BOOST_TEST_CHECK(cColor.getC1() == 0.0);
4592 BOOST_TEST_CHECK(cColor.getC2() == 0.0);
4593
4594 cColor = aColor;
4595 cColor.tfrmDiff(bColor);
4596 BOOST_TEST_CHECK(cColor.getC0() == 2.0);
4597 BOOST_TEST_CHECK(cColor.getC1() == -2.0);
4598 BOOST_TEST_CHECK(cColor.getC2() == 0.0);
4599
4600 cColor = aColor;
4601 cColor.tfrmDiffClamp(bColor);
4602 BOOST_TEST_CHECK(cColor.getC0() == 2.0); // Clamp on bottom only
4603 BOOST_TEST_CHECK(cColor.getC1() == 0.0); //clamped to minChanVal
4604 BOOST_TEST_CHECK(cColor.getC2() == 0.0);
4605
4606 cColor = aColor;
4607 cColor.tfrmAbsDiff(bColor);
4608 BOOST_TEST_CHECK(cColor.getC0() == 2.0);
4609 BOOST_TEST_CHECK(cColor.getC1() == 2.0);
4610 BOOST_TEST_CHECK(cColor.getC2() == 0.0);
4611
4612 cColor = aColor;
4613 cColor.tfrmSqDiff(bColor);
4614 BOOST_TEST_CHECK(cColor.getC0() == 4.0);
4615 BOOST_TEST_CHECK(cColor.getC1() == 4.0);
4616 BOOST_TEST_CHECK(cColor.getC2() == 0.0);
4617
4618 cColor = aColor;
4619 cColor.tfrmNegDiffClamp(bColor);
4620 BOOST_TEST_CHECK(cColor.getC0() == 0.0); // Underflow clamp bottom
4621 BOOST_TEST_CHECK(cColor.getC1() == 2.0);
4622 BOOST_TEST_CHECK(cColor.getC2() == 0.0);
4623
4624 cColor = aColor;
4625 cColor.tfrmAddDivClamp(bColor, dColor);
4626 BOOST_TEST_CHECK(cColor.getC0() == 2.0); // NOOP bot=0
4627 BOOST_TEST_CHECK(cColor.getC1() == 1.0);
4628 BOOST_TEST_CHECK(cColor.getC2() == 1.0); // Overflow clamp at top
4629
4630 cColor = aColor;
4631 cColor.tfrmSignDiff(bColor);
4632 BOOST_TEST_CHECK(cColor.getC0() == 1.0);
4633 BOOST_TEST_CHECK(cColor.getC1() == 0.0);
4634 BOOST_TEST_CHECK(cColor.getC2() == 0.5);
4635}
4636
4637////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
4638BOOST_AUTO_TEST_CASE(isBlack_and_isBlackRGB) {
4639
4640 mjr::colorRGB8b aColor; // integer color with imperfect mask
4641 mjr::colorRGBA8b bColor; // integer color with perfect mask
4642 mjr::colorRGB64b cColor; // integer color without mask
4643 mjr::colorRGB32F dColor; // floating point color with mask
4644 mjr::colorRGBA32F fColor; // floating point color with perfect mask
4645 mjr::colorRGB64F gColor; // floating point color without mask
4646
4647 aColor.setToBlack();
4648 bColor.setToBlack();
4649 cColor.setToBlack();
4650 dColor.setToBlack();
4651 fColor.setToBlack();
4652 gColor.setToBlack();
4653
4654 BOOST_TEST_CHECK(aColor.isBlack() == true);
4655 BOOST_TEST_CHECK(bColor.isBlack() == true);
4656 BOOST_TEST_CHECK(cColor.isBlack() == true);
4657 BOOST_TEST_CHECK(dColor.isBlack() == true);
4658 BOOST_TEST_CHECK(fColor.isBlack() == true);
4659 BOOST_TEST_CHECK(gColor.isBlack() == true);
4660
4661 BOOST_TEST_CHECK(aColor.isBlackRGB() == true);
4662 BOOST_TEST_CHECK(bColor.isBlackRGB() == true);
4663 BOOST_TEST_CHECK(cColor.isBlackRGB() == true);
4664 BOOST_TEST_CHECK(dColor.isBlackRGB() == true);
4665 BOOST_TEST_CHECK(fColor.isBlackRGB() == true);
4666 BOOST_TEST_CHECK(gColor.isBlackRGB() == true);
4667
4668 aColor.setChanToMax(0);
4669 bColor.setChanToMax(0);
4670 cColor.setChanToMax(0);
4671 dColor.setChanToMax(0);
4672 fColor.setChanToMax(0);
4673 gColor.setChanToMax(0);
4674
4675 BOOST_TEST_CHECK(aColor.isBlack() == false);
4676 BOOST_TEST_CHECK(bColor.isBlack() == false);
4677 BOOST_TEST_CHECK(cColor.isBlack() == false);
4678 BOOST_TEST_CHECK(dColor.isBlack() == false);
4679 BOOST_TEST_CHECK(fColor.isBlack() == false);
4680 BOOST_TEST_CHECK(gColor.isBlack() == false);
4681
4682 BOOST_TEST_CHECK(aColor.isBlackRGB() == false);
4683 BOOST_TEST_CHECK(bColor.isBlackRGB() == false);
4684 BOOST_TEST_CHECK(cColor.isBlackRGB() == false);
4685 BOOST_TEST_CHECK(dColor.isBlackRGB() == false);
4686 BOOST_TEST_CHECK(fColor.isBlackRGB() == false);
4687 BOOST_TEST_CHECK(gColor.isBlackRGB() == false);
4688
4689 aColor.setToWhite();
4690 bColor.setToWhite();
4691 cColor.setToWhite();
4692 dColor.setToWhite();
4693 fColor.setToWhite();
4694 gColor.setToWhite();
4695
4696 BOOST_TEST_CHECK(aColor.isBlack() == false);
4697 BOOST_TEST_CHECK(bColor.isBlack() == false);
4698 BOOST_TEST_CHECK(cColor.isBlack() == false);
4699 BOOST_TEST_CHECK(dColor.isBlack() == false);
4700 BOOST_TEST_CHECK(fColor.isBlack() == false);
4701 BOOST_TEST_CHECK(gColor.isBlack() == false);
4702
4703 BOOST_TEST_CHECK(aColor.isBlackRGB() == false);
4704 BOOST_TEST_CHECK(bColor.isBlackRGB() == false);
4705 BOOST_TEST_CHECK(cColor.isBlackRGB() == false);
4706 BOOST_TEST_CHECK(dColor.isBlackRGB() == false);
4707 BOOST_TEST_CHECK(fColor.isBlackRGB() == false);
4708 BOOST_TEST_CHECK(gColor.isBlackRGB() == false);
4709
4710 bColor.setChansRGBA(0, 0, 0, 1);
4711 fColor.setChansRGBA(0, 0, 0, 1);
4712
4713 BOOST_TEST_CHECK(bColor.isBlack() == false);
4714 BOOST_TEST_CHECK(fColor.isBlack() == false);
4715
4716 BOOST_TEST_CHECK(bColor.isBlackRGB() == true);
4717 BOOST_TEST_CHECK(fColor.isBlackRGB() == true);
4718}
4719
4720////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
4721BOOST_AUTO_TEST_CASE(isEqual_and_isEqualRGB_and_isNotEqual) {
4722
4723 mjr::colorRGB8b aLcolor; // integer color with imperfect mask
4724 mjr::colorRGBA8b bLcolor; // integer color with perfect mask
4725 mjr::colorRGB64b cLcolor; // integer color without mask
4726 mjr::colorRGB32F dLcolor; // floating point color with mask
4727 mjr::colorRGBA32F fLcolor; // floating point color with perfect mask
4728 mjr::colorRGB64F gLcolor; // floating point color without mask
4729
4730 mjr::colorRGB8b aRcolor; // integer color with imperfect mask
4731 mjr::colorRGBA8b bRcolor; // integer color with perfect mask
4732 mjr::colorRGB64b cRcolor; // integer color without mask
4733 mjr::colorRGB32F dRcolor; // floating point color with mask
4734 mjr::colorRGBA32F fRcolor; // floating point color with perfect mask
4735 mjr::colorRGB64F gRcolor; // floating point color without mask
4736
4737 aLcolor.setToBlack();
4738 bLcolor.setToBlack();
4739 cLcolor.setToBlack();
4740 dLcolor.setToBlack();
4741 fLcolor.setToBlack();
4742 gLcolor.setToBlack();
4743
4744 aRcolor.setToBlack();
4745 bRcolor.setToBlack();
4746 cRcolor.setToBlack();
4747 dRcolor.setToBlack();
4748 fRcolor.setToBlack();
4749 gRcolor.setToBlack();
4750
4751 BOOST_TEST_CHECK(aLcolor.isEqual(aRcolor) == true);
4752 BOOST_TEST_CHECK(bLcolor.isEqual(bRcolor) == true);
4753 BOOST_TEST_CHECK(cLcolor.isEqual(cRcolor) == true);
4754 BOOST_TEST_CHECK(dLcolor.isEqual(dRcolor) == true);
4755 BOOST_TEST_CHECK(fLcolor.isEqual(fRcolor) == true);
4756 BOOST_TEST_CHECK(gLcolor.isEqual(gRcolor) == true);
4757
4758 BOOST_TEST_CHECK(aLcolor.isNotEqual(aRcolor) == false);
4759 BOOST_TEST_CHECK(bLcolor.isNotEqual(bRcolor) == false);
4760 BOOST_TEST_CHECK(cLcolor.isNotEqual(cRcolor) == false);
4761 BOOST_TEST_CHECK(dLcolor.isNotEqual(dRcolor) == false);
4762 BOOST_TEST_CHECK(fLcolor.isNotEqual(fRcolor) == false);
4763 BOOST_TEST_CHECK(gLcolor.isNotEqual(gRcolor) == false);
4764
4765 BOOST_TEST_CHECK(aLcolor.isEqualRGB(aRcolor) == true);
4766 BOOST_TEST_CHECK(bLcolor.isEqualRGB(bRcolor) == true);
4767 BOOST_TEST_CHECK(cLcolor.isEqualRGB(cRcolor) == true);
4768 BOOST_TEST_CHECK(dLcolor.isEqualRGB(dRcolor) == true);
4769 BOOST_TEST_CHECK(fLcolor.isEqualRGB(fRcolor) == true);
4770 BOOST_TEST_CHECK(gLcolor.isEqualRGB(gRcolor) == true);
4771
4772 aLcolor.setChanToMax(0);
4773 bLcolor.setChanToMax(0);
4774 cLcolor.setChanToMax(0);
4775 dLcolor.setChanToMax(0);
4776 fLcolor.setChanToMax(0);
4777 gLcolor.setChanToMax(0);
4778
4779 BOOST_TEST_CHECK(aLcolor.isEqual(aRcolor) == false);
4780 BOOST_TEST_CHECK(bLcolor.isEqual(bRcolor) == false);
4781 BOOST_TEST_CHECK(cLcolor.isEqual(cRcolor) == false);
4782 BOOST_TEST_CHECK(dLcolor.isEqual(dRcolor) == false);
4783 BOOST_TEST_CHECK(fLcolor.isEqual(fRcolor) == false);
4784 BOOST_TEST_CHECK(gLcolor.isEqual(gRcolor) == false);
4785
4786 BOOST_TEST_CHECK(aLcolor.isNotEqual(aRcolor) == true);
4787 BOOST_TEST_CHECK(bLcolor.isNotEqual(bRcolor) == true);
4788 BOOST_TEST_CHECK(cLcolor.isNotEqual(cRcolor) == true);
4789 BOOST_TEST_CHECK(dLcolor.isNotEqual(dRcolor) == true);
4790 BOOST_TEST_CHECK(fLcolor.isNotEqual(fRcolor) == true);
4791 BOOST_TEST_CHECK(gLcolor.isNotEqual(gRcolor) == true);
4792
4793 BOOST_TEST_CHECK(aLcolor.isEqualRGB(aRcolor) == false);
4794 BOOST_TEST_CHECK(bLcolor.isEqualRGB(bRcolor) == false);
4795 BOOST_TEST_CHECK(cLcolor.isEqualRGB(cRcolor) == false);
4796 BOOST_TEST_CHECK(dLcolor.isEqualRGB(dRcolor) == false);
4797 BOOST_TEST_CHECK(fLcolor.isEqualRGB(fRcolor) == false);
4798 BOOST_TEST_CHECK(gLcolor.isEqualRGB(gRcolor) == false);
4799
4800 aRcolor.setChanToMax(0);
4801 bRcolor.setChanToMax(0);
4802 cRcolor.setChanToMax(0);
4803 dRcolor.setChanToMax(0);
4804 fRcolor.setChanToMax(0);
4805 gRcolor.setChanToMax(0);
4806
4807 BOOST_TEST_CHECK(aLcolor.isEqual(aRcolor) == true);
4808 BOOST_TEST_CHECK(bLcolor.isEqual(bRcolor) == true);
4809 BOOST_TEST_CHECK(cLcolor.isEqual(cRcolor) == true);
4810 BOOST_TEST_CHECK(dLcolor.isEqual(dRcolor) == true);
4811 BOOST_TEST_CHECK(fLcolor.isEqual(fRcolor) == true);
4812 BOOST_TEST_CHECK(gLcolor.isEqual(gRcolor) == true);
4813
4814 BOOST_TEST_CHECK(aLcolor.isNotEqual(aRcolor) == false);
4815 BOOST_TEST_CHECK(bLcolor.isNotEqual(bRcolor) == false);
4816 BOOST_TEST_CHECK(cLcolor.isNotEqual(cRcolor) == false);
4817 BOOST_TEST_CHECK(dLcolor.isNotEqual(dRcolor) == false);
4818 BOOST_TEST_CHECK(fLcolor.isNotEqual(fRcolor) == false);
4819 BOOST_TEST_CHECK(gLcolor.isNotEqual(gRcolor) == false);
4820
4821 BOOST_TEST_CHECK(aLcolor.isEqualRGB(aRcolor) == true);
4822 BOOST_TEST_CHECK(bLcolor.isEqualRGB(bRcolor) == true);
4823 BOOST_TEST_CHECK(cLcolor.isEqualRGB(cRcolor) == true);
4824 BOOST_TEST_CHECK(dLcolor.isEqualRGB(dRcolor) == true);
4825 BOOST_TEST_CHECK(fLcolor.isEqualRGB(fRcolor) == true);
4826 BOOST_TEST_CHECK(gLcolor.isEqualRGB(gRcolor) == true);
4827
4828 aLcolor.setToWhite();
4829 bLcolor.setToWhite();
4830 cLcolor.setToWhite();
4831 dLcolor.setToWhite();
4832 fLcolor.setToWhite();
4833 gLcolor.setToWhite();
4834
4835 BOOST_TEST_CHECK(aLcolor.isEqual(aRcolor) == false);
4836 BOOST_TEST_CHECK(bLcolor.isEqual(bRcolor) == false);
4837 BOOST_TEST_CHECK(cLcolor.isEqual(cRcolor) == false);
4838 BOOST_TEST_CHECK(dLcolor.isEqual(dRcolor) == false);
4839 BOOST_TEST_CHECK(fLcolor.isEqual(fRcolor) == false);
4840 BOOST_TEST_CHECK(gLcolor.isEqual(gRcolor) == false);
4841
4842 BOOST_TEST_CHECK(aLcolor.isNotEqual(aRcolor) == true);
4843 BOOST_TEST_CHECK(bLcolor.isNotEqual(bRcolor) == true);
4844 BOOST_TEST_CHECK(cLcolor.isNotEqual(cRcolor) == true);
4845 BOOST_TEST_CHECK(dLcolor.isNotEqual(dRcolor) == true);
4846 BOOST_TEST_CHECK(fLcolor.isNotEqual(fRcolor) == true);
4847 BOOST_TEST_CHECK(gLcolor.isNotEqual(gRcolor) == true);
4848
4849 BOOST_TEST_CHECK(aLcolor.isEqualRGB(aRcolor) == false);
4850 BOOST_TEST_CHECK(bLcolor.isEqualRGB(bRcolor) == false);
4851 BOOST_TEST_CHECK(cLcolor.isEqualRGB(cRcolor) == false);
4852 BOOST_TEST_CHECK(dLcolor.isEqualRGB(dRcolor) == false);
4853 BOOST_TEST_CHECK(fLcolor.isEqualRGB(fRcolor) == false);
4854 BOOST_TEST_CHECK(gLcolor.isEqualRGB(gRcolor) == false);
4855
4856 bLcolor.setChansRGBA(1, 2, 3, 4);
4857 fLcolor.setChansRGBA(1, 2, 3, 4);
4858
4859 bRcolor.setChansRGBA(1, 2, 3, 5);
4860 fRcolor.setChansRGBA(1, 2, 3, 5);
4861
4862 BOOST_TEST_CHECK(bLcolor.isEqual(bRcolor) == false);
4863 BOOST_TEST_CHECK(fLcolor.isEqual(fRcolor) == false);
4864
4865 BOOST_TEST_CHECK(bLcolor.isEqualRGB(bRcolor) == true);
4866 BOOST_TEST_CHECK(fLcolor.isEqualRGB(fRcolor) == true);
4867}
4868
4869////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
4870BOOST_AUTO_TEST_CASE(dist_int) {
4871
4872 mjr::colorRGBA8b aColor;
4873 mjr::colorRGBA8b bColor;
4874
4875 ////////////////////////////////////////////////////////////////////////////////
4876 aColor.setToWhite();
4877 bColor.setToBlack();
4878
4879 BOOST_TEST_CHECK(aColor.distHypot( bColor) == std::sqrt(mjr::colorRGBA8b::maxChanVal*mjr::colorRGBA8b::maxChanVal*4));
4880 BOOST_TEST_CHECK(aColor.distSumAbs(bColor) == mjr::colorRGBA8b::maxChanVal*4);
4881 BOOST_TEST_CHECK(aColor.distMaxAbs(bColor) == mjr::colorRGBA8b::maxChanVal);
4882
4883 BOOST_TEST_CHECK(bColor.distHypot( aColor) == std::sqrt(mjr::colorRGBA8b::maxChanVal*mjr::colorRGBA8b::maxChanVal*4));
4884 BOOST_TEST_CHECK(bColor.distSumAbs(aColor) == mjr::colorRGBA8b::maxChanVal*4);
4885 BOOST_TEST_CHECK(bColor.distMaxAbs(aColor) == mjr::colorRGBA8b::maxChanVal);
4886
4887 ////////////////////////////////////////////////////////////////////////////////
4888 aColor.setToWhite();
4889 bColor.setToWhite();
4890
4891 BOOST_TEST_CHECK(aColor.distHypot( bColor) == 0);
4892 BOOST_TEST_CHECK(aColor.distSumAbs(bColor) == 0);
4893 BOOST_TEST_CHECK(aColor.distMaxAbs(bColor) == 0);
4894
4895 BOOST_TEST_CHECK(bColor.distHypot( aColor) == 0);
4896 BOOST_TEST_CHECK(bColor.distSumAbs(aColor) == 0);
4897 BOOST_TEST_CHECK(bColor.distMaxAbs(aColor) == 0);
4898
4899 ////////////////////////////////////////////////////////////////////////////////
4900 aColor.setToCyan();
4901 bColor.setToBlack();
4902
4903 BOOST_TEST_CHECK(aColor.distHypot( bColor) == std::sqrt(mjr::colorRGBA8b::maxChanVal*mjr::colorRGBA8b::maxChanVal*3), boost::test_tools::tolerance(0.00001));
4904 BOOST_TEST_CHECK(aColor.distSumAbs(bColor) == mjr::colorRGBA8b::maxChanVal*3);
4905 BOOST_TEST_CHECK(aColor.distMaxAbs(bColor) == mjr::colorRGBA8b::maxChanVal);
4906
4907 BOOST_TEST_CHECK(bColor.distHypot( aColor) == std::sqrt(mjr::colorRGBA8b::maxChanVal*mjr::colorRGBA8b::maxChanVal*3), boost::test_tools::tolerance(0.00001));
4908 BOOST_TEST_CHECK(bColor.distSumAbs(aColor) == mjr::colorRGBA8b::maxChanVal*3);
4909 BOOST_TEST_CHECK(bColor.distMaxAbs(aColor) == mjr::colorRGBA8b::maxChanVal);
4910}
4911
4912////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
4913BOOST_AUTO_TEST_CASE(dist_flt) {
4914
4915 mjr::colorRGBA32F aColor;
4916 mjr::colorRGBA32F bColor;
4917
4918 ////////////////////////////////////////////////////////////////////////////////
4919 aColor.setToWhite();
4920 bColor.setToBlack();
4921
4922 BOOST_TEST_CHECK(aColor.distHypot( bColor) == std::sqrt(mjr::colorRGBA32F::maxChanVal*mjr::colorRGBA32F::maxChanVal*4), boost::test_tools::tolerance(0.00001));
4923 BOOST_TEST_CHECK(aColor.distSumAbs(bColor) == mjr::colorRGBA32F::maxChanVal*4);
4924 BOOST_TEST_CHECK(aColor.distMaxAbs(bColor) == mjr::colorRGBA32F::maxChanVal);
4925
4926 BOOST_TEST_CHECK(bColor.distHypot( aColor) == std::sqrt(mjr::colorRGBA32F::maxChanVal*mjr::colorRGBA32F::maxChanVal*4), boost::test_tools::tolerance(0.00001));
4927 BOOST_TEST_CHECK(bColor.distSumAbs(aColor) == mjr::colorRGBA32F::maxChanVal*4);
4928 BOOST_TEST_CHECK(bColor.distMaxAbs(aColor) == mjr::colorRGBA32F::maxChanVal);
4929
4930 ////////////////////////////////////////////////////////////////////////////////
4931 aColor.setToWhite();
4932 bColor.setToWhite();
4933
4934 BOOST_TEST_CHECK(aColor.distHypot( bColor) == 0);
4935 BOOST_TEST_CHECK(aColor.distSumAbs(bColor) == 0);
4936 BOOST_TEST_CHECK(aColor.distMaxAbs(bColor) == 0);
4937
4938 BOOST_TEST_CHECK(bColor.distHypot( aColor) == 0);
4939 BOOST_TEST_CHECK(bColor.distSumAbs(aColor) == 0);
4940 BOOST_TEST_CHECK(bColor.distMaxAbs(aColor) == 0);
4941
4942 ////////////////////////////////////////////////////////////////////////////////
4943 aColor.setToCyan();
4944 bColor.setToBlack();
4945
4946 BOOST_TEST_CHECK(aColor.distHypot( bColor) == std::sqrt(mjr::colorRGBA32F::maxChanVal*mjr::colorRGBA32F::maxChanVal*3), boost::test_tools::tolerance(0.00001));
4947 BOOST_TEST_CHECK(aColor.distSumAbs(bColor) == mjr::colorRGBA32F::maxChanVal*3);
4948 BOOST_TEST_CHECK(aColor.distMaxAbs(bColor) == mjr::colorRGBA32F::maxChanVal);
4949
4950 BOOST_TEST_CHECK(bColor.distHypot( aColor) == std::sqrt(mjr::colorRGBA32F::maxChanVal*mjr::colorRGBA32F::maxChanVal*3), boost::test_tools::tolerance(0.00001));
4951 BOOST_TEST_CHECK(bColor.distSumAbs(aColor) == mjr::colorRGBA32F::maxChanVal*3);
4952 BOOST_TEST_CHECK(bColor.distMaxAbs(aColor) == mjr::colorRGBA32F::maxChanVal);
4953
4954 ////////////////////////////////////////////////////////////////////////////////
4955 aColor.setChansRGBA(0.5, 0.5, 0.5, 0.5);
4956 bColor.setToBlack();
4957
4958 BOOST_TEST_CHECK(aColor.distHypot( bColor) == std::sqrt(0.5*0.5*4), boost::test_tools::tolerance(0.00001));
4959 BOOST_TEST_CHECK(aColor.distSumAbs(bColor) == 0.5*4);
4960 BOOST_TEST_CHECK(aColor.distMaxAbs(bColor) == 0.5);
4961
4962 BOOST_TEST_CHECK(bColor.distHypot( aColor) == std::sqrt(0.5*0.5*4), boost::test_tools::tolerance(0.00001));
4963 BOOST_TEST_CHECK(bColor.distSumAbs(aColor) == 0.5*4);
4964 BOOST_TEST_CHECK(bColor.distMaxAbs(aColor) == 0.5);
4965}
4966
4967////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
4968BOOST_AUTO_TEST_CASE(lum_int) {
4969
4970 BOOST_TEST_CHECK(mjr::colorRGBA8b( 2, 5, 7, 11).rgb2GreyDotProd(13, 17, 23) == 272);
4971 BOOST_TEST_CHECK(mjr::colorRGBA32F(2, 5, 7, 11).rgb2GreyDotProd(13, 17, 23) == 272);
4972
4973 BOOST_TEST_CHECK(mjr::colorRGBA8b(255, 255, 255, 255).rgb2GreyDotProd(255, 255, 255) == 195075); // Too big for an arith SP type...
4974
4975 BOOST_TEST_CHECK(mjr::colorRGBA8b( 2, 5, 7, 11).luminanceRGB() == 0.0176729411765, boost::test_tools::tolerance(0.00001));
4976 BOOST_TEST_CHECK(mjr::colorRGBA32F(2, 5, 7, 11).luminanceRGB() == 4.5066, boost::test_tools::tolerance(0.00001));
4977
4978 BOOST_TEST_CHECK(mjr::colorRGBA8b( 2, 5, 7, 11).intensityRGB() == 14);
4979 BOOST_TEST_CHECK(mjr::colorRGBA32F(2, 5, 7, 11).intensityRGB() == 14);
4980
4981 BOOST_TEST_CHECK(mjr::colorRGBA8b( 2, 5, 7, 11).intensity() == 25);
4982 BOOST_TEST_CHECK(mjr::colorRGBA32F(2, 5, 7, 11).intensity() == 25);
4983
4984 BOOST_TEST_CHECK(mjr::colorRGBA8b( 2, 5, 7, 11).intensityScaledRGB() == 0.0183006562, boost::test_tools::tolerance(0.00001));
4985 BOOST_TEST_CHECK(mjr::colorRGBA32F(2, 5, 7, 11).intensityScaledRGB() == 4.66666698, boost::test_tools::tolerance(0.00001));
4986
4987 BOOST_TEST_CHECK(mjr::colorRGBA8b( 2, 5, 7, 11).intensityScaled() == 0.0245098039216, boost::test_tools::tolerance(0.00001));
4988 BOOST_TEST_CHECK(mjr::colorRGBA32F(2, 5, 7, 11).intensityScaled() == 6.25, boost::test_tools::tolerance(0.00001));
4989}
4990
4991////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
4992BOOST_AUTO_TEST_CASE(dotProd_getMax_getMin) {
4993
4994 BOOST_TEST_CHECK(mjr::colorRGBA8b(2, 5, 7, 11).dotProd(mjr::colorRGBA8b(13, 17, 23, 27)) == 569);
4995 BOOST_TEST_CHECK(mjr::colorRGBA32F(2, 5, 7, 11).dotProd(mjr::colorRGBA32F(13, 17, 23, 27)) == 569);
4996
4997 BOOST_TEST_CHECK(mjr::colorRGBA8b(255, 255, 255, 255).dotProd(mjr::colorRGBA8b(255, 255, 255, 255)) == 260100); // Too big for an arith SP type...
4998
4999 BOOST_TEST_CHECK(mjr::colorRGBA8b(2, 5, 7, 11).getMaxC() == 11);
5000 BOOST_TEST_CHECK(mjr::colorRGBA8b(2, 5, 7, 11).getMaxRGB() == 7);
5001 BOOST_TEST_CHECK(mjr::colorRGBA32F(2, 5, 7, 11).getMaxC() == 11);
5002 BOOST_TEST_CHECK(mjr::colorRGBA32F(2, 5, 7, 11).getMaxRGB() == 7);
5003
5004 BOOST_TEST_CHECK(mjr::colorRGBA8b(2, 5, 7, 1).getMinC() == 1);
5005 BOOST_TEST_CHECK(mjr::colorRGBA8b(2, 5, 7, 1).getMinRGB() == 2);
5006 BOOST_TEST_CHECK(mjr::colorRGBA32F(2, 5, 7, 1).getMinC() == 1);
5007 BOOST_TEST_CHECK(mjr::colorRGBA32F(2, 5, 7, 1).getMinRGB() == 2);
5008
5009 BOOST_TEST_CHECK(mjr::colorRGB8b(2, 5, 7).getMaxC() == 7);
5010 BOOST_TEST_CHECK(mjr::colorRGB32F(2, 5, 7).getMaxC() == 7);
5011
5012 BOOST_TEST_CHECK(mjr::colorRGB8b(2, 5, 7).getMinC() == 2);
5013 BOOST_TEST_CHECK(mjr::colorRGB32F(2, 5, 7).getMinC() == 2);
5014
5015 mjr::color2c8b aColor; aColor.setC0(5); aColor.setC1(2);
5016 mjr::color2c8b bColor; bColor.setC0(5); bColor.setC1(2);
5017
5018 BOOST_TEST_CHECK(aColor.getMaxC() == 5);
5019 BOOST_TEST_CHECK(bColor.getMaxC() == 5);
5020
5021 BOOST_TEST_CHECK(aColor.getMinC() == 2);
5022 BOOST_TEST_CHECK(bColor.getMinC() == 2);
5023
5024 BOOST_TEST_CHECK(mjr::colorRGBA8b(2).getMaxC() == 2);
5025 BOOST_TEST_CHECK(mjr::colorRGBA32F(2).getMaxC() == 2);
5026
5027 BOOST_TEST_CHECK(mjr::colorRGBA8b(2).getMinC() == 2);
5028 BOOST_TEST_CHECK(mjr::colorRGBA32F(2).getMinC() == 2);
5029}
5030
5031////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
5032BOOST_AUTO_TEST_CASE(WavelengthCM) {
5033
5034 mjr::colorRGBA8b aColor;
5035 mjr::colorRGBA8b bColor;
5036
5037 mjr::colorRGBA32F cColor;
5038 mjr::colorRGBA32F dColor;
5039
5040 aColor.setToBlack();
5041 aColor.setRGBfromWavelengthCM(570);
5042 BOOST_TEST_CHECK(aColor.getRed() == 173);
5043 BOOST_TEST_CHECK(aColor.getGreen() == 189);
5044 BOOST_TEST_CHECK(aColor.getBlue() == 2);
5045 BOOST_TEST_CHECK(aColor.getAlpha() == aColor.minChanVal);
5046
5047 aColor.setToWhite();
5048 aColor.setRGBfromWavelengthCM(570);
5049 BOOST_TEST_CHECK(aColor.getRed() == 173);
5050 BOOST_TEST_CHECK(aColor.getGreen() == 189);
5051 BOOST_TEST_CHECK(aColor.getBlue() == 2);
5052 BOOST_TEST_CHECK(aColor.getAlpha() == aColor.maxChanVal);
5053
5054 aColor.setRGBfromWavelengthCM(571, mjr::colorRGBA8b::cmfInterpolationEnum::FLOOR);
5055 bColor.setRGBfromWavelengthCM(570);
5056 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
5057 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
5058 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
5059
5060 aColor.setRGBfromWavelengthCM(571, mjr::colorRGBA8b::cmfInterpolationEnum::CEILING);
5061 bColor.setRGBfromWavelengthCM(575);
5062 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
5063 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
5064 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
5065
5066 aColor.setRGBfromWavelengthCM(571, mjr::colorRGBA8b::cmfInterpolationEnum::NEAREST);
5067 bColor.setRGBfromWavelengthCM(570);
5068 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
5069 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
5070 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
5071
5072 aColor.setRGBfromWavelengthCM(574, mjr::colorRGBA8b::cmfInterpolationEnum::NEAREST);
5073 bColor.setRGBfromWavelengthCM(575);
5074 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
5075 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
5076 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
5077
5078 aColor.setRGBfromWavelengthCM(572, mjr::colorRGBA8b::cmfInterpolationEnum::LINEAR);
5079 BOOST_TEST_CHECK(aColor.getRed() == 182);
5080 BOOST_TEST_CHECK(aColor.getGreen() == 181);
5081 BOOST_TEST_CHECK(aColor.getBlue() == 0);
5082
5083 aColor.setRGBfromWavelengthCM(572, mjr::colorRGBA8b::cmfInterpolationEnum::BUMP);
5084 BOOST_TEST_CHECK(aColor.getRed() == 167);
5085 BOOST_TEST_CHECK(aColor.getGreen() == 169);
5086 BOOST_TEST_CHECK(aColor.getBlue() == 0);
5087
5088////////////////////////////////////////////////////////////////////////////////
5089
5090 cColor.setToBlack();
5091 cColor.setRGBfromWavelengthCM(570);
5092 BOOST_TEST_CHECK(cColor.getRed() == 0.679159, boost::test_tools::tolerance(0.00001));
5093 BOOST_TEST_CHECK(cColor.getGreen() == 0.743843, boost::test_tools::tolerance(0.00001));
5094 BOOST_TEST_CHECK(cColor.getBlue() == 0.00798483, boost::test_tools::tolerance(0.00001));
5095 BOOST_TEST_CHECK(cColor.getAlpha() == cColor.minChanVal);
5096
5097 cColor.setToWhite();
5098 cColor.setRGBfromWavelengthCM(570);
5099 BOOST_TEST_CHECK(cColor.getRed() == 0.679159, boost::test_tools::tolerance(0.00001));
5100 BOOST_TEST_CHECK(cColor.getGreen() == 0.743843, boost::test_tools::tolerance(0.00001));
5101 BOOST_TEST_CHECK(cColor.getBlue() == 0.00798483, boost::test_tools::tolerance(0.00001));
5102 BOOST_TEST_CHECK(cColor.getAlpha() == cColor.maxChanVal);
5103
5104 cColor.setRGBfromWavelengthCM(571, mjr::colorRGBA32F::cmfInterpolationEnum::FLOOR);
5105 dColor.setRGBfromWavelengthCM(570);
5106 BOOST_TEST_CHECK(cColor.getRed() == dColor.getRed());
5107 BOOST_TEST_CHECK(cColor.getGreen() == dColor.getGreen());
5108 BOOST_TEST_CHECK(cColor.getBlue() == dColor.getBlue());
5109
5110 cColor.setRGBfromWavelengthCM(571, mjr::colorRGBA32F::cmfInterpolationEnum::CEILING);
5111 dColor.setRGBfromWavelengthCM(575);
5112 BOOST_TEST_CHECK(cColor.getRed() == dColor.getRed());
5113 BOOST_TEST_CHECK(cColor.getGreen() == dColor.getGreen());
5114 BOOST_TEST_CHECK(cColor.getBlue() == dColor.getBlue());
5115
5116 cColor.setRGBfromWavelengthCM(571, mjr::colorRGBA32F::cmfInterpolationEnum::NEAREST);
5117 dColor.setRGBfromWavelengthCM(570);
5118 BOOST_TEST_CHECK(cColor.getRed() == dColor.getRed());
5119 BOOST_TEST_CHECK(cColor.getGreen() == dColor.getGreen());
5120 BOOST_TEST_CHECK(cColor.getBlue() == dColor.getBlue());
5121
5122 cColor.setRGBfromWavelengthCM(574, mjr::colorRGBA32F::cmfInterpolationEnum::NEAREST);
5123 dColor.setRGBfromWavelengthCM(575);
5124 BOOST_TEST_CHECK(cColor.getRed() == dColor.getRed());
5125 BOOST_TEST_CHECK(cColor.getGreen() == dColor.getGreen());
5126 BOOST_TEST_CHECK(cColor.getBlue() == dColor.getBlue());
5127
5128 cColor.setRGBfromWavelengthCM(572, mjr::colorRGBA32F::cmfInterpolationEnum::LINEAR);
5129 BOOST_TEST_CHECK(cColor.getRed() == 0.713749886, boost::test_tools::tolerance(0.00001));
5130 BOOST_TEST_CHECK(cColor.getGreen() == 0.710754037, boost::test_tools::tolerance(0.00001));
5131 BOOST_TEST_CHECK(cColor.getBlue() == 0.00187643478, boost::test_tools::tolerance(0.00001));
5132
5133 cColor.setRGBfromWavelengthCM(572, mjr::colorRGBA32F::cmfInterpolationEnum::BUMP);
5134 BOOST_TEST_CHECK(cColor.getRed() == 0.654946387, boost::test_tools::tolerance(0.00001));
5135 BOOST_TEST_CHECK(cColor.getGreen() == 0.662842572, boost::test_tools::tolerance(0.00001));
5136 BOOST_TEST_CHECK(cColor.getBlue() == 3.4287558e-07, boost::test_tools::tolerance(0.00001));
5137
5138}
5139
5140////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
5141BOOST_AUTO_TEST_CASE(WavelengthLA) {
5142
5143 mjr::colorRGBA8b aColor;
5144 mjr::colorRGBA8b bColor;
5145
5146 mjr::colorRGBA32F cColor;
5147 mjr::colorRGBA32F dColor;
5148
5149 aColor.setToBlack();
5150 aColor.setRGBfromWavelengthLA(570);
5151 BOOST_TEST_CHECK(aColor.getRed() == 0xda);
5152 BOOST_TEST_CHECK(aColor.getGreen() == 0xff);
5153 BOOST_TEST_CHECK(aColor.getBlue() == 0x00);
5154 BOOST_TEST_CHECK(aColor.getAlpha() == aColor.minChanVal);
5155
5156 aColor.setToWhite();
5157 aColor.setRGBfromWavelengthLA(570);
5158 BOOST_TEST_CHECK(aColor.getRed() == 0xda);
5159 BOOST_TEST_CHECK(aColor.getGreen() == 0xff);
5160 BOOST_TEST_CHECK(aColor.getBlue() == 0x00);
5161 BOOST_TEST_CHECK(aColor.getAlpha() == aColor.maxChanVal);
5162
5163////////////////////////////////////////////////////////////////////////////////
5164
5165 cColor.setToBlack();
5166 cColor.setRGBfromWavelengthLA(570);
5167 BOOST_TEST_CHECK(cColor.getRed() == 0.857142866, boost::test_tools::tolerance(0.00001));
5168 BOOST_TEST_CHECK(cColor.getGreen() == 1.000000000, boost::test_tools::tolerance(0.00001));
5169 BOOST_TEST_CHECK(cColor.getBlue() == 0.000000000, boost::test_tools::tolerance(0.00001));
5170 BOOST_TEST_CHECK(cColor.getAlpha() == cColor.minChanVal);
5171
5172 cColor.setToWhite();
5173 cColor.setRGBfromWavelengthLA(570);
5174 BOOST_TEST_CHECK(cColor.getRed() == 0.857142866, boost::test_tools::tolerance(0.00001));
5175 BOOST_TEST_CHECK(cColor.getGreen() == 1.000000000, boost::test_tools::tolerance(0.00001));
5176 BOOST_TEST_CHECK(cColor.getBlue() == 0.000000000, boost::test_tools::tolerance(0.00001));
5177 BOOST_TEST_CHECK(cColor.getAlpha() == cColor.maxChanVal);
5178
5179}
5180
5181#if !(MISSING_P1907R1)
5182////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
5183BOOST_AUTO_TEST_CASE(csCubeHelix_tpl, * boost::unit_test::tolerance(0.01)) {
5184
5185 BOOST_TEST_CHECK(mjr::color3c64F::csCHstd::c(0.25).getC0() == 0.085);
5186 BOOST_TEST_CHECK(mjr::color3c64F::csCHstd::c(0.25).getC1() == 0.325);
5187 BOOST_TEST_CHECK(mjr::color3c64F::csCHstd::c(0.25).getC2() == 0.298);
5188
5189 BOOST_TEST_CHECK(mjr::color3c64F::csCHstd::c(0.50).getC0() == 0.628);
5190 BOOST_TEST_CHECK(mjr::color3c64F::csCHstd::c(0.50).getC1() == 0.475);
5191 BOOST_TEST_CHECK(mjr::color3c64F::csCHstd::c(0.50).getC2() == 0.286);
5192
5193 BOOST_TEST_CHECK(mjr::color3c64F::csCHstd::c(0.75).getC0() == 0.780);
5194 BOOST_TEST_CHECK(mjr::color3c64F::csCHstd::c(0.75).getC1() == 0.702);
5195 BOOST_TEST_CHECK(mjr::color3c64F::csCHstd::c(0.75).getC2() == 0.929);
5196
5197
5198 BOOST_TEST_CHECK(mjr::color3c64F::csCHblu::c(0.25).getC0() == 0.280);
5199 BOOST_TEST_CHECK(mjr::color3c64F::csCHblu::c(0.25).getC1() == 0.202);
5200 BOOST_TEST_CHECK(mjr::color3c64F::csCHblu::c(0.25).getC2() == 0.429);
5201
5202 BOOST_TEST_CHECK(mjr::color3c64F::csCHblu::c(0.50).getC0() == 0.372);
5203 BOOST_TEST_CHECK(mjr::color3c64F::csCHblu::c(0.50).getC1() == 0.525);
5204 BOOST_TEST_CHECK(mjr::color3c64F::csCHblu::c(0.50).getC2() == 0.714);
5205
5206 BOOST_TEST_CHECK(mjr::color3c64F::csCHblu::c(0.75).getC0() == 0.585);
5207 BOOST_TEST_CHECK(mjr::color3c64F::csCHblu::c(0.75).getC1() == 0.825);
5208 BOOST_TEST_CHECK(mjr::color3c64F::csCHblu::c(0.75).getC2() == 0.798);
5209
5210
5211 BOOST_TEST_CHECK(mjr::color3c64F::csCHvio::c(0.25).getC0() == 0.388);
5212 BOOST_TEST_CHECK(mjr::color3c64F::csCHvio::c(0.25).getC1() == 0.163);
5213 BOOST_TEST_CHECK(mjr::color3c64F::csCHvio::c(0.25).getC2() == 0.342);
5214
5215 BOOST_TEST_CHECK(mjr::color3c64F::csCHvio::c(0.50).getC0() == 0.684);
5216 BOOST_TEST_CHECK(mjr::color3c64F::csCHvio::c(0.50).getC1() == 0.384);
5217 BOOST_TEST_CHECK(mjr::color3c64F::csCHvio::c(0.50).getC2() == 0.623);
5218
5219 BOOST_TEST_CHECK(mjr::color3c64F::csCHvio::c(0.75).getC0() == 0.888);
5220 BOOST_TEST_CHECK(mjr::color3c64F::csCHvio::c(0.75).getC1() == 0.663);
5221 BOOST_TEST_CHECK(mjr::color3c64F::csCHvio::c(0.75).getC2() == 0.842);
5222
5223 typedef mjr::colorTpl<double, 3, 2, 1, 0> permcolor3c64F;
5224
5225 BOOST_TEST_CHECK(permcolor3c64F::csCHstd::c(0.25).getC2() == 0.085);
5226 BOOST_TEST_CHECK(permcolor3c64F::csCHstd::c(0.25).getC1() == 0.325);
5227 BOOST_TEST_CHECK(permcolor3c64F::csCHstd::c(0.25).getC0() == 0.298);
5228
5229}
5230#endif
5231
5232////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
5233BOOST_AUTO_TEST_CASE(tfrm_misc) {
5234
5235 mjr::colorRGB8b aColor;
5236 mjr::colorRGB8b bColor;
5237 mjr::colorRGB8b dColor;
5238 mjr::colorRGB8b cColor;
5239
5240 aColor.setRGBfromLogPackIntARGB(0xFF00FF);
5241 bColor.setRGBfromLogPackIntARGB(0x00FFFF);
5242 dColor.setRGBfromLogPackIntARGB(0x0100FF);
5243
5244
5245 cColor.setToBlack();
5246 cColor.tfrmCopy(aColor);
5247 BOOST_TEST_CHECK(cColor.getC0() == 0xFF);
5248 BOOST_TEST_CHECK(cColor.getC1() == 0x00);
5249 BOOST_TEST_CHECK(cColor.getC2() == 0xFF);
5250
5251 cColor=aColor;
5252 cColor.tfrmMaxI(bColor); // Intensity equal, NOOP
5253 BOOST_TEST_CHECK(cColor.getC0() == 0xFF);
5254 BOOST_TEST_CHECK(cColor.getC1() == 0x00);
5255 BOOST_TEST_CHECK(cColor.getC2() == 0xFF);
5256
5257 cColor=aColor;
5258 cColor.tfrmMinI(bColor); // Intensity equal, NOOP
5259 BOOST_TEST_CHECK(cColor.getC0() == 0xFF);
5260 BOOST_TEST_CHECK(cColor.getC1() == 0x00);
5261 BOOST_TEST_CHECK(cColor.getC2() == 0xFF);
5262
5263 cColor=dColor;
5264 cColor.tfrmMaxI(aColor);
5265 BOOST_TEST_CHECK(cColor.getC0() == 0xFF);
5266 BOOST_TEST_CHECK(cColor.getC1() == 0x00);
5267 BOOST_TEST_CHECK(cColor.getC2() == 0xFF);
5268
5269 cColor=dColor;
5270 cColor.tfrmMaxI(aColor);
5271 BOOST_TEST_CHECK(cColor.getC0() == 0xFF);
5272 BOOST_TEST_CHECK(cColor.getC1() == 0x00);
5273 BOOST_TEST_CHECK(cColor.getC2() == 0xFF);
5274
5275 cColor=aColor;
5276 cColor.tfrmMax(bColor);
5277 BOOST_TEST_CHECK(cColor.getC0() == 0xFF);
5278 BOOST_TEST_CHECK(cColor.getC1() == 0xFF);
5279 BOOST_TEST_CHECK(cColor.getC2() == 0xFF);
5280
5281 cColor=aColor;
5282 cColor.tfrmMin(bColor);
5283 BOOST_TEST_CHECK(cColor.getC0() == 0x00);
5284 BOOST_TEST_CHECK(cColor.getC1() == 0x00);
5285 BOOST_TEST_CHECK(cColor.getC2() == 0xFF);
5286
5287 cColor=dColor;
5288 cColor.tfrmSaw(mjr::colorRGB8b().setRGBfromLogPackIntARGB(0x00000100), mjr::colorRGB8b().setRGBfromLogPackIntARGB(0x00FFFFFF));
5289 BOOST_TEST_CHECK(cColor.getC0() == 0x01);
5290 BOOST_TEST_CHECK(cColor.getC1() == 0x00);
5291 BOOST_TEST_CHECK(cColor.getC2() == 0xFF);
5292
5293 cColor=dColor;
5294 cColor.tfrmStep(mjr::colorRGB8b().setRGBfromLogPackIntARGB(0x00000100), mjr::colorRGB8b().setRGBfromLogPackIntARGB(0x00FFFFFF));
5295 BOOST_TEST_CHECK(cColor.getC0() == 0xFF);
5296 BOOST_TEST_CHECK(cColor.getC1() == 0x00);
5297 BOOST_TEST_CHECK(cColor.getC2() == 0xFF);
5298
5299 cColor=aColor;
5300 cColor.tfrmDirac(bColor);
5301 BOOST_TEST_CHECK(cColor.getC0() == 0x00);
5302 BOOST_TEST_CHECK(cColor.getC1() == 0x00);
5303 BOOST_TEST_CHECK(cColor.getC2() == 0xFF);
5304
5305 cColor=aColor;
5306 cColor.tfrmDiracTot(bColor);
5307 BOOST_TEST_CHECK(cColor.getC0() == 0x00);
5308 BOOST_TEST_CHECK(cColor.getC1() == 0x00);
5309 BOOST_TEST_CHECK(cColor.getC2() == 0x00);
5310
5311 cColor=aColor;
5312 cColor.tfrmDiracTot(aColor);
5313 BOOST_TEST_CHECK(cColor.getC0() == 0xFF);
5314 BOOST_TEST_CHECK(cColor.getC1() == 0xFF);
5315 BOOST_TEST_CHECK(cColor.getC2() == 0xFF);
5316
5317 cColor=aColor;
5318 cColor.tfrmFuzzyDirac(mjr::colorRGB8b().setRGBfromLogPackIntARGB(0x00FE01F0), mjr::colorRGB8b().setRGBfromLogPackIntARGB(0x00010101));
5319 BOOST_TEST_CHECK(cColor.getC0() == 0xFF);
5320 BOOST_TEST_CHECK(cColor.getC1() == 0xFF);
5321 BOOST_TEST_CHECK(cColor.getC2() == 0x00);
5322
5323 cColor=aColor;
5324 cColor.tfrmMean(bColor);
5325 BOOST_TEST_CHECK(cColor.getC0() == 0x7f);
5326 BOOST_TEST_CHECK(cColor.getC1() == 0x7f);
5327 BOOST_TEST_CHECK(cColor.getC2() == 0xFF);
5328
5329 cColor=dColor;
5330 cColor.tfrmGmean(mjr::colorRGB8b().setRGBfromLogPackIntARGB(0x00030102));
5331 BOOST_TEST_CHECK(cColor.getC0() == 0x01);
5332 BOOST_TEST_CHECK(cColor.getC1() == 0x00);
5333 BOOST_TEST_CHECK(cColor.getC2() == 0x16);
5334
5335 cColor=aColor;
5336 cColor.tfrmGreyScaleRGB();
5337 BOOST_TEST_CHECK(cColor.getC0() == 0x48);
5338 BOOST_TEST_CHECK(cColor.getC1() == 0x48);
5339 BOOST_TEST_CHECK(cColor.getC2() == 0x48);
5340
5341 cColor=bColor;
5342 cColor.tfrmGreyScaleRGB();
5343 BOOST_TEST_CHECK(cColor.getC0() == 0xC8);
5344 BOOST_TEST_CHECK(cColor.getC1() == 0xC8);
5345 BOOST_TEST_CHECK(cColor.getC2() == 0xC8);
5346
5347}
5348
5349////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
5350BOOST_AUTO_TEST_CASE(tfrm_misc_FLT, * boost::unit_test::tolerance(0.00001)) {
5351
5352 mjr::colorRGB32F aColor;
5353 mjr::colorRGB32F bColor;
5354 mjr::colorRGB32F dColor;
5355 mjr::colorRGB32F cColor;
5356
5357 aColor.setChansRGB(2.0, 0.0, 2.0);
5358 bColor.setChansRGB(0.0, 2.0, 2.0);
5359 dColor.setChansRGB(0.0, 1.0, 2.0);
5360
5361 cColor.setToBlack();
5362 cColor.tfrmCopy(aColor);
5363 BOOST_TEST_CHECK(cColor.getC0() == 2.0);
5364 BOOST_TEST_CHECK(cColor.getC1() == 0.0);
5365 BOOST_TEST_CHECK(cColor.getC2() == 2.0);
5366
5367 cColor=aColor;
5368 cColor.tfrmMaxI(bColor); // Intensity equal, NOOP
5369 BOOST_TEST_CHECK(cColor.getC0() == 2.0);
5370 BOOST_TEST_CHECK(cColor.getC1() == 0.0);
5371 BOOST_TEST_CHECK(cColor.getC2() == 2.0);
5372
5373 cColor=aColor;
5374 cColor.tfrmMinI(bColor); // Intensity equal, NOOP
5375 BOOST_TEST_CHECK(cColor.getC0() == 2.0);
5376 BOOST_TEST_CHECK(cColor.getC1() == 0.0);
5377 BOOST_TEST_CHECK(cColor.getC2() == 2.0);
5378
5379 cColor=dColor;
5380 cColor.tfrmMaxI(aColor);
5381 BOOST_TEST_CHECK(cColor.getC0() == 2.0);
5382 BOOST_TEST_CHECK(cColor.getC1() == 0.0);
5383 BOOST_TEST_CHECK(cColor.getC2() == 2.0);
5384
5385 cColor=dColor;
5386 cColor.tfrmMaxI(aColor);
5387 BOOST_TEST_CHECK(cColor.getC0() == 2.0);
5388 BOOST_TEST_CHECK(cColor.getC1() == 0.0);
5389 BOOST_TEST_CHECK(cColor.getC2() == 2.0);
5390
5391 cColor=aColor;
5392 cColor.tfrmMax(bColor);
5393 BOOST_TEST_CHECK(cColor.getC0() == 2.0);
5394 BOOST_TEST_CHECK(cColor.getC1() == 2.0);
5395 BOOST_TEST_CHECK(cColor.getC2() == 2.0);
5396
5397 cColor=aColor;
5398 cColor.tfrmMin(bColor);
5399 BOOST_TEST_CHECK(cColor.getC0() == 0.0);
5400 BOOST_TEST_CHECK(cColor.getC1() == 0.0);
5401 BOOST_TEST_CHECK(cColor.getC2() == 2.0);
5402
5403 // cColor=dColor;
5404 // cColor.tfrmSaw(mjr::colorRGB32F().setRGBfromLogPackIntARGB(0.0000100), mjr::colorRGB32F().setRGBfromLogPackIntARGB(0.0FFFFFF));
5405 // BOOST_TEST_CHECK(cColor.getC0() == 0x01);
5406 // BOOST_TEST_CHECK(cColor.getC1() == 0.0);
5407 // BOOST_TEST_CHECK(cColor.getC2() == 2.0);
5408
5409 // cColor=dColor;
5410 // cColor.tfrmStep(mjr::colorRGB32F().setRGBfromLogPackIntARGB(0.0000100), mjr::colorRGB32F().setRGBfromLogPackIntARGB(0.0FFFFFF));
5411 // BOOST_TEST_CHECK(cColor.getC0() == 2.0);
5412 // BOOST_TEST_CHECK(cColor.getC1() == 0.0);
5413 // BOOST_TEST_CHECK(cColor.getC2() == 2.0);
5414
5415 cColor=aColor;
5416 cColor.tfrmDirac(bColor);
5417 BOOST_TEST_CHECK(cColor.getC0() == 0.0);
5418 BOOST_TEST_CHECK(cColor.getC1() == 0.0);
5419 BOOST_TEST_CHECK(cColor.getC2() == 1.0);
5420
5421 cColor=aColor;
5422 cColor.tfrmDiracTot(bColor);
5423 BOOST_TEST_CHECK(cColor.getC0() == 0.0);
5424 BOOST_TEST_CHECK(cColor.getC1() == 0.0);
5425 BOOST_TEST_CHECK(cColor.getC2() == 0.0);
5426
5427 cColor=aColor;
5428 cColor.tfrmDiracTot(aColor);
5429 BOOST_TEST_CHECK(cColor.getC0() == 1.0);
5430 BOOST_TEST_CHECK(cColor.getC1() == 1.0);
5431 BOOST_TEST_CHECK(cColor.getC2() == 1.0);
5432
5433 // cColor=aColor;
5434 // cColor.tfrmFuzzyDirac(mjr::colorRGB32F().setRGBfromLogPackIntARGB(0.0FE01F0), mjr::colorRGB32F().setRGBfromLogPackIntARGB(0.0010101));
5435 // BOOST_TEST_CHECK(cColor.getC0() == 2.0);
5436 // BOOST_TEST_CHECK(cColor.getC1() == 2.0);
5437 // BOOST_TEST_CHECK(cColor.getC2() == 0.0);
5438
5439 cColor=aColor;
5440 cColor.tfrmMean(bColor);
5441 BOOST_TEST_CHECK(cColor.getC0() == 1.0);
5442 BOOST_TEST_CHECK(cColor.getC1() == 1.0);
5443 BOOST_TEST_CHECK(cColor.getC2() == 2.0);
5444
5445 cColor=dColor;
5446 cColor.tfrmGmean(mjr::colorRGB32F().setChansRGB(8.0, 25.0, 2.0));
5447 BOOST_TEST_CHECK(cColor.getC0() == 0.0);
5448 BOOST_TEST_CHECK(cColor.getC1() == 5.0);
5449 BOOST_TEST_CHECK(cColor.getC2() == 2.0);
5450
5451 cColor=aColor;
5452 cColor.tfrmGreyScaleRGB();
5453 BOOST_TEST_CHECK(cColor.getC0() == 0.569599986);
5454 BOOST_TEST_CHECK(cColor.getC1() == 0.569599986);
5455 BOOST_TEST_CHECK(cColor.getC2() == 0.569599986);
5456
5457 cColor=bColor;
5458 cColor.tfrmGreyScaleRGB();
5459 BOOST_TEST_CHECK(cColor.getC0() == 1.57480001);
5460 BOOST_TEST_CHECK(cColor.getC1() == 1.57480001);
5461 BOOST_TEST_CHECK(cColor.getC2() == 1.57480001);
5462
5463}
5464
5465////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
5466BOOST_AUTO_TEST_CASE(tfrm_websafe) {
5467
5468 mjr::colorRGB8b aColor;
5469 mjr::colorRGB8b bColor;
5470 mjr::colorRGB32F cColor;
5471 mjr::colorRGBA8b dColor;
5472
5473 aColor.setChansRGB(0x00, 0x33, 0x66);
5474 bColor.setChansRGB(0x00, 0x33, 0x66);
5475 aColor.tfrmWebSafeRGB();
5476 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
5477 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
5478 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
5479
5480 aColor.setChansRGB(0x99, 0xCC, 0xFF);
5481 bColor.setChansRGB(0x99, 0xCC, 0xFF);
5482 aColor.tfrmWebSafeRGB();
5483 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
5484 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
5485 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
5486
5487 aColor.setChansRGB(0x01, 0x34, 0x67);
5488 bColor.setChansRGB(0x00, 0x33, 0x66);
5489 aColor.tfrmWebSafeRGB();
5490 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
5491 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
5492 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
5493
5494 aColor.setChansRGB(0x98, 0xCB, 0xFE);
5495 bColor.setChansRGB(0x99, 0xCC, 0xFF);
5496 aColor.tfrmWebSafeRGB();
5497 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
5498 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
5499 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
5500
5501 cColor.setChansRGB(0.05F, 0.15F, 0.35F);
5502 cColor.tfrmWebSafeRGB();
5503 BOOST_TEST_CHECK(cColor.getRed() == 0.0, boost::test_tools::tolerance(0.0001));
5504 BOOST_TEST_CHECK(cColor.getGreen() == 0.2, boost::test_tools::tolerance(0.0001));
5505 BOOST_TEST_CHECK(cColor.getBlue() == 0.4, boost::test_tools::tolerance(0.0001));
5506
5507 cColor.setChansRGB(0.55F, 0.75F, 0.95F);
5508 cColor.tfrmWebSafeRGB();
5509 BOOST_TEST_CHECK(cColor.getRed() == 0.6, boost::test_tools::tolerance(0.0001));
5510 BOOST_TEST_CHECK(cColor.getGreen() == 0.8, boost::test_tools::tolerance(0.0001));
5511 BOOST_TEST_CHECK(cColor.getBlue() == 1.0, boost::test_tools::tolerance(0.0001));
5512
5513 dColor.setChans(0xCB);
5514 dColor.tfrmWebSafeRGB();
5515 BOOST_TEST_CHECK(dColor.getRed() == 0xCC);
5516 BOOST_TEST_CHECK(dColor.getGreen() == 0xCC);
5517 BOOST_TEST_CHECK(dColor.getBlue() == 0xCC);
5518 BOOST_TEST_CHECK(dColor.getAlpha() == 0xCB);
5519}
5520
5521////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
5522BOOST_AUTO_TEST_CASE(tfrm_PowPow_int) {
5523
5524 mjr::colorRGB8b aColor;
5525 mjr::colorRGBA8b bColor;
5526
5527 aColor.setChansRGB(0, 50, 100);
5528 aColor.tfrmLn1();
5529 BOOST_TEST_CHECK(aColor.getRed() == 0);
5530 BOOST_TEST_CHECK(aColor.getGreen() == 3);
5531 BOOST_TEST_CHECK(aColor.getBlue() == 4);
5532
5533 aColor.setChansRGB(0, 50, 100);
5534 aColor.tfrmStdPowSqr();
5535 BOOST_TEST_CHECK(aColor.getRed() == 0);
5536 BOOST_TEST_CHECK(aColor.getGreen() == 9);
5537 BOOST_TEST_CHECK(aColor.getBlue() == 39);
5538
5539 aColor.setChansRGB(0, 50, 100);
5540 aColor.tfrmStdPowSqrt();
5541 BOOST_TEST_CHECK(aColor.getRed() == 0);
5542 BOOST_TEST_CHECK(aColor.getGreen() == 112);
5543 BOOST_TEST_CHECK(aColor.getBlue() == 159);
5544
5545 aColor.setChansRGB(0, 50, 100);
5546 aColor.tfrmStdPow(2.0);
5547 BOOST_TEST_CHECK(aColor.getRed() == 0);
5548 BOOST_TEST_CHECK(aColor.getGreen() == 9);
5549 BOOST_TEST_CHECK(aColor.getBlue() == 39);
5550
5551 aColor.setChansRGB(0, 50, 100);
5552 aColor.tfrmStdPow(0.5);
5553 BOOST_TEST_CHECK(aColor.getRed() == 0);
5554 BOOST_TEST_CHECK(aColor.getGreen() == 112);
5555 BOOST_TEST_CHECK(aColor.getBlue() == 159);
5556
5557 aColor.setChansRGB(0, 50, 100);
5558 aColor.tfrmStdPowRGB(1, 2.0, 0.5);
5559 BOOST_TEST_CHECK(aColor.getRed() == 0);
5560 BOOST_TEST_CHECK(aColor.getGreen() == 9);
5561 BOOST_TEST_CHECK(aColor.getBlue() == 159);
5562
5563 bColor.setToWhite();
5564 bColor.setChansRGB(0, 50, 100);
5565 bColor.tfrmStdPowRGB(1, 2.0, 0.5);
5566 BOOST_TEST_CHECK(bColor.getRed() == 0);
5567 BOOST_TEST_CHECK(bColor.getGreen() == 9);
5568 BOOST_TEST_CHECK(bColor.getBlue() == 159);
5569 BOOST_TEST_CHECK(bColor.getAlpha() == 0xff);
5570
5571 bColor.setToBlack();
5572 bColor.setChansRGB(0, 50, 100);
5573 bColor.tfrmStdPowRGB(1, 2.0, 0.5);
5574 BOOST_TEST_CHECK(bColor.getRed() == 0);
5575 BOOST_TEST_CHECK(bColor.getGreen() == 9);
5576 BOOST_TEST_CHECK(bColor.getBlue() == 159);
5577 BOOST_TEST_CHECK(bColor.getAlpha() == 0x00);
5578}
5579
5580////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
5581BOOST_AUTO_TEST_CASE(tfrm_PowPow_flt, * boost::unit_test::tolerance(0.00001)) {
5582
5583 mjr::colorRGB32F aColor;
5584
5585 aColor.setChansRGB(0, 50, 100);
5586 aColor.tfrmLn1();
5587 BOOST_TEST_CHECK(aColor.getRed() == 0);
5588 BOOST_TEST_CHECK(aColor.getGreen() == 3.93182563272);
5589 BOOST_TEST_CHECK(aColor.getBlue() == 4.61512051684);
5590
5591 aColor.setChansRGB(0, 50, 100);
5592 aColor.tfrmStdPowSqr();
5593 BOOST_TEST_CHECK(aColor.getRed() == 0);
5594 BOOST_TEST_CHECK(aColor.getGreen() == 2500);
5595 BOOST_TEST_CHECK(aColor.getBlue() == 10000);
5596
5597 aColor.setChansRGB(0, 50, 100);
5598 aColor.tfrmStdPowSqrt();
5599 BOOST_TEST_CHECK(aColor.getRed() == 0);
5600 BOOST_TEST_CHECK(aColor.getGreen() == 7.07106781);
5601 BOOST_TEST_CHECK(aColor.getBlue() == 10);
5602
5603 aColor.setChansRGB(0, 50, 100);
5604 aColor.tfrmStdPow(2.0);
5605 BOOST_TEST_CHECK(aColor.getRed() == 0);
5606 BOOST_TEST_CHECK(aColor.getGreen() == 2500);
5607 BOOST_TEST_CHECK(aColor.getBlue() == 10000);
5608
5609 aColor.setChansRGB(0, 50, 100);
5610 aColor.tfrmStdPow(0.5);
5611 BOOST_TEST_CHECK(aColor.getRed() == 0);
5612 BOOST_TEST_CHECK(aColor.getGreen() == 7.07106781);
5613 BOOST_TEST_CHECK(aColor.getBlue() == 10);
5614
5615 aColor.setChansRGB(0, 50, 100);
5616 aColor.tfrmStdPowRGB(1, 2.0, 0.5);
5617 BOOST_TEST_CHECK(aColor.getRed() == 0);
5618 BOOST_TEST_CHECK(aColor.getGreen() == 2500);
5619 BOOST_TEST_CHECK(aColor.getBlue() == 10);
5620}
5621
5622////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
5623BOOST_AUTO_TEST_CASE(tfrm_GryLevScl_int) {
5624
5625 mjr::colorRGB8b aColor;
5626 mjr::colorRGBA8b cColor;
5627
5628 aColor.setChansRGB(10, 20, 25);
5629 aColor.tfrmLinearGreyLevelScale(2, 4);
5630 BOOST_TEST_CHECK(aColor.getRed() == 24);
5631 BOOST_TEST_CHECK(aColor.getGreen() == 44);
5632 BOOST_TEST_CHECK(aColor.getBlue() == 54);
5633
5634 aColor.setChansRGB(10, 20, 25);
5635 aColor.tfrmLinearGreyLevelScale(2.5, 4);
5636 BOOST_TEST_CHECK(aColor.getRed() == 29);
5637 BOOST_TEST_CHECK(aColor.getGreen() == 54);
5638 BOOST_TEST_CHECK(aColor.getBlue() == 66);
5639
5640 aColor.setChansRGB(10, 20, 25);
5641 aColor.tfrmLinearGreyLevelScaleRGB(2, 4, 2.5, 4, 3, 2);
5642 BOOST_TEST_CHECK(aColor.getRed() == 24);
5643 BOOST_TEST_CHECK(aColor.getGreen() == 54);
5644 BOOST_TEST_CHECK(aColor.getBlue() == 77);
5645
5646 cColor.setToWhite();
5647 cColor.setChansRGB(10, 20, 25);
5648 cColor.tfrmLinearGreyLevelScaleRGB(2, 4, 2.5, 4, 3, 2);
5649 BOOST_TEST_CHECK(cColor.getRed() == 24);
5650 BOOST_TEST_CHECK(cColor.getGreen() == 54);
5651 BOOST_TEST_CHECK(cColor.getBlue() == 77);
5652 BOOST_TEST_CHECK(cColor.getAlpha() == 0xff);
5653
5654 cColor.setToBlack();
5655 cColor.setChansRGB(10, 20, 25);
5656 cColor.tfrmLinearGreyLevelScaleRGB(2, 4, 2.5, 4, 3, 2);
5657 BOOST_TEST_CHECK(cColor.getRed() == 24);
5658 BOOST_TEST_CHECK(cColor.getGreen() == 54);
5659 BOOST_TEST_CHECK(cColor.getBlue() == 77);
5660 BOOST_TEST_CHECK(cColor.getAlpha() == 0x00);
5661}
5662
5663////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
5664BOOST_AUTO_TEST_CASE(tfrm_GryLevSclflt, * boost::unit_test::tolerance(0.00001)) {
5665
5666 mjr::colorRGB32F aColor;
5667 mjr::colorRGBA32F cColor;
5668
5669 aColor.setChansRGB(10, 20, 25);
5670 aColor.tfrmLinearGreyLevelScale(2, 4);
5671 BOOST_TEST_CHECK(aColor.getRed() == 24.0);
5672 BOOST_TEST_CHECK(aColor.getGreen() == 44.0);
5673 BOOST_TEST_CHECK(aColor.getBlue() == 54.0);
5674
5675 aColor.setChansRGB(10, 20, 25);
5676 aColor.tfrmLinearGreyLevelScale(2.5, 4);
5677 BOOST_TEST_CHECK(aColor.getRed() == 29.0);
5678 BOOST_TEST_CHECK(aColor.getGreen() == 54.0);
5679 BOOST_TEST_CHECK(aColor.getBlue() == 66.5);
5680
5681 aColor.setChansRGB(10, 20, 25);
5682 aColor.tfrmLinearGreyLevelScaleRGB(2, 4, 2.5, 4, 3, 2);
5683 BOOST_TEST_CHECK(aColor.getRed() == 24.0);
5684 BOOST_TEST_CHECK(aColor.getGreen() == 54.0);
5685 BOOST_TEST_CHECK(aColor.getBlue() == 77.0);
5686
5687 cColor.setToWhite();
5688 cColor.setChansRGB(10, 20, 25);
5689 cColor.tfrmLinearGreyLevelScaleRGB(2, 4, 2.5, 4, 3, 2);
5690 BOOST_TEST_CHECK(cColor.getRed() == 24.0);
5691 BOOST_TEST_CHECK(cColor.getGreen() == 54.0);
5692 BOOST_TEST_CHECK(cColor.getBlue() == 77.0);
5693 BOOST_TEST_CHECK(cColor.getAlpha() == 1.0);
5694
5695 cColor.setToBlack();
5696 cColor.setChansRGB(10, 20, 25);
5697 cColor.tfrmLinearGreyLevelScaleRGB(2, 4, 2.5, 4, 3, 2);
5698 BOOST_TEST_CHECK(cColor.getRed() == 24.0);
5699 BOOST_TEST_CHECK(cColor.getGreen() == 54.0);
5700 BOOST_TEST_CHECK(cColor.getBlue() == 77.0);
5701 BOOST_TEST_CHECK(cColor.getAlpha() == 0.0);
5702}
5703
5704////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
5705BOOST_AUTO_TEST_CASE(wmean, * boost::unit_test::tolerance(0.01)) {
5706
5707 mjr::colorRGBA8b a1Color(10, 20, 30, 40);
5708 mjr::colorRGBA8b a2Color(10, 30, 20, 40);
5709 mjr::colorRGBA8b a3Color(40, 20, 30, 10);
5710 mjr::colorRGBA8b a4Color(90, 70, 10, 20);
5711
5712 mjr::colorRGBA8b aColor;
5713 mjr::colorRGBA8b cColor;
5714
5715 mjr::colorRGBA32F b1Color(10, 20, 30, 40);
5716 mjr::colorRGBA32F b2Color(10, 30, 20, 40);
5717 mjr::colorRGBA32F b3Color(40, 20, 30, 10);
5718 mjr::colorRGBA32F b4Color(90, 70, 10, 20);
5719
5720 mjr::colorRGBA32F bColor;
5721
5722 ////////////////////////////////////////////////////////////////////////////////
5723
5724 aColor.wMean(1.0F, 1.0F, a1Color, a2Color);
5725 BOOST_TEST_CHECK(aColor.getC0() == 20);
5726 BOOST_TEST_CHECK(aColor.getC1() == 50);
5727 BOOST_TEST_CHECK(aColor.getC2() == 50);
5728 BOOST_TEST_CHECK(aColor.getC3() == 80);
5729
5730 aColor.wMean(1.0F, 1.0F, 1.0F, a1Color, a2Color, a3Color);
5731 BOOST_TEST_CHECK(aColor.getC0() == 60);
5732 BOOST_TEST_CHECK(aColor.getC1() == 70);
5733 BOOST_TEST_CHECK(aColor.getC2() == 80);
5734 BOOST_TEST_CHECK(aColor.getC3() == 90);
5735
5736 aColor.wMean(1.0F, 1.0F, 1.0F, 1.0F, a1Color, a2Color, a3Color, a4Color);
5737 BOOST_TEST_CHECK(aColor.getC0() == 150);
5738 BOOST_TEST_CHECK(aColor.getC1() == 140);
5739 BOOST_TEST_CHECK(aColor.getC2() == 90);
5740 BOOST_TEST_CHECK(aColor.getC3() == 110);
5741
5742 aColor.wMean(0.1F, 1.0F, a1Color, a2Color);
5743 BOOST_TEST_CHECK(aColor.getC0() == 11);
5744 BOOST_TEST_CHECK(aColor.getC1() == 32);
5745 BOOST_TEST_CHECK(aColor.getC2() == 23);
5746 BOOST_TEST_CHECK(aColor.getC3() == 44);
5747
5748 aColor.wMean(0.1F, 1.0F, 1.0F, a1Color, a2Color, a3Color);
5749 BOOST_TEST_CHECK(aColor.getC0() == 51);
5750 BOOST_TEST_CHECK(aColor.getC1() == 52);
5751 BOOST_TEST_CHECK(aColor.getC2() == 53);
5752 BOOST_TEST_CHECK(aColor.getC3() == 54);
5753
5754 aColor.wMean(0.1F, 1.0F, 1.0F, 1.0F, a1Color, a2Color, a3Color, a4Color);
5755 BOOST_TEST_CHECK(aColor.getC0() == 141);
5756 BOOST_TEST_CHECK(aColor.getC1() == 122);
5757 BOOST_TEST_CHECK(aColor.getC2() == 63);
5758 BOOST_TEST_CHECK(aColor.getC3() == 74);
5759
5760 ////////////////////////////////////////////////////////////////////////////////
5761
5762 bColor.wMean(1.0F, 1.0F, b1Color, b2Color);
5763 BOOST_TEST_CHECK(bColor.getC0() == 20);
5764 BOOST_TEST_CHECK(bColor.getC1() == 50);
5765 BOOST_TEST_CHECK(bColor.getC2() == 50);
5766 BOOST_TEST_CHECK(bColor.getC3() == 80);
5767
5768 bColor.wMean(1.0F, 1.0F, 1.0F, b1Color, b2Color, b3Color);
5769 BOOST_TEST_CHECK(bColor.getC0() == 60);
5770 BOOST_TEST_CHECK(bColor.getC1() == 70);
5771 BOOST_TEST_CHECK(bColor.getC2() == 80);
5772 BOOST_TEST_CHECK(bColor.getC3() == 90);
5773
5774 bColor.wMean(1.0F, 1.0F, 1.0F, 1.0F, b1Color, b2Color, b3Color, b4Color);
5775 BOOST_TEST_CHECK(bColor.getC0() == 150);
5776 BOOST_TEST_CHECK(bColor.getC1() == 140);
5777 BOOST_TEST_CHECK(bColor.getC2() == 90);
5778 BOOST_TEST_CHECK(bColor.getC3() == 110);
5779
5780 bColor.wMean(0.1F, 1.0F, b1Color, b2Color);
5781 BOOST_TEST_CHECK(bColor.getC0() == 11);
5782 BOOST_TEST_CHECK(bColor.getC1() == 32);
5783 BOOST_TEST_CHECK(bColor.getC2() == 23);
5784 BOOST_TEST_CHECK(bColor.getC3() == 44);
5785
5786 bColor.wMean(0.1F, 1.0F, 1.0F, b1Color, b2Color, b3Color);
5787 BOOST_TEST_CHECK(bColor.getC0() == 51);
5788 BOOST_TEST_CHECK(bColor.getC1() == 52);
5789 BOOST_TEST_CHECK(bColor.getC2() == 53);
5790 BOOST_TEST_CHECK(bColor.getC3() == 54);
5791
5792 bColor.wMean(0.1F, 1.0F, 1.0F, 1.0F, b1Color, b2Color, b3Color, b4Color);
5793 BOOST_TEST_CHECK(bColor.getC0() == 141);
5794 BOOST_TEST_CHECK(bColor.getC1() == 122);
5795 BOOST_TEST_CHECK(bColor.getC2() == 63);
5796 BOOST_TEST_CHECK(bColor.getC3() == 74);
5797
5798
5799 ////////////////////////////////////////////////////////////////////////////////
5800
5801 aColor.linearInterpolate(0.0, a1Color, a2Color);
5802 BOOST_TEST_CHECK(aColor.getC0() == a1Color.getC0());
5803 BOOST_TEST_CHECK(aColor.getC1() == a1Color.getC1());
5804 BOOST_TEST_CHECK(aColor.getC2() == a1Color.getC2());
5805 BOOST_TEST_CHECK(aColor.getC3() == a1Color.getC3());
5806
5807 aColor.linearInterpolate(1.0, a1Color, a2Color);
5808 BOOST_TEST_CHECK(aColor.getC0() == a2Color.getC0());
5809 BOOST_TEST_CHECK(aColor.getC1() == a2Color.getC1());
5810 BOOST_TEST_CHECK(aColor.getC2() == a2Color.getC2());
5811 BOOST_TEST_CHECK(aColor.getC3() == a2Color.getC3());
5812
5813 aColor.linearInterpolate(0.5, a1Color, a2Color);
5814 cColor.uMean(0.5F, a1Color, a2Color);
5815 BOOST_TEST_CHECK(aColor.getC0() == cColor.getC0());
5816 BOOST_TEST_CHECK(aColor.getC1() == cColor.getC1());
5817 BOOST_TEST_CHECK(aColor.getC2() == cColor.getC2());
5818 BOOST_TEST_CHECK(aColor.getC3() == cColor.getC3());
5819
5820 aColor.linearInterpolate(0.25, a1Color, a2Color);
5821 cColor.uMean(0.75F, a1Color, a2Color);
5822 BOOST_TEST_CHECK(aColor.getC0() == cColor.getC0());
5823 BOOST_TEST_CHECK(aColor.getC1() == cColor.getC1());
5824 BOOST_TEST_CHECK(aColor.getC2() == cColor.getC2());
5825 BOOST_TEST_CHECK(aColor.getC3() == cColor.getC3());
5826
5827 aColor.linearInterpolate(0.75, a1Color, a2Color);
5828 cColor.uMean(0.25F, a1Color, a2Color);
5829 BOOST_TEST_CHECK(aColor.getC0() == cColor.getC0());
5830 BOOST_TEST_CHECK(aColor.getC1() == cColor.getC1());
5831 BOOST_TEST_CHECK(aColor.getC2() == cColor.getC2());
5832 BOOST_TEST_CHECK(aColor.getC3() == cColor.getC3());
5833
5834 ////////////////////////////////////////////////////////////////////////////////
5835 aColor.uMean(0.2F, a1Color, a2Color);
5836 BOOST_TEST_CHECK(aColor.getC0() == .2*10+.8*10);
5837 BOOST_TEST_CHECK(aColor.getC1() == .2*20+.8*30);
5838 BOOST_TEST_CHECK(aColor.getC2() == .2*30+.8*20);
5839 BOOST_TEST_CHECK(aColor.getC3() == .2*40+.8*40);
5840
5841 aColor.uMean(0.1F, 0.3F, a1Color, a2Color, a3Color);
5842 BOOST_TEST_CHECK(aColor.getC0() == .1*10+.3*10+0.6*40);
5843 BOOST_TEST_CHECK(aColor.getC1() == .1*20+.3*30+0.6*20);
5844 BOOST_TEST_CHECK(aColor.getC2() == .1*30+.3*20+0.6*30);
5845 BOOST_TEST_CHECK(aColor.getC3() == .1*40+.3*40+0.6*10);
5846
5847 aColor.uMean(0.1F, 0.3F, 0.4F, a1Color, a2Color, a3Color, a4Color);
5848 BOOST_TEST_CHECK(aColor.getC0() == .1*10+.3*10+0.4*40+0.2*90);
5849 BOOST_TEST_CHECK(aColor.getC1() == .1*20+.3*30+0.4*20+0.2*70);
5850 BOOST_TEST_CHECK(aColor.getC2() == .1*30+.3*20+0.4*30+0.2*10);
5851 BOOST_TEST_CHECK(aColor.getC3() == .1*40+.3*40+0.4*10+0.2*20);
5852
5853 ////////////////////////////////////////////////////////////////////////////////
5854
5855 bColor.uMean(0.2F, b1Color, b2Color);
5856 BOOST_TEST_CHECK(bColor.getC0() == .2*10+.8*10);
5857 BOOST_TEST_CHECK(bColor.getC1() == .2*20+.8*30);
5858 BOOST_TEST_CHECK(bColor.getC2() == .2*30+.8*20);
5859 BOOST_TEST_CHECK(bColor.getC3() == .2*40+.8*40);
5860
5861 bColor.uMean(0.1F, 0.3F, b1Color, b2Color, b3Color);
5862 BOOST_TEST_CHECK(bColor.getC0() == .1*10+.3*10+0.6*40);
5863 BOOST_TEST_CHECK(bColor.getC1() == .1*20+.3*30+0.6*20);
5864 BOOST_TEST_CHECK(bColor.getC2() == .1*30+.3*20+0.6*30);
5865 BOOST_TEST_CHECK(bColor.getC3() == .1*40+.3*40+0.6*10);
5866
5867 bColor.uMean(0.1F, 0.3F, 0.4F, b1Color, b2Color, b3Color, b4Color);
5868 BOOST_TEST_CHECK(bColor.getC0() == .1*10+.3*10+0.4*40+0.2*90);
5869 BOOST_TEST_CHECK(bColor.getC1() == .1*20+.3*30+0.4*20+0.2*70);
5870 BOOST_TEST_CHECK(bColor.getC2() == .1*30+.3*20+0.4*30+0.2*10);
5871 BOOST_TEST_CHECK(bColor.getC3() == .1*40+.3*40+0.4*10+0.2*20);
5872}
5873
5874////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
5875BOOST_AUTO_TEST_CASE(hsl_hsv_int) {
5876
5877 mjr::colorRGB8b aColor;
5878 mjr::colorRGB8b bColor;
5879
5880 aColor.setRGBfromUnitHSL( 0/360.0, 1, 0.5);
5881 bColor.setToRed();
5882 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
5883 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
5884 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
5885
5886 aColor.setRGBfromUnitHSL( 60/360.0, 1, 0.5);
5887 bColor.setToYellow();
5888 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
5889 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
5890 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
5891
5892 aColor.setRGBfromUnitHSL(120/360.0, 1, 0.5);
5893 bColor.setToGreen();
5894 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
5895 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
5896 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
5897
5898 aColor.setRGBfromUnitHSL(180/360.0, 1, 0.5);
5899 bColor.setToCyan();
5900 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
5901 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
5902 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
5903
5904 aColor.setRGBfromUnitHSL(240/360.0, 1, 0.5);
5905 bColor.setToBlue();
5906 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
5907 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
5908 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
5909
5910 aColor.setRGBfromUnitHSL(300/360.0, 1, 0.5);
5911 bColor.setToMagenta();
5912 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
5913 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
5914 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
5915
5916////////////////////////////////////////////////////////////////////////////////
5917
5918 aColor.setRGBfromUnitHSV( 0/360.0, 1, 1.0);
5919 bColor.setToRed();
5920 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
5921 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
5922 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
5923
5924 aColor.setRGBfromUnitHSV( 60/360.0, 1, 1.0);
5925 bColor.setToYellow();
5926 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
5927 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
5928 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
5929
5930 aColor.setRGBfromUnitHSV( 420/360.0, 1, 1.0);
5931 bColor.setToYellow();
5932 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
5933 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
5934 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
5935
5936 aColor.setRGBfromUnitHSV(120/360.0, 1, 1.0);
5937 bColor.setToGreen();
5938 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
5939 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
5940 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
5941
5942 aColor.setRGBfromUnitHSV(180/360.0, 1, 1.0);
5943 bColor.setToCyan();
5944 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
5945 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
5946 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
5947
5948 aColor.setRGBfromUnitHSV(240/360.0, 1, 1.0);
5949 bColor.setToBlue();
5950 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
5951 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
5952 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
5953
5954 aColor.setRGBfromUnitHSV(300/360.0, 1, 1.0);
5955 bColor.setToMagenta();
5956 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
5957 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
5958 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
5959
5960////////////////////////////////////////////////////////////////////////////////
5961
5962 aColor.setRGBfromUnitHSL( 0/360.0, 1, 0);
5963 bColor.setToBlack();
5964 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
5965 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
5966 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
5967
5968 aColor.setRGBfromUnitHSL(180/360.0, 1, 0);
5969 bColor.setToBlack();
5970 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
5971 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
5972 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
5973
5974 aColor.setRGBfromUnitHSL( 0/360.0, 1, 1);
5975 bColor.setToWhite();
5976 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
5977 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
5978 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
5979
5980 aColor.setRGBfromUnitHSL(180/360.0, 1, 1);
5981 bColor.setToWhite();
5982 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
5983 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
5984 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
5985
5986////////////////////////////////////////////////////////////////////////////////
5987
5988 aColor.setRGBfromUnitHSV( 0/360.0, 0, 1);
5989 bColor.setToWhite();
5990 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
5991 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
5992 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
5993
5994 aColor.setRGBfromUnitHSV(180/360.0, 0, 1);
5995 bColor.setToWhite();
5996 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
5997 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
5998 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
5999
6000 aColor.setRGBfromUnitHSV( 0/360.0, 0, 0);
6001 bColor.setToBlack();
6002 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
6003 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
6004 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
6005
6006 aColor.setRGBfromUnitHSV(180/360.0, 0, 0);
6007 bColor.setToBlack();
6008 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
6009 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
6010 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
6011
6012 aColor.setRGBfromUnitHSV( 0/360.0, 1, 0);
6013 bColor.setToBlack();
6014 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
6015 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
6016 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
6017
6018 aColor.setRGBfromUnitHSV(180/360.0, 1, 0);
6019 bColor.setToBlack();
6020 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
6021 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
6022 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
6023}
6024
6025////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
6026BOOST_AUTO_TEST_CASE(hsl_hsv_flt, * boost::unit_test::tolerance(0.01)) {
6027
6028 mjr::colorRGB32F aColor;
6029 mjr::colorRGB32F bColor;
6030
6031 aColor.setRGBfromUnitHSL( 0/360.0, 1, 0.5);
6032 bColor.setToRed();
6033 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
6034 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
6035 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
6036
6037 aColor.setRGBfromUnitHSL( 60/360.0, 1, 0.5);
6038 bColor.setToYellow();
6039 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
6040 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
6041 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
6042
6043 aColor.setRGBfromUnitHSL( 420/360.0, 1, 0.5);
6044 bColor.setToYellow();
6045 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
6046 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
6047 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
6048
6049 aColor.setRGBfromUnitHSL(120/360.0, 1, 0.5);
6050 bColor.setToGreen();
6051 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
6052 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
6053 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
6054
6055 aColor.setRGBfromUnitHSL(180/360.0, 1, 0.5);
6056 bColor.setToCyan();
6057 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
6058 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
6059 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
6060
6061 aColor.setRGBfromUnitHSL(240/360.0, 1, 0.5);
6062 bColor.setToBlue();
6063 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
6064 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
6065 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
6066
6067 aColor.setRGBfromUnitHSL(300/360.0, 1, 0.5);
6068 bColor.setToMagenta();
6069 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
6070 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
6071 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
6072
6073////////////////////////////////////////////////////////////////////////////////
6074
6075 aColor.setRGBfromUnitHSV( 0/360.0, 1, 1.0);
6076 bColor.setToRed();
6077 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
6078 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
6079 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
6080
6081 aColor.setRGBfromUnitHSV( 60/360.0, 1, 1.0);
6082 bColor.setToYellow();
6083 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
6084 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
6085 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
6086
6087 aColor.setRGBfromUnitHSV(120/360.0, 1, 1.0);
6088 bColor.setToGreen();
6089 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
6090 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
6091 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
6092
6093 aColor.setRGBfromUnitHSV(180/360.0, 1, 1.0);
6094 bColor.setToCyan();
6095 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
6096 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
6097 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
6098
6099 aColor.setRGBfromUnitHSV(240/360.0, 1, 1.0);
6100 bColor.setToBlue();
6101 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
6102 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
6103 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
6104
6105 aColor.setRGBfromUnitHSV(300/360.0, 1, 1.0);
6106 bColor.setToMagenta();
6107 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
6108 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
6109 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
6110
6111////////////////////////////////////////////////////////////////////////////////
6112
6113 aColor.setRGBfromUnitHSL( 0/360.0, 1, 0);
6114 bColor.setToBlack();
6115 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
6116 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
6117 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
6118
6119 aColor.setRGBfromUnitHSL(180/360.0, 1, 0);
6120 bColor.setToBlack();
6121 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
6122 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
6123 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
6124
6125 aColor.setRGBfromUnitHSL( 0/360.0, 1, 1);
6126 bColor.setToWhite();
6127 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
6128 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
6129 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
6130
6131 aColor.setRGBfromUnitHSL(180/360.0, 1, 1);
6132 bColor.setToWhite();
6133 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
6134 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
6135 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
6136
6137////////////////////////////////////////////////////////////////////////////////
6138
6139 aColor.setRGBfromUnitHSV( 0/360.0, 0, 1);
6140 bColor.setToWhite();
6141 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
6142 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
6143 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
6144
6145 aColor.setRGBfromUnitHSV(180/360.0, 0, 1);
6146 bColor.setToWhite();
6147 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
6148 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
6149 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
6150
6151 aColor.setRGBfromUnitHSV( 0/360.0, 0, 0);
6152 bColor.setToBlack();
6153 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
6154 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
6155 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
6156
6157 aColor.setRGBfromUnitHSV(180/360.0, 0, 0);
6158 bColor.setToBlack();
6159 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
6160 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
6161 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
6162
6163 aColor.setRGBfromUnitHSV( 0/360.0, 1, 0);
6164 bColor.setToBlack();
6165 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
6166 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
6167 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
6168
6169 aColor.setRGBfromUnitHSV(180/360.0, 1, 0);
6170 bColor.setToBlack();
6171 BOOST_TEST_CHECK(aColor.getRed() == bColor.getRed());
6172 BOOST_TEST_CHECK(aColor.getGreen() == bColor.getGreen());
6173 BOOST_TEST_CHECK(aColor.getBlue() == bColor.getBlue());
6174}
6175
6176////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
6177BOOST_AUTO_TEST_CASE(csCBSpectral_int) {
6178
6179 mjr::colorRGBA8b aColor;
6180 mjr::colorRGBA32F bColor;
6181
6182////////////////////////////////////////////////////////////////////////////////
6183
6184 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 0, 3).isEqualRGB(aColor.setChansRGB(252, 141, 89))); // smallest
6185 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 1, 3).isEqualRGB(aColor.setChansRGB(255, 255, 191)));
6186 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 2, 3).isEqualRGB(aColor.setChansRGB(153, 213, 148)));
6187
6188 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 0, 11).isEqualRGB(aColor.setChansRGB(158, 1, 66))); // biggest
6189 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 1, 11).isEqualRGB(aColor.setChansRGB(213, 62, 79)));
6190 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 2, 11).isEqualRGB(aColor.setChansRGB(244, 109, 67)));
6191 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 3, 11).isEqualRGB(aColor.setChansRGB(253, 174, 97)));
6192 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 4, 11).isEqualRGB(aColor.setChansRGB(254, 224, 139)));
6193 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 5, 11).isEqualRGB(aColor.setChansRGB(255, 255, 191)));
6194 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 6, 11).isEqualRGB(aColor.setChansRGB(230, 245, 152)));
6195 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 7, 11).isEqualRGB(aColor.setChansRGB(171, 221, 164)));
6196 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 8, 11).isEqualRGB(aColor.setChansRGB(102, 194, 165)));
6197 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 9, 11).isEqualRGB(aColor.setChansRGB( 50, 136, 189)));
6198 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c(10, 11).isEqualRGB(aColor.setChansRGB( 94, 79, 162)));
6199
6200////////////////////////////////////////////////////////////////////////////////
6201
6202 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 3, 3).isEqualRGB(aColor.setChansRGB(252, 141, 89))); // wrap index
6203 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 4, 3).isEqualRGB(aColor.setChansRGB(255, 255, 191)));
6204 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 5, 3).isEqualRGB(aColor.setChansRGB(153, 213, 148)));
6205
6206 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c(11, 11).isEqualRGB(aColor.setChansRGB(158, 1, 66))); // wrap index
6207 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c(12, 11).isEqualRGB(aColor.setChansRGB(213, 62, 79)));
6208 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c(13, 11).isEqualRGB(aColor.setChansRGB(244, 109, 67)));
6209 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c(14, 11).isEqualRGB(aColor.setChansRGB(253, 174, 97)));
6210 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c(15, 11).isEqualRGB(aColor.setChansRGB(254, 224, 139)));
6211 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c(16, 11).isEqualRGB(aColor.setChansRGB(255, 255, 191)));
6212 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c(17, 11).isEqualRGB(aColor.setChansRGB(230, 245, 152)));
6213 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c(18, 11).isEqualRGB(aColor.setChansRGB(171, 221, 164)));
6214 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c(19, 11).isEqualRGB(aColor.setChansRGB(102, 194, 165)));
6215 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c(20, 11).isEqualRGB(aColor.setChansRGB( 50, 136, 189)));
6216 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c(21, 11).isEqualRGB(aColor.setChansRGB( 94, 79, 162)));
6217
6218////////////////////////////////////////////////////////////////////////////////
6219
6220 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 0 ).isEqualRGB(aColor.setChansRGB(158, 1, 66))); // missing -> 11
6221 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 1 ).isEqualRGB(aColor.setChansRGB(213, 62, 79)));
6222 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 2 ).isEqualRGB(aColor.setChansRGB(244, 109, 67)));
6223 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 3 ).isEqualRGB(aColor.setChansRGB(253, 174, 97)));
6224 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 4 ).isEqualRGB(aColor.setChansRGB(254, 224, 139)));
6225 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 5 ).isEqualRGB(aColor.setChansRGB(255, 255, 191)));
6226 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 6 ).isEqualRGB(aColor.setChansRGB(230, 245, 152)));
6227 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 7 ).isEqualRGB(aColor.setChansRGB(171, 221, 164)));
6228 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 8 ).isEqualRGB(aColor.setChansRGB(102, 194, 165)));
6229 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 9 ).isEqualRGB(aColor.setChansRGB( 50, 136, 189)));
6230 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c(10 ).isEqualRGB(aColor.setChansRGB( 94, 79, 162)));
6231
6232 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 0, 1).isEqualRGB(aColor.setChansRGB(252, 141, 89))); // too small -> 3
6233 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 1, 1).isEqualRGB(aColor.setChansRGB(255, 255, 191)));
6234 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 2, 1).isEqualRGB(aColor.setChansRGB(153, 213, 148)));
6235
6236 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 0, 50).isEqualRGB(aColor.setChansRGB(158, 1, 66))); // too big -> 11
6237 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 1, 50).isEqualRGB(aColor.setChansRGB(213, 62, 79)));
6238 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 2, 50).isEqualRGB(aColor.setChansRGB(244, 109, 67)));
6239 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 3, 50).isEqualRGB(aColor.setChansRGB(253, 174, 97)));
6240 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 4, 50).isEqualRGB(aColor.setChansRGB(254, 224, 139)));
6241 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 5, 50).isEqualRGB(aColor.setChansRGB(255, 255, 191)));
6242 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 6, 50).isEqualRGB(aColor.setChansRGB(230, 245, 152)));
6243 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 7, 50).isEqualRGB(aColor.setChansRGB(171, 221, 164)));
6244 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 8, 50).isEqualRGB(aColor.setChansRGB(102, 194, 165)));
6245 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 9, 50).isEqualRGB(aColor.setChansRGB( 50, 136, 189)));
6246 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c(10, 50).isEqualRGB(aColor.setChansRGB( 94, 79, 162)));
6247
6248////////////////////////////////////////////////////////////////////////////////
6249
6250 aColor.setToBlack();
6251 mjr::colorRGBA8b::csCBSpectral::c(aColor, 0, 3);
6252 BOOST_TEST_CHECK(aColor.getRed() == 252);
6253 BOOST_TEST_CHECK(aColor.getGreen() == 141);
6254 BOOST_TEST_CHECK(aColor.getBlue() == 89);
6255 BOOST_TEST_CHECK(aColor.getAlpha() == mjr::colorRGBA8b::minChanVal); // Not set!
6256
6257 aColor.setToWhite();
6258 mjr::colorRGBA8b::csCBSpectral::c(aColor, 0, 3);
6259 BOOST_TEST_CHECK(aColor.getRed() == 252);
6260 BOOST_TEST_CHECK(aColor.getGreen() == 141);
6261 BOOST_TEST_CHECK(aColor.getBlue() == 89);
6262 BOOST_TEST_CHECK(aColor.getAlpha() == mjr::colorRGBA8b::maxChanVal); // Not set!
6263
6264////////////////////////////////////////////////////////////////////////////////
6265
6266 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 0, 3).isCloseRGB(bColor.setChansRGB(252/255.0F, 141/255.0F, 89/255.0F), 0.00001F)); // smallest
6267 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 1, 3).isCloseRGB(bColor.setChansRGB(255/255.0F, 255/255.0F, 191/255.0F), 0.00001F));
6268 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 2, 3).isCloseRGB(bColor.setChansRGB(153/255.0F, 213/255.0F, 148/255.0F), 0.00001F));
6269
6270 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 0, 11).isCloseRGB(bColor.setChansRGB(158/255.0F, 1/255.0F, 66/255.0F), 0.00001F)); // biggest
6271 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 1, 11).isCloseRGB(bColor.setChansRGB(213/255.0F, 62/255.0F, 79/255.0F), 0.00001F));
6272 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 2, 11).isCloseRGB(bColor.setChansRGB(244/255.0F, 109/255.0F, 67/255.0F), 0.00001F));
6273 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 3, 11).isCloseRGB(bColor.setChansRGB(253/255.0F, 174/255.0F, 97/255.0F), 0.00001F));
6274 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 4, 11).isCloseRGB(bColor.setChansRGB(254/255.0F, 224/255.0F, 139/255.0F), 0.00001F));
6275 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 5, 11).isCloseRGB(bColor.setChansRGB(255/255.0F, 255/255.0F, 191/255.0F), 0.00001F));
6276 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 6, 11).isCloseRGB(bColor.setChansRGB(230/255.0F, 245/255.0F, 152/255.0F), 0.00001F));
6277 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 7, 11).isCloseRGB(bColor.setChansRGB(171/255.0F, 221/255.0F, 164/255.0F), 0.00001F));
6278 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 8, 11).isCloseRGB(bColor.setChansRGB(102/255.0F, 194/255.0F, 165/255.0F), 0.00001F));
6279 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 9, 11).isCloseRGB(bColor.setChansRGB( 50/255.0F, 136/255.0F, 189/255.0F), 0.00001F));
6280 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c(10, 11).isCloseRGB(bColor.setChansRGB( 94/255.0F, 79/255.0F, 162/255.0F), 0.00001F));
6281
6282////////////////////////////////////////////////////////////////////////////////
6283
6284 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 3, 3).isCloseRGB(bColor.setChansRGB(252/255.0F, 141/255.0F, 89/255.0F), 0.00001F)); // wrap index
6285 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 4, 3).isCloseRGB(bColor.setChansRGB(255/255.0F, 255/255.0F, 191/255.0F), 0.00001F));
6286 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 5, 3).isCloseRGB(bColor.setChansRGB(153/255.0F, 213/255.0F, 148/255.0F), 0.00001F));
6287
6288 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c(11, 11).isCloseRGB(bColor.setChansRGB(158/255.0F, 1/255.0F, 66/255.0F), 0.00001F)); // wrap index
6289 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c(12, 11).isCloseRGB(bColor.setChansRGB(213/255.0F, 62/255.0F, 79/255.0F), 0.00001F));
6290 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c(13, 11).isCloseRGB(bColor.setChansRGB(244/255.0F, 109/255.0F, 67/255.0F), 0.00001F));
6291 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c(14, 11).isCloseRGB(bColor.setChansRGB(253/255.0F, 174/255.0F, 97/255.0F), 0.00001F));
6292 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c(15, 11).isCloseRGB(bColor.setChansRGB(254/255.0F, 224/255.0F, 139/255.0F), 0.00001F));
6293 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c(16, 11).isCloseRGB(bColor.setChansRGB(255/255.0F, 255/255.0F, 191/255.0F), 0.00001F));
6294 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c(17, 11).isCloseRGB(bColor.setChansRGB(230/255.0F, 245/255.0F, 152/255.0F), 0.00001F));
6295 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c(18, 11).isCloseRGB(bColor.setChansRGB(171/255.0F, 221/255.0F, 164/255.0F), 0.00001F));
6296 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c(19, 11).isCloseRGB(bColor.setChansRGB(102/255.0F, 194/255.0F, 165/255.0F), 0.00001F));
6297 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c(20, 11).isCloseRGB(bColor.setChansRGB( 50/255.0F, 136/255.0F, 189/255.0F), 0.00001F));
6298 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c(21, 11).isCloseRGB(bColor.setChansRGB( 94/255.0F, 79/255.0F, 162/255.0F), 0.00001F));
6299
6300////////////////////////////////////////////////////////////////////////////////
6301
6302 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 0 ).isCloseRGB(bColor.setChansRGB(158/255.0F, 1/255.0F, 66/255.0F), 0.00001F)); // missing -> 11
6303 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 1 ).isCloseRGB(bColor.setChansRGB(213/255.0F, 62/255.0F, 79/255.0F), 0.00001F));
6304 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 2 ).isCloseRGB(bColor.setChansRGB(244/255.0F, 109/255.0F, 67/255.0F), 0.00001F));
6305 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 3 ).isCloseRGB(bColor.setChansRGB(253/255.0F, 174/255.0F, 97/255.0F), 0.00001F));
6306 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 4 ).isCloseRGB(bColor.setChansRGB(254/255.0F, 224/255.0F, 139/255.0F), 0.00001F));
6307 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 5 ).isCloseRGB(bColor.setChansRGB(255/255.0F, 255/255.0F, 191/255.0F), 0.00001F));
6308 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 6 ).isCloseRGB(bColor.setChansRGB(230/255.0F, 245/255.0F, 152/255.0F), 0.00001F));
6309 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 7 ).isCloseRGB(bColor.setChansRGB(171/255.0F, 221/255.0F, 164/255.0F), 0.00001F));
6310 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 8 ).isCloseRGB(bColor.setChansRGB(102/255.0F, 194/255.0F, 165/255.0F), 0.00001F));
6311 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 9 ).isCloseRGB(bColor.setChansRGB( 50/255.0F, 136/255.0F, 189/255.0F), 0.00001F));
6312 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c(10 ).isCloseRGB(bColor.setChansRGB( 94/255.0F, 79/255.0F, 162/255.0F), 0.00001F));
6313
6314 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 0, 1).isCloseRGB(bColor.setChansRGB(252/255.0F, 141/255.0F, 89/255.0F), 0.00001F)); // too small -> 3
6315 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 1, 1).isCloseRGB(bColor.setChansRGB(255/255.0F, 255/255.0F, 191/255.0F), 0.00001F));
6316 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 2, 1).isCloseRGB(bColor.setChansRGB(153/255.0F, 213/255.0F, 148/255.0F), 0.00001F));
6317
6318 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 0, 50).isCloseRGB(bColor.setChansRGB(158/255.0F, 1/255.0F, 66/255.0F), 0.00001F)); // too big -> 11
6319 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 1, 50).isCloseRGB(bColor.setChansRGB(213/255.0F, 62/255.0F, 79/255.0F), 0.00001F));
6320 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 2, 50).isCloseRGB(bColor.setChansRGB(244/255.0F, 109/255.0F, 67/255.0F), 0.00001F));
6321 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 3, 50).isCloseRGB(bColor.setChansRGB(253/255.0F, 174/255.0F, 97/255.0F), 0.00001F));
6322 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 4, 50).isCloseRGB(bColor.setChansRGB(254/255.0F, 224/255.0F, 139/255.0F), 0.00001F));
6323 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 5, 50).isCloseRGB(bColor.setChansRGB(255/255.0F, 255/255.0F, 191/255.0F), 0.00001F));
6324 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 6, 50).isCloseRGB(bColor.setChansRGB(230/255.0F, 245/255.0F, 152/255.0F), 0.00001F));
6325 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 7, 50).isCloseRGB(bColor.setChansRGB(171/255.0F, 221/255.0F, 164/255.0F), 0.00001F));
6326 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 8, 50).isCloseRGB(bColor.setChansRGB(102/255.0F, 194/255.0F, 165/255.0F), 0.00001F));
6327 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 9, 50).isCloseRGB(bColor.setChansRGB( 50/255.0F, 136/255.0F, 189/255.0F), 0.00001F));
6328 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c(10, 50).isCloseRGB(bColor.setChansRGB( 94/255.0F, 79/255.0F, 162/255.0F), 0.00001F));
6329
6330////////////////////////////////////////////////////////////////////////////////
6331
6332 bColor.setToBlack();
6333 mjr::colorRGBA32F::csCBSpectral::c(bColor, 0, 3);
6334 BOOST_TEST_CHECK(bColor.getAlpha() == mjr::colorRGBA32F::minChanVal); // Not set!
6335
6336 bColor.setToWhite();
6337 mjr::colorRGBA32F::csCBSpectral::c(bColor, 0, 3);
6338 BOOST_TEST_CHECK(bColor.getAlpha() == mjr::colorRGBA32F::maxChanVal); // Not set!
6339
6340}
6341
6342////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
6343BOOST_AUTO_TEST_CASE(csCBSpectral_flt) {
6344
6345 mjr::colorRGBA8b aColor;
6346 mjr::colorRGBA32F bColor;
6347
6348////////////////////////////////////////////////////////////////////////////////
6349
6350 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 0/2.0F, 3).isCloseRGB(aColor.setChansRGB(252, 141, 89), 2)); // smallest
6351 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 1/2.0F, 3).isCloseRGB(aColor.setChansRGB(255, 255, 191), 2));
6352 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 2/2.0F, 3).isCloseRGB(aColor.setChansRGB(153, 213, 148), 2));
6353
6354 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 0/10.0F, 11).isCloseRGB(aColor.setChansRGB(158, 1, 66), 2)); // biggest
6355 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 1/10.0F, 11).isCloseRGB(aColor.setChansRGB(213, 62, 79), 2));
6356 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 2/10.0F, 11).isCloseRGB(aColor.setChansRGB(244, 109, 67), 2));
6357 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 3/10.0F, 11).isCloseRGB(aColor.setChansRGB(253, 174, 97), 2));
6358 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 4/10.0F, 11).isCloseRGB(aColor.setChansRGB(254, 224, 139), 2));
6359 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 5/10.0F, 11).isCloseRGB(aColor.setChansRGB(255, 255, 191), 2));
6360 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 6/10.0F, 11).isCloseRGB(aColor.setChansRGB(230, 245, 152), 2));
6361 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 7/10.0F, 11).isCloseRGB(aColor.setChansRGB(171, 221, 164), 2));
6362 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 8/10.0F, 11).isCloseRGB(aColor.setChansRGB(102, 194, 165), 2));
6363 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 9/10.0F, 11).isCloseRGB(aColor.setChansRGB( 50, 136, 189), 2));
6364 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c(10/10.0F, 11).isCloseRGB(aColor.setChansRGB( 94, 79, 162), 2));
6365
6366////////////////////////////////////////////////////////////////////////////////
6367
6368 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 3/2.0F, 3).isCloseRGB(aColor.setChansRGB(255, 255, 191), 2)); // wrap index
6369
6370 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c(1+ 1/10.0F, 11).isCloseRGB(aColor.setChansRGB(213, 62, 79), 2)); // wrap index
6371 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c(1+ 2/10.0F, 11).isCloseRGB(aColor.setChansRGB(244, 109, 67), 2));
6372 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c(1+ 3/10.0F, 11).isCloseRGB(aColor.setChansRGB(253, 174, 97), 2));
6373 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c(1+ 4/10.0F, 11).isCloseRGB(aColor.setChansRGB(254, 224, 139), 2));
6374 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c(1+ 5/10.0F, 11).isCloseRGB(aColor.setChansRGB(255, 255, 191), 2));
6375 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c(1+ 6/10.0F, 11).isCloseRGB(aColor.setChansRGB(230, 245, 152), 2));
6376 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c(1+ 7/10.0F, 11).isCloseRGB(aColor.setChansRGB(171, 221, 164), 2));
6377 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c(1+ 8/10.0F, 11).isCloseRGB(aColor.setChansRGB(102, 194, 165), 2));
6378 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c(1+ 9/10.0F, 11).isCloseRGB(aColor.setChansRGB( 50, 136, 189), 2));
6379
6380////////////////////////////////////////////////////////////////////////////////
6381
6382 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 0/10.0F ).isCloseRGB(aColor.setChansRGB(158, 1, 66), 2)); // missing -> 11
6383 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 1/10.0F ).isCloseRGB(aColor.setChansRGB(213, 62, 79), 2));
6384 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 2/10.0F ).isCloseRGB(aColor.setChansRGB(244, 109, 67), 2));
6385 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 3/10.0F ).isCloseRGB(aColor.setChansRGB(253, 174, 97), 2));
6386 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 4/10.0F ).isCloseRGB(aColor.setChansRGB(254, 224, 139), 2));
6387 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 5/10.0F ).isCloseRGB(aColor.setChansRGB(255, 255, 191), 2));
6388 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 6/10.0F ).isCloseRGB(aColor.setChansRGB(230, 245, 152), 2));
6389 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 7/10.0F ).isCloseRGB(aColor.setChansRGB(171, 221, 164), 2));
6390 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 8/10.0F ).isCloseRGB(aColor.setChansRGB(102, 194, 165), 2));
6391 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 9/10.0F ).isCloseRGB(aColor.setChansRGB( 50, 136, 189), 2));
6392 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c(10/10.0F ).isCloseRGB(aColor.setChansRGB( 94, 79, 162), 2));
6393
6394 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 0/2.0F, 1).isCloseRGB(aColor.setChansRGB(252, 141, 89), 2)); // too small -> 3
6395 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 1/2.0F, 1).isCloseRGB(aColor.setChansRGB(255, 255, 191), 2));
6396 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 2/2.0F, 1).isCloseRGB(aColor.setChansRGB(153, 213, 148), 2));
6397
6398 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 0/10.0F, 50).isCloseRGB(aColor.setChansRGB(158, 1, 66), 2)); // too big -> 11
6399 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 1/10.0F, 50).isCloseRGB(aColor.setChansRGB(213, 62, 79), 2));
6400 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 2/10.0F, 50).isCloseRGB(aColor.setChansRGB(244, 109, 67), 2));
6401 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 3/10.0F, 50).isCloseRGB(aColor.setChansRGB(253, 174, 97), 2));
6402 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 4/10.0F, 50).isCloseRGB(aColor.setChansRGB(254, 224, 139), 2));
6403 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 5/10.0F, 50).isCloseRGB(aColor.setChansRGB(255, 255, 191), 2));
6404 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 6/10.0F, 50).isCloseRGB(aColor.setChansRGB(230, 245, 152), 2));
6405 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 7/10.0F, 50).isCloseRGB(aColor.setChansRGB(171, 221, 164), 2));
6406 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 8/10.0F, 50).isCloseRGB(aColor.setChansRGB(102, 194, 165), 2));
6407 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c( 9/10.0F, 50).isCloseRGB(aColor.setChansRGB( 50, 136, 189), 2));
6408 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCBSpectral::c(10/10.0F, 50).isCloseRGB(aColor.setChansRGB( 94, 79, 162), 2));
6409
6410////////////////////////////////////////////////////////////////////////////////
6411
6412 aColor.setToBlack();
6413 mjr::colorRGBA8b::csCBSpectral::c(aColor, 0/2.0F, 3);
6414 BOOST_TEST_CHECK(aColor.getAlpha() == mjr::colorRGBA8b::minChanVal); // Not set!
6415
6416 aColor.setToWhite();
6417 mjr::colorRGBA8b::csCBSpectral::c(aColor, 0/2.0F, 3);
6418 BOOST_TEST_CHECK(aColor.getAlpha() == mjr::colorRGBA8b::maxChanVal); // Not set!
6419
6420////////////////////////////////////////////////////////////////////////////////
6421
6422 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 0/2.0F, 3).isCloseRGB(bColor.setChansRGB(252/255.0F, 141/255.0F, 89/255.0F), 0.00001F)); // smallest
6423 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 1/2.0F, 3).isCloseRGB(bColor.setChansRGB(255/255.0F, 255/255.0F, 191/255.0F), 0.00001F));
6424 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 2/2.0F, 3).isCloseRGB(bColor.setChansRGB(153/255.0F, 213/255.0F, 148/255.0F), 0.00001F));
6425
6426 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 0/10.0F, 11).isCloseRGB(bColor.setChansRGB(158/255.0F, 1/255.0F, 66/255.0F), 0.00001F)); // biggest
6427 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 1/10.0F, 11).isCloseRGB(bColor.setChansRGB(213/255.0F, 62/255.0F, 79/255.0F), 0.00001F));
6428 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 2/10.0F, 11).isCloseRGB(bColor.setChansRGB(244/255.0F, 109/255.0F, 67/255.0F), 0.00001F));
6429 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 3/10.0F, 11).isCloseRGB(bColor.setChansRGB(253/255.0F, 174/255.0F, 97/255.0F), 0.00001F));
6430 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 4/10.0F, 11).isCloseRGB(bColor.setChansRGB(254/255.0F, 224/255.0F, 139/255.0F), 0.00001F));
6431 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 5/10.0F, 11).isCloseRGB(bColor.setChansRGB(255/255.0F, 255/255.0F, 191/255.0F), 0.00001F));
6432 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 6/10.0F, 11).isCloseRGB(bColor.setChansRGB(230/255.0F, 245/255.0F, 152/255.0F), 0.00001F));
6433 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 7/10.0F, 11).isCloseRGB(bColor.setChansRGB(171/255.0F, 221/255.0F, 164/255.0F), 0.00001F));
6434 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 8/10.0F, 11).isCloseRGB(bColor.setChansRGB(102/255.0F, 194/255.0F, 165/255.0F), 0.00001F));
6435 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 9/10.0F, 11).isCloseRGB(bColor.setChansRGB( 50/255.0F, 136/255.0F, 189/255.0F), 0.00001F));
6436 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c(10/10.0F, 11).isCloseRGB(bColor.setChansRGB( 94/255.0F, 79/255.0F, 162/255.0F), 0.00001F));
6437
6438////////////////////////////////////////////////////////////////////////////////
6439
6440 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 3/2.0F, 3).isCloseRGB(bColor.setChansRGB(255/255.0F, 255/255.0F, 191/255.0F), 0.00001F));
6441
6442 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c(1+1/10.0F, 11).isCloseRGB(bColor.setChansRGB(213/255.0F, 62/255.0F, 79/255.0F), 0.00001F));
6443 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c(1+2/10.0F, 11).isCloseRGB(bColor.setChansRGB(244/255.0F, 109/255.0F, 67/255.0F), 0.00001F));
6444 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c(1+3/10.0F, 11).isCloseRGB(bColor.setChansRGB(253/255.0F, 174/255.0F, 97/255.0F), 0.00001F));
6445 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c(1+4/10.0F, 11).isCloseRGB(bColor.setChansRGB(254/255.0F, 224/255.0F, 139/255.0F), 0.00001F));
6446 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c(1+5/10.0F, 11).isCloseRGB(bColor.setChansRGB(255/255.0F, 255/255.0F, 191/255.0F), 0.00001F));
6447 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c(1+6/10.0F, 11).isCloseRGB(bColor.setChansRGB(230/255.0F, 245/255.0F, 152/255.0F), 0.00001F));
6448 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c(1+7/10.0F, 11).isCloseRGB(bColor.setChansRGB(171/255.0F, 221/255.0F, 164/255.0F), 0.00001F));
6449 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c(1+8/10.0F, 11).isCloseRGB(bColor.setChansRGB(102/255.0F, 194/255.0F, 165/255.0F), 0.00001F));
6450 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c(1+9/10.0F, 11).isCloseRGB(bColor.setChansRGB( 50/255.0F, 136/255.0F, 189/255.0F), 0.00001F));
6451
6452// ////////////////////////////////////////////////////////////////////////////////
6453
6454 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 0/10.0F ).isCloseRGB(bColor.setChansRGB(158/255.0F, 1/255.0F, 66/255.0F), 0.00001F)); // missing -> 11
6455 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 1/10.0F ).isCloseRGB(bColor.setChansRGB(213/255.0F, 62/255.0F, 79/255.0F), 0.00001F));
6456 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 2/10.0F ).isCloseRGB(bColor.setChansRGB(244/255.0F, 109/255.0F, 67/255.0F), 0.00001F));
6457 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 3/10.0F ).isCloseRGB(bColor.setChansRGB(253/255.0F, 174/255.0F, 97/255.0F), 0.00001F));
6458 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 4/10.0F ).isCloseRGB(bColor.setChansRGB(254/255.0F, 224/255.0F, 139/255.0F), 0.00001F));
6459 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 5/10.0F ).isCloseRGB(bColor.setChansRGB(255/255.0F, 255/255.0F, 191/255.0F), 0.00001F));
6460 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 6/10.0F ).isCloseRGB(bColor.setChansRGB(230/255.0F, 245/255.0F, 152/255.0F), 0.00001F));
6461 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 7/10.0F ).isCloseRGB(bColor.setChansRGB(171/255.0F, 221/255.0F, 164/255.0F), 0.00001F));
6462 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 8/10.0F ).isCloseRGB(bColor.setChansRGB(102/255.0F, 194/255.0F, 165/255.0F), 0.00001F));
6463 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 9/10.0F ).isCloseRGB(bColor.setChansRGB( 50/255.0F, 136/255.0F, 189/255.0F), 0.00001F));
6464 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c(10/10.0F ).isCloseRGB(bColor.setChansRGB( 94/255.0F, 79/255.0F, 162/255.0F), 0.00001F));
6465
6466 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 0/2.0F, 1).isCloseRGB(bColor.setChansRGB(252/255.0F, 141/255.0F, 89/255.0F), 0.00001F)); // too small -> 3
6467 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 1/2.0F, 1).isCloseRGB(bColor.setChansRGB(255/255.0F, 255/255.0F, 191/255.0F), 0.00001F));
6468 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 2/2.0F, 1).isCloseRGB(bColor.setChansRGB(153/255.0F, 213/255.0F, 148/255.0F), 0.00001F));
6469
6470 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 0/10.0F, 50).isCloseRGB(bColor.setChansRGB(158/255.0F, 1/255.0F, 66/255.0F), 0.00001F)); // too big -> 11
6471 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 1/10.0F, 50).isCloseRGB(bColor.setChansRGB(213/255.0F, 62/255.0F, 79/255.0F), 0.00001F));
6472 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 2/10.0F, 50).isCloseRGB(bColor.setChansRGB(244/255.0F, 109/255.0F, 67/255.0F), 0.00001F));
6473 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 3/10.0F, 50).isCloseRGB(bColor.setChansRGB(253/255.0F, 174/255.0F, 97/255.0F), 0.00001F));
6474 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 4/10.0F, 50).isCloseRGB(bColor.setChansRGB(254/255.0F, 224/255.0F, 139/255.0F), 0.00001F));
6475 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 5/10.0F, 50).isCloseRGB(bColor.setChansRGB(255/255.0F, 255/255.0F, 191/255.0F), 0.00001F));
6476 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 6/10.0F, 50).isCloseRGB(bColor.setChansRGB(230/255.0F, 245/255.0F, 152/255.0F), 0.00001F));
6477 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 7/10.0F, 50).isCloseRGB(bColor.setChansRGB(171/255.0F, 221/255.0F, 164/255.0F), 0.00001F));
6478 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 8/10.0F, 50).isCloseRGB(bColor.setChansRGB(102/255.0F, 194/255.0F, 165/255.0F), 0.00001F));
6479 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c( 9/10.0F, 50).isCloseRGB(bColor.setChansRGB( 50/255.0F, 136/255.0F, 189/255.0F), 0.00001F));
6480 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCBSpectral::c(10/10.0F, 50).isCloseRGB(bColor.setChansRGB( 94/255.0F, 79/255.0F, 162/255.0F), 0.00001F));
6481
6482////////////////////////////////////////////////////////////////////////////////
6483
6484 bColor.setToBlack();
6485 mjr::colorRGBA32F::csCBSpectral::c(bColor, 0/2.0F, 3);
6486 BOOST_TEST_CHECK(bColor.getAlpha() == mjr::colorRGBA32F::minChanVal); // Not set!
6487
6488 bColor.setToWhite();
6489 mjr::colorRGBA32F::csCBSpectral::c(bColor, 0/2.0F, 3);
6490 BOOST_TEST_CHECK(bColor.getAlpha() == mjr::colorRGBA32F::maxChanVal); // Not set!
6491}
6492
6493////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
6494BOOST_AUTO_TEST_CASE(isClose_and_isCloseRGB) {
6495
6496 mjr::colorRGB8b aLcolor;
6497 mjr::colorRGBA8b bLcolor;
6498 mjr::colorRGB32F cLcolor;
6499 mjr::colorRGBA32F dLcolor;
6500
6501 mjr::colorRGB8b aRcolor;
6502 mjr::colorRGBA8b bRcolor;
6503 mjr::colorRGB32F cRcolor;
6504 mjr::colorRGBA32F dRcolor;
6505
6506 aLcolor.setToBlack();
6507 bLcolor.setToBlack();
6508 cLcolor.setToBlack();
6509 dLcolor.setToBlack();
6510
6511 aRcolor.setToBlack();
6512 bRcolor.setToBlack();
6513 cRcolor.setToBlack();
6514 dRcolor.setToBlack();
6515
6516 BOOST_TEST_CHECK(aLcolor.isClose(aRcolor, 0) == true);
6517 BOOST_TEST_CHECK(bLcolor.isClose(bRcolor, 0) == true);
6518 BOOST_TEST_CHECK(cLcolor.isClose(cRcolor, 0) == true);
6519 BOOST_TEST_CHECK(dLcolor.isClose(dRcolor, 0) == true);
6520
6521 BOOST_TEST_CHECK(aLcolor.isCloseRGB(aRcolor, 0) == true);
6522 BOOST_TEST_CHECK(bLcolor.isCloseRGB(bRcolor, 0) == true);
6523 BOOST_TEST_CHECK(cLcolor.isCloseRGB(cRcolor, 0) == true);
6524 BOOST_TEST_CHECK(dLcolor.isCloseRGB(dRcolor, 0) == true);
6525
6526 aLcolor.setChanToMax(0);
6527 bLcolor.setChanToMax(0);
6528 cLcolor.setChanToMax(0);
6529 dLcolor.setChanToMax(0);
6530
6531 BOOST_TEST_CHECK(aLcolor.isClose(aRcolor, 0) == false);
6532 BOOST_TEST_CHECK(bLcolor.isClose(bRcolor, 0) == false);
6533 BOOST_TEST_CHECK(cLcolor.isClose(cRcolor, 0) == false);
6534 BOOST_TEST_CHECK(dLcolor.isClose(dRcolor, 0) == false);
6535
6536 BOOST_TEST_CHECK(aLcolor.isCloseRGB(aRcolor, 0) == false);
6537 BOOST_TEST_CHECK(bLcolor.isCloseRGB(bRcolor, 0) == false);
6538 BOOST_TEST_CHECK(cLcolor.isCloseRGB(cRcolor, 0) == false);
6539 BOOST_TEST_CHECK(dLcolor.isCloseRGB(dRcolor, 0) == false);
6540
6541 aRcolor.setChanToMax(0);
6542 bRcolor.setChanToMax(0);
6543 cRcolor.setChanToMax(0);
6544 dRcolor.setChanToMax(0);
6545
6546 BOOST_TEST_CHECK(aLcolor.isClose(aRcolor, 0) == true);
6547 BOOST_TEST_CHECK(bLcolor.isClose(bRcolor, 0) == true);
6548 BOOST_TEST_CHECK(cLcolor.isClose(cRcolor, 0) == true);
6549 BOOST_TEST_CHECK(dLcolor.isClose(dRcolor, 0) == true);
6550
6551 BOOST_TEST_CHECK(aLcolor.isCloseRGB(aRcolor, 0) == true);
6552 BOOST_TEST_CHECK(bLcolor.isCloseRGB(bRcolor, 0) == true);
6553 BOOST_TEST_CHECK(cLcolor.isCloseRGB(cRcolor, 0) == true);
6554 BOOST_TEST_CHECK(dLcolor.isCloseRGB(dRcolor, 0) == true);
6555
6556 bRcolor.setChanToMax(3);
6557 dRcolor.setChanToMax(3);
6558
6559 BOOST_TEST_CHECK(bLcolor.isClose(bRcolor, 0) == false);
6560 BOOST_TEST_CHECK(dLcolor.isClose(dRcolor, 0) == false);
6561
6562 BOOST_TEST_CHECK(bLcolor.isCloseRGB(bRcolor, 0) == true);
6563 BOOST_TEST_CHECK(dLcolor.isCloseRGB(dRcolor, 0) == true);
6564
6565 aLcolor.setChansRGB(1, 2, 3);
6566 aRcolor.setChansRGB(1, 3, 4);
6567
6568 BOOST_TEST_CHECK(aLcolor.isClose(aRcolor, 0) == false);
6569 BOOST_TEST_CHECK(aRcolor.isClose(aLcolor, 0) == false);
6570
6571 BOOST_TEST_CHECK(aLcolor.isClose(aRcolor, 1) == true); // false only if a channel delta is GREATER THAN epsilon
6572 BOOST_TEST_CHECK(aRcolor.isClose(aLcolor, 1) == true);
6573
6574 BOOST_TEST_CHECK(aLcolor.isClose(aRcolor, 2) == true);
6575 BOOST_TEST_CHECK(aRcolor.isClose(aLcolor, 2) == true);
6576
6577 cLcolor.setChansRGB(1, 2, 3);
6578 cRcolor.setChansRGB(1, 3, 4);
6579
6580 BOOST_TEST_CHECK(cLcolor.isClose(cRcolor, 0.0F) == false);
6581 BOOST_TEST_CHECK(cRcolor.isClose(cLcolor, 0.0F) == false);
6582
6583 BOOST_TEST_CHECK(cLcolor.isClose(cRcolor, 0.9999F) == false);
6584 BOOST_TEST_CHECK(cRcolor.isClose(cLcolor, 0.9999F) == false);
6585
6586 BOOST_TEST_CHECK(cLcolor.isClose(cRcolor, 1.0F) == true); // Edge case is ill-defined for FP arithmetic, but OK here as we used numbers that are exactly representable -- might fail on other hardware.
6587 BOOST_TEST_CHECK(cRcolor.isClose(cLcolor, 1.0F) == true);
6588
6589 BOOST_TEST_CHECK(cLcolor.isClose(cRcolor, 1.0001F) == true);
6590 BOOST_TEST_CHECK(cRcolor.isClose(cLcolor, 1.0001F) == true);
6591
6592 BOOST_TEST_CHECK(cLcolor.isClose(cRcolor, 2.0F) == true);
6593 BOOST_TEST_CHECK(cRcolor.isClose(cLcolor, 2.0F) == true);
6594}
6595
6596////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
6597BOOST_AUTO_TEST_CASE(setRGBfromColorSpace) {
6598
6599 mjr::colorRGB8b aColor, bColor;
6600 mjr::colorRGBA8b cColor, dColor;
6601 mjr::colorRGB32F eColor, fColor;
6602 mjr::colorRGB16b gColor, hColor;
6603
6604 ////////////////////////////////////////////////////////////////////////////////
6605
6606 aColor.setRGBfromColorSpace(mjr::colorRGB8b::colorSpaceEnum::RGB, 0, 0.5, 1);
6607 BOOST_TEST_CHECK(aColor.getRed() == mjr::colorRGB8b::minChanVal);
6608 BOOST_TEST_CHECK(aColor.getGreen() == mjr::colorRGB8b::meanChanVal);
6609 BOOST_TEST_CHECK(aColor.getBlue() == mjr::colorRGB8b::maxChanVal);
6610
6611 eColor.setRGBfromColorSpace(mjr::colorRGB32F::colorSpaceEnum::RGB, 0, 0.5, 1);
6612 BOOST_TEST_CHECK(eColor.getRed() == mjr::colorRGB32F::minChanVal);
6613 BOOST_TEST_CHECK(eColor.getGreen() == mjr::colorRGB32F::meanChanVal);
6614 BOOST_TEST_CHECK(eColor.getBlue() == mjr::colorRGB32F::maxChanVal);
6615
6616 gColor.setRGBfromColorSpace(mjr::colorRGB16b::colorSpaceEnum::RGB, 0, 0.5, 1);
6617 BOOST_TEST_CHECK(gColor.getRed() == mjr::colorRGB16b::minChanVal);
6618 BOOST_TEST_CHECK(gColor.getGreen() == mjr::colorRGB16b::meanChanVal);
6619 BOOST_TEST_CHECK(gColor.getBlue() == mjr::colorRGB16b::maxChanVal);
6620
6621 cColor.setToWhite();
6622 cColor.setRGBfromColorSpace(mjr::colorRGBA8b::colorSpaceEnum::RGB, 0, 0.5, 1);
6623 BOOST_TEST_CHECK(cColor.getRed() == mjr::colorRGBA8b::minChanVal);
6624 BOOST_TEST_CHECK(cColor.getGreen() == mjr::colorRGBA8b::meanChanVal);
6625 BOOST_TEST_CHECK(cColor.getBlue() == mjr::colorRGBA8b::maxChanVal);
6626 BOOST_TEST_CHECK(cColor.getAlpha() == 0xFF); // Not set
6627
6628 cColor.setToBlack();
6629 cColor.setRGBfromColorSpace(mjr::colorRGBA8b::colorSpaceEnum::RGB, 0, 0.5, 1);
6630 BOOST_TEST_CHECK(cColor.getRed() == mjr::colorRGBA8b::minChanVal);
6631 BOOST_TEST_CHECK(cColor.getGreen() == mjr::colorRGBA8b::meanChanVal);
6632 BOOST_TEST_CHECK(cColor.getBlue() == mjr::colorRGBA8b::maxChanVal);
6633 BOOST_TEST_CHECK(cColor.getAlpha() == 0x00); // Not set
6634
6635 for(double r=0; r<1.0; r=r+0.1)
6636 for(double g=0; g<1.0; g=g+0.1)
6637 for(double b=0; b<1.0; b=b+0.1) // BOOST_TEST_CHECK x 1000
6638 BOOST_TEST_CHECK(aColor.setRGBfromColorSpace(mjr::colorRGB8b::colorSpaceEnum::RGB, r, g, b).isEqualRGB(bColor.setChansRGB_dbl(r, g, b)) == true);
6639
6640 ////////////////////////////////////////////////////////////////////////////////
6641
6642 // HSL & HSV are pretty well tested elseware.
6643
6644 ////////////////////////////////////////////////////////////////////////////////
6645 // 0-100 reals reals
6646 // 0.0, 0.0, 0.0 0.00000000000000, 0.00000000000000, 0.00000000000000
6647 // 0.0, -100.0, 0.0 0.00000000000000, 42.50011693400831, 0.00000000000000
6648 // 0.0, 100.0, 0.0 96.73833014676526, 0.00000000000000, 6.73101465756404
6649 // 0.0, 0.0, -100.0 0.00000000000000, 28.17831280013103, 148.60141206787873
6650 // 0.0, 0.0, 100.0 52.41394321977139, 0.00000000000000, 0.00000000000000
6651 // 100.0, 0.0, 0.0 255.00000000000000, 255.00000000000000, 254.98144635564927
6652 // 50.0, 50.0, 50.0 206.61345904246030, 75.47718797538901, 33.52976908891374
6653 // 50.0, -50.0, 50.0 35.14702068347071, 137.45770493758675, 16.12671766273848
6654 // 50.0, -50.0, -50.0 0.00000000000000, 143.15667349842120, 203.43118280505934
6655 // 50.0, 50.0, -50.0 157.75797959913612, 86.69682271747450, 204.99202043092524
6656
6657 BOOST_TEST_CHECK(aColor.setRGBfromColorSpace(mjr::colorRGB8b::colorSpaceEnum::LAB, 0.0, 0.0, 0.0).isEqualRGB(bColor.setChansRGB( 0, 0, 0)) == true);
6658 BOOST_TEST_CHECK(aColor.setRGBfromColorSpace(mjr::colorRGB8b::colorSpaceEnum::LAB, 0.0, -100.0, 0.0).isEqualRGB(bColor.setChansRGB( 0, 42, 0)) == true);
6659 BOOST_TEST_CHECK(aColor.setRGBfromColorSpace(mjr::colorRGB8b::colorSpaceEnum::LAB, 0.0, 100.0, 0.0).isEqualRGB(bColor.setChansRGB( 96, 0, 6)) == true);
6660 BOOST_TEST_CHECK(aColor.setRGBfromColorSpace(mjr::colorRGB8b::colorSpaceEnum::LAB, 0.0, 0.0, -100.0).isEqualRGB(bColor.setChansRGB( 0, 28, 148)) == true);
6661 BOOST_TEST_CHECK(aColor.setRGBfromColorSpace(mjr::colorRGB8b::colorSpaceEnum::LAB, 0.0, 0.0, 100.0).isEqualRGB(bColor.setChansRGB( 52, 0, 0)) == true);
6662 BOOST_TEST_CHECK(aColor.setRGBfromColorSpace(mjr::colorRGB8b::colorSpaceEnum::LAB, 100.0, 0.0, 0.0).isEqualRGB(bColor.setChansRGB(255, 255, 254)) == true);
6663 BOOST_TEST_CHECK(aColor.setRGBfromColorSpace(mjr::colorRGB8b::colorSpaceEnum::LAB, 50.0, 50.0, 50.0).isEqualRGB(bColor.setChansRGB(206, 75, 33)) == true);
6664 BOOST_TEST_CHECK(aColor.setRGBfromColorSpace(mjr::colorRGB8b::colorSpaceEnum::LAB, 50.0, -50.0, 50.0).isEqualRGB(bColor.setChansRGB( 35, 137, 16)) == true);
6665 BOOST_TEST_CHECK(aColor.setRGBfromColorSpace(mjr::colorRGB8b::colorSpaceEnum::LAB, 50.0, -50.0, -50.0).isEqualRGB(bColor.setChansRGB( 0, 143, 203)) == true);
6666 BOOST_TEST_CHECK(aColor.setRGBfromColorSpace(mjr::colorRGB8b::colorSpaceEnum::LAB, 50.0, 50.0, -50.0).isEqualRGB(bColor.setChansRGB(157, 86, 204)) == true);
6667
6668 BOOST_TEST_CHECK(eColor.setRGBfromColorSpace(mjr::colorRGB32F::colorSpaceEnum::LAB, 0.0, 0.0, 0.0).isCloseRGB(fColor.setChansRGB( 0.00000000000000F/255.0F, 0.00000000000000F/255.0F, 0.00000000000000F/255.0F), 0.00001F) == true);
6669 BOOST_TEST_CHECK(eColor.setRGBfromColorSpace(mjr::colorRGB32F::colorSpaceEnum::LAB, 0.0, -100.0, 0.0).isCloseRGB(fColor.setChansRGB( 0.00000000000000F/255.0F, 42.50011693400831F/255.0F, 0.00000000000000F/255.0F), 0.00001F) == true);
6670 BOOST_TEST_CHECK(eColor.setRGBfromColorSpace(mjr::colorRGB32F::colorSpaceEnum::LAB, 0.0, 100.0, 0.0).isCloseRGB(fColor.setChansRGB( 96.73833014676526F/255.0F, 0.00000000000000F/255.0F, 6.73101465756404F/255.0F), 0.00001F) == true);
6671 BOOST_TEST_CHECK(eColor.setRGBfromColorSpace(mjr::colorRGB32F::colorSpaceEnum::LAB, 0.0, 0.0, -100.0).isCloseRGB(fColor.setChansRGB( 0.00000000000000F/255.0F, 28.17831280013103F/255.0F, 148.60141206787873F/255.0F), 0.00001F) == true);
6672 BOOST_TEST_CHECK(eColor.setRGBfromColorSpace(mjr::colorRGB32F::colorSpaceEnum::LAB, 0.0, 0.0, 100.0).isCloseRGB(fColor.setChansRGB( 52.41394321977139F/255.0F, 0.00000000000000F/255.0F, 0.00000000000000F/255.0F), 0.00001F) == true);
6673 BOOST_TEST_CHECK(eColor.setRGBfromColorSpace(mjr::colorRGB32F::colorSpaceEnum::LAB, 100.0, 0.0, 0.0).isCloseRGB(fColor.setChansRGB(255.00000000000000F/255.0F, 255.00000000000000F/255.0F, 254.98144635564927F/255.0F), 0.00001F) == true);
6674 BOOST_TEST_CHECK(eColor.setRGBfromColorSpace(mjr::colorRGB32F::colorSpaceEnum::LAB, 50.0, 50.0, 50.0).isCloseRGB(fColor.setChansRGB(206.61345904246030F/255.0F, 75.47718797538901F/255.0F, 33.52976908891374F/255.0F), 0.00001F) == true);
6675 BOOST_TEST_CHECK(eColor.setRGBfromColorSpace(mjr::colorRGB32F::colorSpaceEnum::LAB, 50.0, -50.0, 50.0).isCloseRGB(fColor.setChansRGB( 35.14702068347071F/255.0F, 137.45770493758675F/255.0F, 16.12671766273848F/255.0F), 0.00001F) == true);
6676 BOOST_TEST_CHECK(eColor.setRGBfromColorSpace(mjr::colorRGB32F::colorSpaceEnum::LAB, 50.0, -50.0, -50.0).isCloseRGB(fColor.setChansRGB( 0.00000000000000F/255.0F, 143.15667349842120F/255.0F, 203.43118280505934F/255.0F), 0.00001F) == true);
6677 BOOST_TEST_CHECK(eColor.setRGBfromColorSpace(mjr::colorRGB32F::colorSpaceEnum::LAB, 50.0, 50.0, -50.0).isCloseRGB(fColor.setChansRGB(157.75797959913612F/255.0F, 86.69682271747450F/255.0F, 204.99202043092524F/255.0F), 0.00001F) == true);
6678
6679 ////////////////////////////////////////////////////////////////////////////////
6680 // 0-1 0-1 0-1
6681 // 0.0, 0.0, 0.0 0.00000000000000, 0.00000000000000, 0.00000000000000
6682 // 1.0, 0.0, 0.0 50.42455181463890, 0.00000000000000, 1.83509220000000
6683 // 0.0, 1.0, 0.0 0.00000000000000, 37.29504496314512, 0.00000000000000
6684 // 0.0, 0.0, 1.0 0.00000000000000, 1.36725900000000, 26.38515827433519
6685 // 1.0, 1.0, 0.0 35.27435545247001, 23.88691519243730, 0.00000000000000
6686 // 1.0, 0.0, 1.0 46.09063114907088, 0.00000000000000, 27.25916547197178
6687 // 0.0, 1.0, 1.0 0.00000000000000, 37.76511040594671, 22.93126475355600
6688
6689 BOOST_TEST_CHECK(aColor.setRGBfromColorSpace(mjr::colorRGB8b::colorSpaceEnum::XYZ, 0.0, 0.0, 0.0).isEqualRGB(bColor.setChansRGB( 0, 0, 0)) == true);
6690 BOOST_TEST_CHECK(aColor.setRGBfromColorSpace(mjr::colorRGB8b::colorSpaceEnum::XYZ, 1.0, 0.0, 0.0).isEqualRGB(bColor.setChansRGB(50, 0, 1)) == true);
6691 BOOST_TEST_CHECK(aColor.setRGBfromColorSpace(mjr::colorRGB8b::colorSpaceEnum::XYZ, 0.0, 1.0, 0.0).isEqualRGB(bColor.setChansRGB( 0, 37, 0)) == true);
6692 BOOST_TEST_CHECK(aColor.setRGBfromColorSpace(mjr::colorRGB8b::colorSpaceEnum::XYZ, 0.0, 0.0, 1.0).isEqualRGB(bColor.setChansRGB( 0, 1, 26)) == true);
6693 BOOST_TEST_CHECK(aColor.setRGBfromColorSpace(mjr::colorRGB8b::colorSpaceEnum::XYZ, 1.0, 1.0, 0.0).isEqualRGB(bColor.setChansRGB(35, 23, 0)) == true);
6694 BOOST_TEST_CHECK(aColor.setRGBfromColorSpace(mjr::colorRGB8b::colorSpaceEnum::XYZ, 1.0, 0.0, 1.0).isEqualRGB(bColor.setChansRGB(46, 0, 27)) == true);
6695 BOOST_TEST_CHECK(aColor.setRGBfromColorSpace(mjr::colorRGB8b::colorSpaceEnum::XYZ, 0.0, 1.0, 1.0).isEqualRGB(bColor.setChansRGB( 0, 37, 22)) == true);
6696
6697 BOOST_TEST_CHECK(eColor.setRGBfromColorSpace(mjr::colorRGB32F::colorSpaceEnum::XYZ, 0.0, 0.0, 0.0).isCloseRGB(fColor.setChansRGB( 0.00000000000000F/255.0F, 0.00000000000000F/255.0F, 0.00000000000000F/255.0F), 0.00001F) == true);
6698 BOOST_TEST_CHECK(eColor.setRGBfromColorSpace(mjr::colorRGB32F::colorSpaceEnum::XYZ, 1.0, 0.0, 0.0).isCloseRGB(fColor.setChansRGB(50.42455181463890F/255.0F, 0.00000000000000F/255.0F, 1.83509220000000F/255.0F), 0.00001F) == true);
6699 BOOST_TEST_CHECK(eColor.setRGBfromColorSpace(mjr::colorRGB32F::colorSpaceEnum::XYZ, 0.0, 1.0, 0.0).isCloseRGB(fColor.setChansRGB( 0.00000000000000F/255.0F, 37.29504496314512F/255.0F, 0.00000000000000F/255.0F), 0.00001F) == true);
6700 BOOST_TEST_CHECK(eColor.setRGBfromColorSpace(mjr::colorRGB32F::colorSpaceEnum::XYZ, 0.0, 0.0, 1.0).isCloseRGB(fColor.setChansRGB( 0.00000000000000F/255.0F, 1.36725900000000F/255.0F, 26.38515827433519F/255.0F), 0.00001F) == true);
6701 BOOST_TEST_CHECK(eColor.setRGBfromColorSpace(mjr::colorRGB32F::colorSpaceEnum::XYZ, 1.0, 1.0, 0.0).isCloseRGB(fColor.setChansRGB(35.27435545247001F/255.0F, 23.88691519243730F/255.0F, 0.00000000000000F/255.0F), 0.00001F) == true);
6702 BOOST_TEST_CHECK(eColor.setRGBfromColorSpace(mjr::colorRGB32F::colorSpaceEnum::XYZ, 1.0, 0.0, 1.0).isCloseRGB(fColor.setChansRGB(46.09063114907088F/255.0F, 0.00000000000000F/255.0F, 27.25916547197178F/255.0F), 0.00001F) == true);
6703 BOOST_TEST_CHECK(eColor.setRGBfromColorSpace(mjr::colorRGB32F::colorSpaceEnum::XYZ, 0.0, 1.0, 1.0).isCloseRGB(fColor.setChansRGB( 0.00000000000000F/255.0F, 37.76511040594671F/255.0F, 22.93126475355600F/255.0F), 0.00001F) == true);
6704
6705 ////////////////////////////////////////////////////////////////////////////////
6706 // 0-100 0-100 0-360
6707 // 0.0, 0.0, 0.0 0.00000000000000, 0.00000000000000, 0.00000000000000
6708 // 0.0, 100.0, 0.0 96.73833014676526, 0.00000000000000, 6.73101465756404
6709 // 0.0, 50.0, 0.0 57.41225747257089, 0.00000000000000, 2.34936006058456
6710 // 0.0, 0.0, 180.0 0.00000000000000, 0.00000000000000, 0.00000000000000
6711 // 0.0, 50.0, 180.0 0.00000000000000, 28.32099136175329, 0.00000000000000
6712 // 50.0, 50.0, 180.0 0.00000000000000, 139.16169169667540, 117.60474230139480
6713 // 100.0, 100.0, 360.0 255.00000000000000, 155.40224018978810, 255.00000000000000
6714 // 100.0, 100.0, 180.0 0.00000000000000, 255.00000000000000, 252.06306109593692
6715 // 100.0, 100.0, 60.0 255.00000000000000, 211.98994181103800, 78.02765922273178
6716
6717 BOOST_TEST_CHECK(aColor.setRGBfromColorSpace(mjr::colorRGB8b::colorSpaceEnum::LCH, 0.0, 0.0, 0.0).isEqualRGB(bColor.setChansRGB( 0, 0, 0)) == true);
6718 BOOST_TEST_CHECK(aColor.setRGBfromColorSpace(mjr::colorRGB8b::colorSpaceEnum::LCH, 0.0, 100.0, 0.0).isEqualRGB(bColor.setChansRGB( 96, 0, 6)) == true);
6719 BOOST_TEST_CHECK(aColor.setRGBfromColorSpace(mjr::colorRGB8b::colorSpaceEnum::LCH, 0.0, 50.0, 0.0).isEqualRGB(bColor.setChansRGB( 57, 0, 2)) == true);
6720 BOOST_TEST_CHECK(aColor.setRGBfromColorSpace(mjr::colorRGB8b::colorSpaceEnum::LCH, 0.0, 0.0, 180.0).isEqualRGB(bColor.setChansRGB( 0, 0, 0)) == true);
6721 BOOST_TEST_CHECK(aColor.setRGBfromColorSpace(mjr::colorRGB8b::colorSpaceEnum::LCH, 0.0, 50.0, 180.0).isEqualRGB(bColor.setChansRGB( 0, 28, 0)) == true);
6722 BOOST_TEST_CHECK(aColor.setRGBfromColorSpace(mjr::colorRGB8b::colorSpaceEnum::LCH, 50.0, 50.0, 180.0).isEqualRGB(bColor.setChansRGB( 0, 139, 117)) == true);
6723 BOOST_TEST_CHECK(aColor.setRGBfromColorSpace(mjr::colorRGB8b::colorSpaceEnum::LCH, 100.0, 100.0, 360.0).isEqualRGB(bColor.setChansRGB(255, 155, 255)) == true);
6724 BOOST_TEST_CHECK(aColor.setRGBfromColorSpace(mjr::colorRGB8b::colorSpaceEnum::LCH, 100.0, 100.0, 180.0).isEqualRGB(bColor.setChansRGB( 0, 255, 252)) == true);
6725 BOOST_TEST_CHECK(aColor.setRGBfromColorSpace(mjr::colorRGB8b::colorSpaceEnum::LCH, 100.0, 100.0, 60.0).isEqualRGB(bColor.setChansRGB(255, 211, 78)) == true);
6726
6727 BOOST_TEST_CHECK(eColor.setRGBfromColorSpace(mjr::colorRGB32F::colorSpaceEnum::LCH, 0.0, 0.0, 0.0).isCloseRGB(fColor.setChansRGB( 0.00000000000000F/255.0F, 0.00000000000000F/255.0F, 0.00000000000000F/255.0F), 0.00001F) == true);
6728 BOOST_TEST_CHECK(eColor.setRGBfromColorSpace(mjr::colorRGB32F::colorSpaceEnum::LCH, 0.0, 100.0, 0.0).isCloseRGB(fColor.setChansRGB( 96.73833014676526F/255.0F, 0.00000000000000F/255.0F, 6.73101465756404F/255.0F), 0.00001F) == true);
6729 BOOST_TEST_CHECK(eColor.setRGBfromColorSpace(mjr::colorRGB32F::colorSpaceEnum::LCH, 0.0, 50.0, 0.0).isCloseRGB(fColor.setChansRGB( 57.41225747257089F/255.0F, 0.00000000000000F/255.0F, 2.34936006058456F/255.0F), 0.00001F) == true);
6730 BOOST_TEST_CHECK(eColor.setRGBfromColorSpace(mjr::colorRGB32F::colorSpaceEnum::LCH, 0.0, 0.0, 180.0).isCloseRGB(fColor.setChansRGB( 0.00000000000000F/255.0F, 0.00000000000000F/255.0F, 0.00000000000000F/255.0F), 0.00001F) == true);
6731 BOOST_TEST_CHECK(eColor.setRGBfromColorSpace(mjr::colorRGB32F::colorSpaceEnum::LCH, 0.0, 50.0, 180.0).isCloseRGB(fColor.setChansRGB( 0.00000000000000F/255.0F, 28.32099136175329F/255.0F, 0.00000000000000F/255.0F), 0.00001F) == true);
6732 BOOST_TEST_CHECK(eColor.setRGBfromColorSpace(mjr::colorRGB32F::colorSpaceEnum::LCH, 50.0, 50.0, 180.0).isCloseRGB(fColor.setChansRGB( 0.00000000000000F/255.0F, 139.16169169667540F/255.0F, 117.60474230139480F/255.0F), 0.00001F) == true);
6733 BOOST_TEST_CHECK(eColor.setRGBfromColorSpace(mjr::colorRGB32F::colorSpaceEnum::LCH, 100.0, 100.0, 360.0).isCloseRGB(fColor.setChansRGB(255.00000000000000F/255.0F, 155.40224018978810F/255.0F, 255.00000000000000F/255.0F), 0.00001F) == true);
6734 BOOST_TEST_CHECK(eColor.setRGBfromColorSpace(mjr::colorRGB32F::colorSpaceEnum::LCH, 100.0, 100.0, 180.0).isCloseRGB(fColor.setChansRGB( 0.00000000000000F/255.0F, 255.00000000000000F/255.0F, 252.06306109593692F/255.0F), 0.00001F) == true);
6735 BOOST_TEST_CHECK(eColor.setRGBfromColorSpace(mjr::colorRGB32F::colorSpaceEnum::LCH, 100.0, 100.0, 60.0).isCloseRGB(fColor.setChansRGB(255.00000000000000F/255.0F, 211.98994181103800F/255.0F, 78.02765922273178F/255.0F), 0.00001F) == true);
6736}
6737
6738////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
6739BOOST_AUTO_TEST_CASE(csFPcircular12_int) {
6740
6741 mjr::colorRGBA8b aColor;
6742 mjr::colorRGBA32F bColor;
6743
6744////////////////////////////////////////////////////////////////////////////////
6745
6746 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c( 0).isEqualRGB(aColor.setChansRGB(0xFF, 0x00, 0x00)));
6747 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c( 1).isEqualRGB(aColor.setChansRGB(0xFF, 0x7D, 0x00)));
6748 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c( 2).isEqualRGB(aColor.setChansRGB(0xFF, 0xFF, 0x00)));
6749 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c( 3).isEqualRGB(aColor.setChansRGB(0x7D, 0xFF, 0x00)));
6750 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c( 4).isEqualRGB(aColor.setChansRGB(0x66, 0xCC, 0x00)));
6751 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c( 5).isEqualRGB(aColor.setChansRGB(0x66, 0xFF, 0xB2)));
6752 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c( 6).isEqualRGB(aColor.setChansRGB(0x00, 0xFF, 0xFF)));
6753 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c( 7).isEqualRGB(aColor.setChansRGB(0x00, 0x7D, 0xFF)));
6754 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c( 8).isEqualRGB(aColor.setChansRGB(0x00, 0x00, 0xFF)));
6755 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c( 9).isEqualRGB(aColor.setChansRGB(0x7D, 0x00, 0xFF)));
6756 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c(10).isEqualRGB(aColor.setChansRGB(0xFF, 0x00, 0xFF)));
6757 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c(11).isEqualRGB(aColor.setChansRGB(0xFF, 0x00, 0x7D)));
6758
6759////////////////////////////////////////////////////////////////////////////////
6760
6761 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c(12).isEqualRGB(aColor.setChansRGB(0xFF, 0x00, 0x00))); // wrap
6762 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c(13).isEqualRGB(aColor.setChansRGB(0xFF, 0x7D, 0x00)));
6763 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c(14).isEqualRGB(aColor.setChansRGB(0xFF, 0xFF, 0x00)));
6764 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c(15).isEqualRGB(aColor.setChansRGB(0x7D, 0xFF, 0x00)));
6765 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c(16).isEqualRGB(aColor.setChansRGB(0x66, 0xCC, 0x00)));
6766 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c(17).isEqualRGB(aColor.setChansRGB(0x66, 0xFF, 0xB2)));
6767 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c(18).isEqualRGB(aColor.setChansRGB(0x00, 0xFF, 0xFF)));
6768 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c(19).isEqualRGB(aColor.setChansRGB(0x00, 0x7D, 0xFF)));
6769 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c(20).isEqualRGB(aColor.setChansRGB(0x00, 0x00, 0xFF)));
6770 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c(21).isEqualRGB(aColor.setChansRGB(0x7D, 0x00, 0xFF)));
6771 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c(22).isEqualRGB(aColor.setChansRGB(0xFF, 0x00, 0xFF)));
6772 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c(23).isEqualRGB(aColor.setChansRGB(0xFF, 0x00, 0x7D)));
6773
6774////////////////////////////////////////////////////////////////////////////////
6775
6776 aColor.setToBlack();
6777 mjr::colorRGBA8b::csFPcircular12::c(aColor, 0);
6778 BOOST_TEST_CHECK(aColor.getRed() == 0xFF);
6779 BOOST_TEST_CHECK(aColor.getGreen() == 0x00);
6780 BOOST_TEST_CHECK(aColor.getBlue() == 0x00);
6781 BOOST_TEST_CHECK(aColor.getAlpha() == mjr::colorRGBA8b::minChanVal); // Not set!
6782
6783 aColor.setToWhite();
6784 mjr::colorRGBA8b::csFPcircular12::c(aColor, 0);
6785 BOOST_TEST_CHECK(aColor.getRed() == 0xFF);
6786 BOOST_TEST_CHECK(aColor.getGreen() == 0x00);
6787 BOOST_TEST_CHECK(aColor.getBlue() == 0x00);
6788 BOOST_TEST_CHECK(aColor.getAlpha() == mjr::colorRGBA8b::maxChanVal); // Not set!
6789
6790////////////////////////////////////////////////////////////////////////////////
6791
6792 BOOST_TEST_CHECK(mjr::colorRGBA32F::csFPcircular12::c( 0).isCloseRGB(bColor.setChansRGB(0xFF/255.0F, 0x00/255.0F, 0x00/255.0F), 0.00001F));
6793 BOOST_TEST_CHECK(mjr::colorRGBA32F::csFPcircular12::c( 1).isCloseRGB(bColor.setChansRGB(0xFF/255.0F, 0x7D/255.0F, 0x00/255.0F), 0.00001F));
6794 BOOST_TEST_CHECK(mjr::colorRGBA32F::csFPcircular12::c( 2).isCloseRGB(bColor.setChansRGB(0xFF/255.0F, 0xFF/255.0F, 0x00/255.0F), 0.00001F));
6795 BOOST_TEST_CHECK(mjr::colorRGBA32F::csFPcircular12::c( 3).isCloseRGB(bColor.setChansRGB(0x7D/255.0F, 0xFF/255.0F, 0x00/255.0F), 0.00001F));
6796 BOOST_TEST_CHECK(mjr::colorRGBA32F::csFPcircular12::c( 4).isCloseRGB(bColor.setChansRGB(0x66/255.0F, 0xCC/255.0F, 0x00/255.0F), 0.00001F));
6797 BOOST_TEST_CHECK(mjr::colorRGBA32F::csFPcircular12::c( 5).isCloseRGB(bColor.setChansRGB(0x66/255.0F, 0xFF/255.0F, 0xB2/255.0F), 0.00001F));
6798 BOOST_TEST_CHECK(mjr::colorRGBA32F::csFPcircular12::c( 6).isCloseRGB(bColor.setChansRGB(0x00/255.0F, 0xFF/255.0F, 0xFF/255.0F), 0.00001F));
6799 BOOST_TEST_CHECK(mjr::colorRGBA32F::csFPcircular12::c( 7).isCloseRGB(bColor.setChansRGB(0x00/255.0F, 0x7D/255.0F, 0xFF/255.0F), 0.00001F));
6800 BOOST_TEST_CHECK(mjr::colorRGBA32F::csFPcircular12::c( 8).isCloseRGB(bColor.setChansRGB(0x00/255.0F, 0x00/255.0F, 0xFF/255.0F), 0.00001F));
6801 BOOST_TEST_CHECK(mjr::colorRGBA32F::csFPcircular12::c( 9).isCloseRGB(bColor.setChansRGB(0x7D/255.0F, 0x00/255.0F, 0xFF/255.0F), 0.00001F));
6802 BOOST_TEST_CHECK(mjr::colorRGBA32F::csFPcircular12::c(10).isCloseRGB(bColor.setChansRGB(0xFF/255.0F, 0x00/255.0F, 0xFF/255.0F), 0.00001F));
6803 BOOST_TEST_CHECK(mjr::colorRGBA32F::csFPcircular12::c(11).isCloseRGB(bColor.setChansRGB(0xFF/255.0F, 0x00/255.0F, 0x7D/255.0F), 0.00001F));
6804
6805////////////////////////////////////////////////////////////////////////////////
6806
6807 bColor.setToBlack();
6808 mjr::colorRGBA32F::csCBSpectral::c(bColor, 0);
6809 BOOST_TEST_CHECK(bColor.getAlpha() == mjr::colorRGBA32F::minChanVal); // Not set!
6810
6811 bColor.setToWhite();
6812 mjr::colorRGBA32F::csCBSpectral::c(bColor, 0);
6813 BOOST_TEST_CHECK(bColor.getAlpha() == mjr::colorRGBA32F::maxChanVal); // Not set!
6814
6815}
6816
6817////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
6818BOOST_AUTO_TEST_CASE(csFPcircular12_flt) {
6819
6820 mjr::colorRGBA8b aColor;
6821 mjr::colorRGBA32F bColor;
6822
6823////////////////////////////////////////////////////////////////////////////////
6824
6825 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c( 0/11.0F).isCloseRGB(aColor.setChansRGB(0xFF, 0x00, 0x00), 2));
6826 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c( 1/11.0F).isCloseRGB(aColor.setChansRGB(0xFF, 0x7D, 0x00), 2));
6827 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c( 2/11.0F).isCloseRGB(aColor.setChansRGB(0xFF, 0xFF, 0x00), 2));
6828 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c( 3/11.0F).isCloseRGB(aColor.setChansRGB(0x7D, 0xFF, 0x00), 2));
6829 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c( 4/11.0F).isCloseRGB(aColor.setChansRGB(0x66, 0xCC, 0x00), 2));
6830 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c( 5/11.0F).isCloseRGB(aColor.setChansRGB(0x66, 0xFF, 0xB2), 2));
6831 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c( 6/11.0F).isCloseRGB(aColor.setChansRGB(0x00, 0xFF, 0xFF), 2));
6832 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c( 7/11.0F).isCloseRGB(aColor.setChansRGB(0x00, 0x7D, 0xFF), 2));
6833 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c( 8/11.0F).isCloseRGB(aColor.setChansRGB(0x00, 0x00, 0xFF), 2));
6834 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c( 9/11.0F).isCloseRGB(aColor.setChansRGB(0x7D, 0x00, 0xFF), 2));
6835 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c(10/11.0F).isCloseRGB(aColor.setChansRGB(0xFF, 0x00, 0xFF), 2));
6836 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c(11/11.0F).isCloseRGB(aColor.setChansRGB(0xFF, 0x00, 0x7D), 2));
6837
6838////////////////////////////////////////////////////////////////////////////////
6839
6840 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c(1+ 1/11.0F).isCloseRGB(aColor.setChansRGB(0xFF, 0x7D, 0x00), 2)); // wrap
6841 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c(1+ 2/11.0F).isCloseRGB(aColor.setChansRGB(0xFF, 0xFF, 0x00), 2));
6842 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c(1+ 3/11.0F).isCloseRGB(aColor.setChansRGB(0x7D, 0xFF, 0x00), 2));
6843 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c(1+ 4/11.0F).isCloseRGB(aColor.setChansRGB(0x66, 0xCC, 0x00), 2));
6844 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c(1+ 5/11.0F).isCloseRGB(aColor.setChansRGB(0x66, 0xFF, 0xB2), 2));
6845 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c(1+ 6/11.0F).isCloseRGB(aColor.setChansRGB(0x00, 0xFF, 0xFF), 2));
6846 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c(1+ 7/11.0F).isCloseRGB(aColor.setChansRGB(0x00, 0x7D, 0xFF), 2));
6847 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c(1+ 8/11.0F).isCloseRGB(aColor.setChansRGB(0x00, 0x00, 0xFF), 2));
6848 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c(1+ 9/11.0F).isCloseRGB(aColor.setChansRGB(0x7D, 0x00, 0xFF), 2));
6849 BOOST_TEST_CHECK(mjr::colorRGBA8b::csFPcircular12::c(1+10/11.0F).isCloseRGB(aColor.setChansRGB(0xFF, 0x00, 0xFF), 2));
6850
6851////////////////////////////////////////////////////////////////////////////////
6852
6853 aColor.setToBlack();
6854 mjr::colorRGBA8b::csFPcircular12::c(aColor, 0.0F);
6855 BOOST_TEST_CHECK(aColor.getRed() == 0xFF);
6856 BOOST_TEST_CHECK(aColor.getGreen() == 0x00);
6857 BOOST_TEST_CHECK(aColor.getBlue() == 0x00);
6858 BOOST_TEST_CHECK(aColor.getAlpha() == mjr::colorRGBA8b::minChanVal); // Not set!
6859
6860 aColor.setToWhite();
6861 mjr::colorRGBA8b::csFPcircular12::c(aColor, 0.0F);
6862 BOOST_TEST_CHECK(aColor.getRed() == 0xFF);
6863 BOOST_TEST_CHECK(aColor.getGreen() == 0x00);
6864 BOOST_TEST_CHECK(aColor.getBlue() == 0x00);
6865 BOOST_TEST_CHECK(aColor.getAlpha() == mjr::colorRGBA8b::maxChanVal); // Not set!
6866
6867////////////////////////////////////////////////////////////////////////////////
6868
6869 BOOST_TEST_CHECK(mjr::colorRGBA32F::csFPcircular12::c( 0/11.0F).isCloseRGB(bColor.setChansRGB(0xFF/255.0F, 0x00/255.0F, 0x00/255.0F), 0.00001F));
6870 BOOST_TEST_CHECK(mjr::colorRGBA32F::csFPcircular12::c( 1/11.0F).isCloseRGB(bColor.setChansRGB(0xFF/255.0F, 0x7D/255.0F, 0x00/255.0F), 0.00001F));
6871 BOOST_TEST_CHECK(mjr::colorRGBA32F::csFPcircular12::c( 2/11.0F).isCloseRGB(bColor.setChansRGB(0xFF/255.0F, 0xFF/255.0F, 0x00/255.0F), 0.00001F));
6872 BOOST_TEST_CHECK(mjr::colorRGBA32F::csFPcircular12::c( 3/11.0F).isCloseRGB(bColor.setChansRGB(0x7D/255.0F, 0xFF/255.0F, 0x00/255.0F), 0.00001F));
6873 BOOST_TEST_CHECK(mjr::colorRGBA32F::csFPcircular12::c( 4/11.0F).isCloseRGB(bColor.setChansRGB(0x66/255.0F, 0xCC/255.0F, 0x00/255.0F), 0.00001F));
6874 BOOST_TEST_CHECK(mjr::colorRGBA32F::csFPcircular12::c( 5/11.0F).isCloseRGB(bColor.setChansRGB(0x66/255.0F, 0xFF/255.0F, 0xB2/255.0F), 0.00001F));
6875 BOOST_TEST_CHECK(mjr::colorRGBA32F::csFPcircular12::c( 6/11.0F).isCloseRGB(bColor.setChansRGB(0x00/255.0F, 0xFF/255.0F, 0xFF/255.0F), 0.00001F));
6876 BOOST_TEST_CHECK(mjr::colorRGBA32F::csFPcircular12::c( 7/11.0F).isCloseRGB(bColor.setChansRGB(0x00/255.0F, 0x7D/255.0F, 0xFF/255.0F), 0.00001F));
6877 BOOST_TEST_CHECK(mjr::colorRGBA32F::csFPcircular12::c( 8/11.0F).isCloseRGB(bColor.setChansRGB(0x00/255.0F, 0x00/255.0F, 0xFF/255.0F), 0.00001F));
6878 BOOST_TEST_CHECK(mjr::colorRGBA32F::csFPcircular12::c( 9/11.0F).isCloseRGB(bColor.setChansRGB(0x7D/255.0F, 0x00/255.0F, 0xFF/255.0F), 0.00001F));
6879 BOOST_TEST_CHECK(mjr::colorRGBA32F::csFPcircular12::c(10/11.0F).isCloseRGB(bColor.setChansRGB(0xFF/255.0F, 0x00/255.0F, 0xFF/255.0F), 0.00001F));
6880 BOOST_TEST_CHECK(mjr::colorRGBA32F::csFPcircular12::c(11/11.0F).isCloseRGB(bColor.setChansRGB(0xFF/255.0F, 0x00/255.0F, 0x7D/255.0F), 0.00001F));
6881
6882////////////////////////////////////////////////////////////////////////////////
6883
6884 bColor.setToBlack();
6885 mjr::colorRGBA32F::csCBSpectral::c(bColor, 0.0F);
6886 BOOST_TEST_CHECK(bColor.getAlpha() == mjr::colorRGBA32F::minChanVal); // Not set!
6887
6888 bColor.setToWhite();
6889 mjr::colorRGBA32F::csCBSpectral::c(bColor, 0.0F);
6890 BOOST_TEST_CHECK(bColor.getAlpha() == mjr::colorRGBA32F::maxChanVal); // Not set!
6891}
6892
6893////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
6894BOOST_AUTO_TEST_CASE(rgb2colorSpace) {
6895
6896 mjr::colorRGB8b aColor;
6897 mjr::colorRGB8b::colConDbl3 bColor;
6898 mjr::colorRGB32F cColor;
6899 mjr::colorRGB32F::colConDbl3 dColor;
6900 mjr::colorRGB16b eColor;
6901 mjr::colorRGB16b::colConDbl3 fColor;
6902 mjr::colorRGB32b gColor;
6903 mjr::colorRGB32b::colConDbl3 hColor;
6904
6905 ////////////////////////////////////////////////////////////////////////////////
6906
6907 aColor.setChansRGB(mjr::colorRGB8b::minChanVal, mjr::colorRGB8b::meanChanVal, mjr::colorRGB8b::maxChanVal);
6908 bColor = aColor.rgb2colorSpace(mjr::colorRGB8b::colorSpaceEnum::RGB);
6909 BOOST_TEST_CHECK(bColor.getC0() == 0.0, boost::test_tools::tolerance(0.00001));
6910 BOOST_TEST_CHECK(bColor.getC1() == 0.5, boost::test_tools::tolerance(0.01)); // Can't get much accuracy with 8-bit
6911 BOOST_TEST_CHECK(bColor.getC2() == 1.0, boost::test_tools::tolerance(0.00001));
6912
6913 eColor.setChansRGB(mjr::colorRGB16b::minChanVal, mjr::colorRGB16b::meanChanVal, mjr::colorRGB16b::maxChanVal);
6914 fColor = eColor.rgb2colorSpace(mjr::colorRGB16b::colorSpaceEnum::RGB);
6915 BOOST_TEST_CHECK(fColor.getC0() == 0.0, boost::test_tools::tolerance(0.00001));
6916 BOOST_TEST_CHECK(fColor.getC1() == 0.5, boost::test_tools::tolerance(0.0001)); // A bit more accuracy with 16-bit
6917 BOOST_TEST_CHECK(fColor.getC2() == 1.0, boost::test_tools::tolerance(0.00001));
6918
6919 gColor.setChansRGB(mjr::colorRGB32b::minChanVal, mjr::colorRGB32b::meanChanVal, mjr::colorRGB32b::maxChanVal);
6920 hColor = gColor.rgb2colorSpace(mjr::colorRGB32b::colorSpaceEnum::RGB);
6921 BOOST_TEST_CHECK(hColor.getC0() == 0.0, boost::test_tools::tolerance(0.00001));
6922 BOOST_TEST_CHECK(hColor.getC1() == 0.5, boost::test_tools::tolerance(0.00001)); // A bit more accuracy with 32-bit
6923 BOOST_TEST_CHECK(hColor.getC2() == 1.0, boost::test_tools::tolerance(0.00001));
6924
6925 ////////////////////////////////////////////////////////////////////////////////
6926
6927 // 0.00000000000000 0.5000000000000000 1.00000000000000000 RGB
6928 // 210.11764705181122 1.0000000000000000 0.50000000000000000 HSL
6929 // 210.11764705181122 1.0000000000000000 1.00000000000000000 HSV
6930 // 54.58302990500775 19.1017817806751750 -71.14430025970830000 LAB
6931 // 25.704111183644635 22.5282223672892700 97.60137039454821000 XYZ
6932 // 54.58302990500775 73.6640314308147600 285.02909316255295000 LCH
6933
6934 cColor.setChansRGB(mjr::colorRGB32F::minChanVal, mjr::colorRGB32F::meanChanVal, mjr::colorRGB32F::maxChanVal);
6935
6936 dColor = cColor.rgb2colorSpace(mjr::colorRGB32F::colorSpaceEnum::RGB);
6937 BOOST_TEST_CHECK(dColor.getC0() == 0.000000000000000, boost::test_tools::tolerance(0.00001));
6938 BOOST_TEST_CHECK(dColor.getC1() == 0.500000000000000, boost::test_tools::tolerance(0.00001));
6939 BOOST_TEST_CHECK(dColor.getC2() == 1.000000000000000, boost::test_tools::tolerance(0.00001));
6940
6941 dColor = cColor.rgb2colorSpace(mjr::colorRGB32F::colorSpaceEnum::HSL);
6942 BOOST_TEST_CHECK(dColor.getC0() == 210.000000000000000, boost::test_tools::tolerance(0.00001));
6943 BOOST_TEST_CHECK(dColor.getC1() == 1.000000000000000, boost::test_tools::tolerance(0.00001));
6944 BOOST_TEST_CHECK(dColor.getC2() == 0.500000000000000, boost::test_tools::tolerance(0.00001));
6945
6946 dColor = cColor.rgb2colorSpace(mjr::colorRGB32F::colorSpaceEnum::HSV);
6947 BOOST_TEST_CHECK(dColor.getC0() == 210.000000000000000, boost::test_tools::tolerance(0.00001));
6948 BOOST_TEST_CHECK(dColor.getC1() == 1.000000000000000, boost::test_tools::tolerance(0.00001));
6949 BOOST_TEST_CHECK(dColor.getC2() == 1.000000000000000, boost::test_tools::tolerance(0.00001));
6950
6951 dColor = cColor.rgb2colorSpace(mjr::colorRGB32F::colorSpaceEnum::LAB);
6952 BOOST_TEST_CHECK(dColor.getC0() == 54.583029905007749, boost::test_tools::tolerance(0.00001));
6953 BOOST_TEST_CHECK(dColor.getC1() == 19.106431157445371, boost::test_tools::tolerance(0.00001));
6954 BOOST_TEST_CHECK(dColor.getC2() == -71.140167945193781, boost::test_tools::tolerance(0.00001));
6955
6956 dColor = cColor.rgb2colorSpace(mjr::colorRGB32F::colorSpaceEnum::XYZ);
6957 BOOST_TEST_CHECK(dColor.getC0() == 25.704111183644635, boost::test_tools::tolerance(0.00001));
6958 BOOST_TEST_CHECK(dColor.getC1() == 22.528222367289271, boost::test_tools::tolerance(0.00001));
6959 BOOST_TEST_CHECK(dColor.getC2() == 97.601370394548212, boost::test_tools::tolerance(0.00001));
6960
6961 dColor = cColor.rgb2colorSpace(mjr::colorRGB32F::colorSpaceEnum::LCH);
6962 BOOST_TEST_CHECK(dColor.getC0() == 54.583029905007749, boost::test_tools::tolerance(0.00001));
6963 BOOST_TEST_CHECK(dColor.getC1() == 73.661246302547553, boost::test_tools::tolerance(0.00001));
6964 BOOST_TEST_CHECK(dColor.getC2() == 285.033419356169360, boost::test_tools::tolerance(0.00001));
6965
6966 ////////////////////////////////////////////////////////////////////////////////
6967
6968 // 0.400000000000000 0.6000000000000000 0.800000000000000 RGB
6969 // 209.999996870756100 0.4999999962747098 0.600000002980232 HSL
6970 // 209.999996870756100 0.5000000000000000 0.800000000000000 HSV
6971 // 61.625634479116870 -2.8148222106305076 -31.439123763222420 LAB
6972 // 27.769805832971585 29.9668794742762760 61.447302014049825 XYZ
6973 // 61.625634479116870 31.5648812302006830 264.883809161551100 LCH
6974
6975 cColor.setChansRGB_dbl(0.4, 0.6, 0.8);
6976
6977 dColor = cColor.rgb2colorSpace(mjr::colorRGB32F::colorSpaceEnum::RGB);
6978 BOOST_TEST_CHECK(dColor.getC0() == 0.400000000000000, boost::test_tools::tolerance(0.00001));
6979 BOOST_TEST_CHECK(dColor.getC1() == 0.6000000000000000, boost::test_tools::tolerance(0.00001));
6980 BOOST_TEST_CHECK(dColor.getC2() == 0.800000000000000, boost::test_tools::tolerance(0.00001));
6981
6982 dColor = cColor.rgb2colorSpace(mjr::colorRGB32F::colorSpaceEnum::HSL);
6983 BOOST_TEST_CHECK(dColor.getC0() == 209.999996870756100, boost::test_tools::tolerance(0.00001));
6984 BOOST_TEST_CHECK(dColor.getC1() == 0.4999999962747098, boost::test_tools::tolerance(0.00001));
6985 BOOST_TEST_CHECK(dColor.getC2() == 0.600000002980232, boost::test_tools::tolerance(0.00001));
6986
6987 dColor = cColor.rgb2colorSpace(mjr::colorRGB32F::colorSpaceEnum::HSV);
6988 BOOST_TEST_CHECK(dColor.getC0() == 209.999996870756100, boost::test_tools::tolerance(0.00001));
6989 BOOST_TEST_CHECK(dColor.getC1() == 0.5000000000000000, boost::test_tools::tolerance(0.00001));
6990 BOOST_TEST_CHECK(dColor.getC2() == 0.800000000000000, boost::test_tools::tolerance(0.00001));
6991
6992 dColor = cColor.rgb2colorSpace(mjr::colorRGB32F::colorSpaceEnum::LAB);
6993 BOOST_TEST_CHECK(dColor.getC0() == 61.625634479116870, boost::test_tools::tolerance(0.00001));
6994 BOOST_TEST_CHECK(dColor.getC1() == -2.8148222106305076, boost::test_tools::tolerance(0.01)); // MJR TODO NOTE BOOST_AUTO_TEST_CASE: Why? Need to check into the inaccuracy here.
6995 BOOST_TEST_CHECK(dColor.getC2() == -31.439123763222420, boost::test_tools::tolerance(0.01)); // MJR TODO NOTE BOOST_AUTO_TEST_CASE: Why? Need to check into the inaccuracy here.
6996
6997 dColor = cColor.rgb2colorSpace(mjr::colorRGB32F::colorSpaceEnum::XYZ);
6998 BOOST_TEST_CHECK(dColor.getC0() == 27.769805832971585, boost::test_tools::tolerance(0.00001));
6999 BOOST_TEST_CHECK(dColor.getC1() == 29.9668794742762760, boost::test_tools::tolerance(0.00001));
7000 BOOST_TEST_CHECK(dColor.getC2() == 61.447302014049825, boost::test_tools::tolerance(0.00001));
7001
7002 dColor = cColor.rgb2colorSpace(mjr::colorRGB32F::colorSpaceEnum::LCH);
7003 BOOST_TEST_CHECK(dColor.getC0() == 61.625634479116870, boost::test_tools::tolerance(0.00001));
7004 BOOST_TEST_CHECK(dColor.getC1() == 31.5648812302006830, boost::test_tools::tolerance(0.01)); // MJR TODO NOTE BOOST_AUTO_TEST_CASE: Why? Need to check into the inaccuracy here.
7005 BOOST_TEST_CHECK(dColor.getC2() == 264.883809161551100, boost::test_tools::tolerance(0.01)); // MJR TODO NOTE BOOST_AUTO_TEST_CASE: Why? Need to check into the inaccuracy here.
7006}
7007
7008////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7009BOOST_AUTO_TEST_CASE(csBin) {
7010
7011 mjr::colorRGB8b a0Color, a1Color;
7012 mjr::colorRGB32F b0Color, b1Color;
7013
7014 a0Color.setToBlack();
7015 a1Color.setToWhite();
7016
7017 b0Color.setToBlack();
7018 b1Color.setToWhite();
7019
7020 ////////////////////////////////////////////////////////////////////////////////
7021
7022 BOOST_TEST_CHECK(mjr::colorRGB8b::csBin01::c(0).isEqualRGB(a0Color) == true);
7023 BOOST_TEST_CHECK(mjr::colorRGB8b::csBin01::c(2).isEqualRGB(a0Color) == true);
7024 BOOST_TEST_CHECK(mjr::colorRGB8b::csBin01::c(4).isEqualRGB(a0Color) == true);
7025 BOOST_TEST_CHECK(mjr::colorRGB8b::csBin01::c(6).isEqualRGB(a0Color) == true);
7026 BOOST_TEST_CHECK(mjr::colorRGB8b::csBin01::c(8).isEqualRGB(a0Color) == true);
7027
7028 BOOST_TEST_CHECK(mjr::colorRGB8b::csBin01::c(1).isEqualRGB(a1Color) == true);
7029 BOOST_TEST_CHECK(mjr::colorRGB8b::csBin01::c(3).isEqualRGB(a1Color) == true);
7030 BOOST_TEST_CHECK(mjr::colorRGB8b::csBin01::c(5).isEqualRGB(a1Color) == true);
7031 BOOST_TEST_CHECK(mjr::colorRGB8b::csBin01::c(7).isEqualRGB(a1Color) == true);
7032 BOOST_TEST_CHECK(mjr::colorRGB8b::csBin01::c(9).isEqualRGB(a1Color) == true);
7033
7034 ////////////////////////////////////////////////////////////////////////////////
7035
7036 BOOST_TEST_CHECK(mjr::colorRGB32F::csBin01::c(0).isEqualRGB(b0Color) == true);
7037 BOOST_TEST_CHECK(mjr::colorRGB32F::csBin01::c(2).isEqualRGB(b0Color) == true);
7038 BOOST_TEST_CHECK(mjr::colorRGB32F::csBin01::c(4).isEqualRGB(b0Color) == true);
7039 BOOST_TEST_CHECK(mjr::colorRGB32F::csBin01::c(6).isEqualRGB(b0Color) == true);
7040 BOOST_TEST_CHECK(mjr::colorRGB32F::csBin01::c(8).isEqualRGB(b0Color) == true);
7041
7042 BOOST_TEST_CHECK(mjr::colorRGB32F::csBin01::c(1).isEqualRGB(b1Color) == true);
7043 BOOST_TEST_CHECK(mjr::colorRGB32F::csBin01::c(3).isEqualRGB(b1Color) == true);
7044 BOOST_TEST_CHECK(mjr::colorRGB32F::csBin01::c(5).isEqualRGB(b1Color) == true);
7045 BOOST_TEST_CHECK(mjr::colorRGB32F::csBin01::c(7).isEqualRGB(b1Color) == true);
7046 BOOST_TEST_CHECK(mjr::colorRGB32F::csBin01::c(9).isEqualRGB(b1Color) == true);
7047}
7048
7049////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7050BOOST_AUTO_TEST_CASE(setColorCons) {
7051
7052 mjr::colorRGBA8b aColor; // integer color with imperfect mask
7053 mjr::colorRGBA64b bColor; // integer color without mask
7054 mjr::colorRGBA32F cColor; // floating point color with mask
7055 mjr::colorRGBA64F dColor; // floating point color without mask
7056
7057 ////////////////////////////////////////////////////////////////////////////////
7058 aColor.setToWhite();
7059 aColor.setToBlack();
7060 BOOST_TEST_CHECK(aColor.getC0() == aColor.minChanVal);
7061 BOOST_TEST_CHECK(aColor.getC1() == aColor.minChanVal);
7062 BOOST_TEST_CHECK(aColor.getC2() == aColor.minChanVal);
7063 BOOST_TEST_CHECK(aColor.getC3() == aColor.minChanVal);
7064
7065 bColor.setToWhite();
7066 bColor.setToBlack();
7067 BOOST_TEST_CHECK(bColor.getC0() == bColor.minChanVal);
7068 BOOST_TEST_CHECK(bColor.getC1() == bColor.minChanVal);
7069 BOOST_TEST_CHECK(bColor.getC2() == bColor.minChanVal);
7070 BOOST_TEST_CHECK(bColor.getC3() == bColor.minChanVal);
7071
7072 cColor.setToWhite();
7073 cColor.setToBlack();
7074 BOOST_TEST_CHECK(cColor.getC0() == cColor.minChanVal);
7075 BOOST_TEST_CHECK(cColor.getC1() == cColor.minChanVal);
7076 BOOST_TEST_CHECK(cColor.getC2() == cColor.minChanVal);
7077 BOOST_TEST_CHECK(cColor.getC3() == cColor.minChanVal);
7078
7079 dColor.setToWhite();
7080 dColor.setToBlack();
7081 BOOST_TEST_CHECK(dColor.getC0() == dColor.minChanVal);
7082 BOOST_TEST_CHECK(dColor.getC1() == dColor.minChanVal);
7083 BOOST_TEST_CHECK(dColor.getC2() == dColor.minChanVal);
7084 BOOST_TEST_CHECK(dColor.getC3() == dColor.minChanVal);
7085
7086 ////////////////////////////////////////////////////////////////////////////////
7087 aColor.setToBlack();
7088 aColor.setToWhite();
7089 BOOST_TEST_CHECK(aColor.getC0() == aColor.maxChanVal);
7090 BOOST_TEST_CHECK(aColor.getC1() == aColor.maxChanVal);
7091 BOOST_TEST_CHECK(aColor.getC2() == aColor.maxChanVal);
7092 BOOST_TEST_CHECK(aColor.getC3() == aColor.maxChanVal);
7093
7094 bColor.setToBlack();
7095 bColor.setToWhite();
7096 BOOST_TEST_CHECK(bColor.getC0() == bColor.maxChanVal);
7097 BOOST_TEST_CHECK(bColor.getC1() == bColor.maxChanVal);
7098 BOOST_TEST_CHECK(bColor.getC2() == bColor.maxChanVal);
7099 BOOST_TEST_CHECK(bColor.getC3() == bColor.maxChanVal);
7100
7101 cColor.setToBlack();
7102 cColor.setToWhite();
7103 BOOST_TEST_CHECK(cColor.getC0() == cColor.maxChanVal);
7104 BOOST_TEST_CHECK(cColor.getC1() == cColor.maxChanVal);
7105 BOOST_TEST_CHECK(cColor.getC2() == cColor.maxChanVal);
7106 BOOST_TEST_CHECK(cColor.getC3() == cColor.maxChanVal);
7107
7108 dColor.setToBlack();
7109 dColor.setToWhite();
7110 BOOST_TEST_CHECK(dColor.getC0() == dColor.maxChanVal);
7111 BOOST_TEST_CHECK(dColor.getC1() == dColor.maxChanVal);
7112 BOOST_TEST_CHECK(dColor.getC2() == dColor.maxChanVal);
7113 BOOST_TEST_CHECK(dColor.getC3() == dColor.maxChanVal);
7114
7115 ////////////////////////////////////////////////////////////////////////////////
7116 aColor.setToBlack();
7117 aColor.setToRed();
7118 BOOST_TEST_CHECK(aColor.getC0() == aColor.maxChanVal);
7119 BOOST_TEST_CHECK(aColor.getC1() == aColor.minChanVal);
7120 BOOST_TEST_CHECK(aColor.getC2() == aColor.minChanVal);
7121 BOOST_TEST_CHECK(aColor.getC3() == aColor.minChanVal);
7122
7123 bColor.setToBlack();
7124 bColor.setToRed();
7125 BOOST_TEST_CHECK(bColor.getC0() == bColor.maxChanVal);
7126 BOOST_TEST_CHECK(bColor.getC1() == bColor.minChanVal);
7127 BOOST_TEST_CHECK(bColor.getC2() == bColor.minChanVal);
7128 BOOST_TEST_CHECK(bColor.getC3() == bColor.minChanVal);
7129
7130 cColor.setToBlack();
7131 cColor.setToRed();
7132 BOOST_TEST_CHECK(cColor.getC0() == cColor.maxChanVal);
7133 BOOST_TEST_CHECK(cColor.getC1() == cColor.minChanVal);
7134 BOOST_TEST_CHECK(cColor.getC2() == cColor.minChanVal);
7135 BOOST_TEST_CHECK(cColor.getC3() == cColor.minChanVal);
7136
7137 dColor.setToBlack();
7138 dColor.setToRed();
7139 BOOST_TEST_CHECK(dColor.getC0() == dColor.maxChanVal);
7140 BOOST_TEST_CHECK(dColor.getC1() == dColor.minChanVal);
7141 BOOST_TEST_CHECK(dColor.getC2() == dColor.minChanVal);
7142 BOOST_TEST_CHECK(dColor.getC3() == dColor.minChanVal);
7143
7144 ////////////////////////////////////////////////////////////////////////////////
7145 aColor.setToWhite();
7146 aColor.setToRed();
7147 BOOST_TEST_CHECK(aColor.getC0() == aColor.maxChanVal);
7148 BOOST_TEST_CHECK(aColor.getC1() == aColor.minChanVal);
7149 BOOST_TEST_CHECK(aColor.getC2() == aColor.minChanVal);
7150 BOOST_TEST_CHECK(aColor.getC3() == aColor.minChanVal);
7151
7152 bColor.setToWhite();
7153 bColor.setToRed();
7154 BOOST_TEST_CHECK(bColor.getC0() == bColor.maxChanVal);
7155 BOOST_TEST_CHECK(bColor.getC1() == bColor.minChanVal);
7156 BOOST_TEST_CHECK(bColor.getC2() == bColor.minChanVal);
7157 BOOST_TEST_CHECK(bColor.getC3() == bColor.minChanVal);
7158
7159 cColor.setToWhite();
7160 cColor.setToRed();
7161 BOOST_TEST_CHECK(cColor.getC0() == cColor.maxChanVal);
7162 BOOST_TEST_CHECK(cColor.getC1() == cColor.minChanVal);
7163 BOOST_TEST_CHECK(cColor.getC2() == cColor.minChanVal);
7164 BOOST_TEST_CHECK(cColor.getC3() == cColor.minChanVal);
7165
7166 dColor.setToWhite();
7167 dColor.setToRed();
7168 BOOST_TEST_CHECK(dColor.getC0() == dColor.maxChanVal);
7169 BOOST_TEST_CHECK(dColor.getC1() == dColor.minChanVal);
7170 BOOST_TEST_CHECK(dColor.getC2() == dColor.minChanVal);
7171 BOOST_TEST_CHECK(dColor.getC3() == dColor.minChanVal);
7172
7173 ////////////////////////////////////////////////////////////////////////////////
7174 aColor.setToBlack();
7175 aColor.setToGreen();
7176 BOOST_TEST_CHECK(aColor.getC0() == aColor.minChanVal);
7177 BOOST_TEST_CHECK(aColor.getC1() == aColor.maxChanVal);
7178 BOOST_TEST_CHECK(aColor.getC2() == aColor.minChanVal);
7179 BOOST_TEST_CHECK(aColor.getC3() == aColor.minChanVal);
7180
7181 bColor.setToBlack();
7182 bColor.setToGreen();
7183 BOOST_TEST_CHECK(bColor.getC0() == bColor.minChanVal);
7184 BOOST_TEST_CHECK(bColor.getC1() == bColor.maxChanVal);
7185 BOOST_TEST_CHECK(bColor.getC2() == bColor.minChanVal);
7186 BOOST_TEST_CHECK(bColor.getC3() == bColor.minChanVal);
7187
7188 cColor.setToBlack();
7189 cColor.setToGreen();
7190 BOOST_TEST_CHECK(cColor.getC0() == cColor.minChanVal);
7191 BOOST_TEST_CHECK(cColor.getC1() == cColor.maxChanVal);
7192 BOOST_TEST_CHECK(cColor.getC2() == cColor.minChanVal);
7193 BOOST_TEST_CHECK(cColor.getC3() == cColor.minChanVal);
7194
7195 dColor.setToBlack();
7196 dColor.setToGreen();
7197 BOOST_TEST_CHECK(dColor.getC0() == dColor.minChanVal);
7198 BOOST_TEST_CHECK(dColor.getC1() == dColor.maxChanVal);
7199 BOOST_TEST_CHECK(dColor.getC2() == dColor.minChanVal);
7200 BOOST_TEST_CHECK(dColor.getC3() == dColor.minChanVal);
7201
7202 ////////////////////////////////////////////////////////////////////////////////
7203 aColor.setToWhite();
7204 aColor.setToGreen();
7205 BOOST_TEST_CHECK(aColor.getC0() == aColor.minChanVal);
7206 BOOST_TEST_CHECK(aColor.getC1() == aColor.maxChanVal);
7207 BOOST_TEST_CHECK(aColor.getC2() == aColor.minChanVal);
7208 BOOST_TEST_CHECK(aColor.getC3() == aColor.minChanVal);
7209
7210 bColor.setToWhite();
7211 bColor.setToGreen();
7212 BOOST_TEST_CHECK(bColor.getC0() == bColor.minChanVal);
7213 BOOST_TEST_CHECK(bColor.getC1() == bColor.maxChanVal);
7214 BOOST_TEST_CHECK(bColor.getC2() == bColor.minChanVal);
7215 BOOST_TEST_CHECK(bColor.getC3() == bColor.minChanVal);
7216
7217 cColor.setToWhite();
7218 cColor.setToGreen();
7219 BOOST_TEST_CHECK(cColor.getC0() == cColor.minChanVal);
7220 BOOST_TEST_CHECK(cColor.getC1() == cColor.maxChanVal);
7221 BOOST_TEST_CHECK(cColor.getC2() == cColor.minChanVal);
7222 BOOST_TEST_CHECK(cColor.getC3() == cColor.minChanVal);
7223
7224 dColor.setToWhite();
7225 dColor.setToGreen();
7226 BOOST_TEST_CHECK(dColor.getC0() == dColor.minChanVal);
7227 BOOST_TEST_CHECK(dColor.getC1() == dColor.maxChanVal);
7228 BOOST_TEST_CHECK(dColor.getC2() == dColor.minChanVal);
7229 BOOST_TEST_CHECK(dColor.getC3() == dColor.minChanVal);
7230
7231 ////////////////////////////////////////////////////////////////////////////////
7232 aColor.setToBlack();
7233 aColor.setToBlue();
7234 BOOST_TEST_CHECK(aColor.getC0() == aColor.minChanVal);
7235 BOOST_TEST_CHECK(aColor.getC1() == aColor.minChanVal);
7236 BOOST_TEST_CHECK(aColor.getC2() == aColor.maxChanVal);
7237 BOOST_TEST_CHECK(aColor.getC3() == aColor.minChanVal);
7238
7239 bColor.setToBlack();
7240 bColor.setToBlue();
7241 BOOST_TEST_CHECK(bColor.getC0() == bColor.minChanVal);
7242 BOOST_TEST_CHECK(bColor.getC1() == bColor.minChanVal);
7243 BOOST_TEST_CHECK(bColor.getC2() == bColor.maxChanVal);
7244 BOOST_TEST_CHECK(bColor.getC3() == bColor.minChanVal);
7245
7246 cColor.setToBlack();
7247 cColor.setToBlue();
7248 BOOST_TEST_CHECK(cColor.getC0() == cColor.minChanVal);
7249 BOOST_TEST_CHECK(cColor.getC1() == cColor.minChanVal);
7250 BOOST_TEST_CHECK(cColor.getC2() == cColor.maxChanVal);
7251 BOOST_TEST_CHECK(cColor.getC3() == cColor.minChanVal);
7252
7253 dColor.setToBlack();
7254 dColor.setToBlue();
7255 BOOST_TEST_CHECK(dColor.getC0() == dColor.minChanVal);
7256 BOOST_TEST_CHECK(dColor.getC1() == dColor.minChanVal);
7257 BOOST_TEST_CHECK(dColor.getC2() == dColor.maxChanVal);
7258 BOOST_TEST_CHECK(dColor.getC3() == dColor.minChanVal);
7259
7260 ////////////////////////////////////////////////////////////////////////////////
7261 aColor.setToWhite();
7262 aColor.setToBlue();
7263 BOOST_TEST_CHECK(aColor.getC0() == aColor.minChanVal);
7264 BOOST_TEST_CHECK(aColor.getC1() == aColor.minChanVal);
7265 BOOST_TEST_CHECK(aColor.getC2() == aColor.maxChanVal);
7266 BOOST_TEST_CHECK(aColor.getC3() == aColor.minChanVal);
7267
7268 bColor.setToWhite();
7269 bColor.setToBlue();
7270 BOOST_TEST_CHECK(bColor.getC0() == bColor.minChanVal);
7271 BOOST_TEST_CHECK(bColor.getC1() == bColor.minChanVal);
7272 BOOST_TEST_CHECK(bColor.getC2() == bColor.maxChanVal);
7273 BOOST_TEST_CHECK(bColor.getC3() == bColor.minChanVal);
7274
7275 cColor.setToWhite();
7276 cColor.setToBlue();
7277 BOOST_TEST_CHECK(cColor.getC0() == cColor.minChanVal);
7278 BOOST_TEST_CHECK(cColor.getC1() == cColor.minChanVal);
7279 BOOST_TEST_CHECK(cColor.getC2() == cColor.maxChanVal);
7280 BOOST_TEST_CHECK(cColor.getC3() == cColor.minChanVal);
7281
7282 dColor.setToWhite();
7283 dColor.setToBlue();
7284 BOOST_TEST_CHECK(dColor.getC0() == dColor.minChanVal);
7285 BOOST_TEST_CHECK(dColor.getC1() == dColor.minChanVal);
7286 BOOST_TEST_CHECK(dColor.getC2() == dColor.maxChanVal);
7287 BOOST_TEST_CHECK(dColor.getC3() == dColor.minChanVal);
7288
7289 ////////////////////////////////////////////////////////////////////////////////
7290 aColor.setToBlack();
7291 aColor.setToCyan();
7292 BOOST_TEST_CHECK(aColor.getC0() == aColor.minChanVal);
7293 BOOST_TEST_CHECK(aColor.getC1() == aColor.maxChanVal);
7294 BOOST_TEST_CHECK(aColor.getC2() == aColor.maxChanVal);
7295 BOOST_TEST_CHECK(aColor.getC3() == aColor.maxChanVal);
7296
7297 bColor.setToBlack();
7298 bColor.setToCyan();
7299 BOOST_TEST_CHECK(bColor.getC0() == bColor.minChanVal);
7300 BOOST_TEST_CHECK(bColor.getC1() == bColor.maxChanVal);
7301 BOOST_TEST_CHECK(bColor.getC2() == bColor.maxChanVal);
7302 BOOST_TEST_CHECK(bColor.getC3() == bColor.maxChanVal);
7303
7304 cColor.setToBlack();
7305 cColor.setToCyan();
7306 BOOST_TEST_CHECK(cColor.getC0() == cColor.minChanVal);
7307 BOOST_TEST_CHECK(cColor.getC1() == cColor.maxChanVal);
7308 BOOST_TEST_CHECK(cColor.getC2() == cColor.maxChanVal);
7309 BOOST_TEST_CHECK(cColor.getC3() == cColor.maxChanVal);
7310
7311 dColor.setToBlack();
7312 dColor.setToCyan();
7313 BOOST_TEST_CHECK(dColor.getC0() == dColor.minChanVal);
7314 BOOST_TEST_CHECK(dColor.getC1() == dColor.maxChanVal);
7315 BOOST_TEST_CHECK(dColor.getC2() == dColor.maxChanVal);
7316 BOOST_TEST_CHECK(dColor.getC3() == dColor.maxChanVal);
7317
7318 ////////////////////////////////////////////////////////////////////////////////
7319 aColor.setToWhite();
7320 aColor.setToCyan();
7321 BOOST_TEST_CHECK(aColor.getC0() == aColor.minChanVal);
7322 BOOST_TEST_CHECK(aColor.getC1() == aColor.maxChanVal);
7323 BOOST_TEST_CHECK(aColor.getC2() == aColor.maxChanVal);
7324 BOOST_TEST_CHECK(aColor.getC3() == aColor.maxChanVal);
7325
7326 bColor.setToWhite();
7327 bColor.setToCyan();
7328 BOOST_TEST_CHECK(bColor.getC0() == bColor.minChanVal);
7329 BOOST_TEST_CHECK(bColor.getC1() == bColor.maxChanVal);
7330 BOOST_TEST_CHECK(bColor.getC2() == bColor.maxChanVal);
7331 BOOST_TEST_CHECK(bColor.getC3() == bColor.maxChanVal);
7332
7333 cColor.setToWhite();
7334 cColor.setToCyan();
7335 BOOST_TEST_CHECK(cColor.getC0() == cColor.minChanVal);
7336 BOOST_TEST_CHECK(cColor.getC1() == cColor.maxChanVal);
7337 BOOST_TEST_CHECK(cColor.getC2() == cColor.maxChanVal);
7338 BOOST_TEST_CHECK(cColor.getC3() == cColor.maxChanVal);
7339
7340 dColor.setToWhite();
7341 dColor.setToCyan();
7342 BOOST_TEST_CHECK(dColor.getC0() == dColor.minChanVal);
7343 BOOST_TEST_CHECK(dColor.getC1() == dColor.maxChanVal);
7344 BOOST_TEST_CHECK(dColor.getC2() == dColor.maxChanVal);
7345 BOOST_TEST_CHECK(dColor.getC3() == dColor.maxChanVal);
7346
7347 ////////////////////////////////////////////////////////////////////////////////
7348 aColor.setToBlack();
7349 aColor.setToMagenta();
7350 BOOST_TEST_CHECK(aColor.getC0() == aColor.maxChanVal);
7351 BOOST_TEST_CHECK(aColor.getC1() == aColor.minChanVal);
7352 BOOST_TEST_CHECK(aColor.getC2() == aColor.maxChanVal);
7353 BOOST_TEST_CHECK(aColor.getC3() == aColor.maxChanVal);
7354
7355 bColor.setToBlack();
7356 bColor.setToMagenta();
7357 BOOST_TEST_CHECK(bColor.getC0() == bColor.maxChanVal);
7358 BOOST_TEST_CHECK(bColor.getC1() == bColor.minChanVal);
7359 BOOST_TEST_CHECK(bColor.getC2() == bColor.maxChanVal);
7360 BOOST_TEST_CHECK(bColor.getC3() == bColor.maxChanVal);
7361
7362 cColor.setToBlack();
7363 cColor.setToMagenta();
7364 BOOST_TEST_CHECK(cColor.getC0() == cColor.maxChanVal);
7365 BOOST_TEST_CHECK(cColor.getC1() == cColor.minChanVal);
7366 BOOST_TEST_CHECK(cColor.getC2() == cColor.maxChanVal);
7367 BOOST_TEST_CHECK(cColor.getC3() == cColor.maxChanVal);
7368
7369 dColor.setToBlack();
7370 dColor.setToMagenta();
7371 BOOST_TEST_CHECK(dColor.getC0() == dColor.maxChanVal);
7372 BOOST_TEST_CHECK(dColor.getC1() == dColor.minChanVal);
7373 BOOST_TEST_CHECK(dColor.getC2() == dColor.maxChanVal);
7374 BOOST_TEST_CHECK(dColor.getC3() == dColor.maxChanVal);
7375
7376 ////////////////////////////////////////////////////////////////////////////////
7377 aColor.setToWhite();
7378 aColor.setToMagenta();
7379 BOOST_TEST_CHECK(aColor.getC0() == aColor.maxChanVal);
7380 BOOST_TEST_CHECK(aColor.getC1() == aColor.minChanVal);
7381 BOOST_TEST_CHECK(aColor.getC2() == aColor.maxChanVal);
7382 BOOST_TEST_CHECK(aColor.getC3() == aColor.maxChanVal);
7383
7384 bColor.setToWhite();
7385 bColor.setToMagenta();
7386 BOOST_TEST_CHECK(bColor.getC0() == bColor.maxChanVal);
7387 BOOST_TEST_CHECK(bColor.getC1() == bColor.minChanVal);
7388 BOOST_TEST_CHECK(bColor.getC2() == bColor.maxChanVal);
7389 BOOST_TEST_CHECK(bColor.getC3() == bColor.maxChanVal);
7390
7391 cColor.setToWhite();
7392 cColor.setToMagenta();
7393 BOOST_TEST_CHECK(cColor.getC0() == cColor.maxChanVal);
7394 BOOST_TEST_CHECK(cColor.getC1() == cColor.minChanVal);
7395 BOOST_TEST_CHECK(cColor.getC2() == cColor.maxChanVal);
7396 BOOST_TEST_CHECK(cColor.getC3() == cColor.maxChanVal);
7397
7398 dColor.setToWhite();
7399 dColor.setToMagenta();
7400 BOOST_TEST_CHECK(dColor.getC0() == dColor.maxChanVal);
7401 BOOST_TEST_CHECK(dColor.getC1() == dColor.minChanVal);
7402 BOOST_TEST_CHECK(dColor.getC2() == dColor.maxChanVal);
7403 BOOST_TEST_CHECK(dColor.getC3() == dColor.maxChanVal);
7404
7405 ////////////////////////////////////////////////////////////////////////////////
7406 aColor.setToBlack();
7407 aColor.setToYellow();
7408 BOOST_TEST_CHECK(aColor.getC0() == aColor.maxChanVal);
7409 BOOST_TEST_CHECK(aColor.getC1() == aColor.maxChanVal);
7410 BOOST_TEST_CHECK(aColor.getC2() == aColor.minChanVal);
7411 BOOST_TEST_CHECK(aColor.getC3() == aColor.maxChanVal);
7412
7413 bColor.setToBlack();
7414 bColor.setToYellow();
7415 BOOST_TEST_CHECK(bColor.getC0() == bColor.maxChanVal);
7416 BOOST_TEST_CHECK(bColor.getC1() == bColor.maxChanVal);
7417 BOOST_TEST_CHECK(bColor.getC2() == bColor.minChanVal);
7418 BOOST_TEST_CHECK(bColor.getC3() == bColor.maxChanVal);
7419
7420 cColor.setToBlack();
7421 cColor.setToYellow();
7422 BOOST_TEST_CHECK(cColor.getC0() == cColor.maxChanVal);
7423 BOOST_TEST_CHECK(cColor.getC1() == cColor.maxChanVal);
7424 BOOST_TEST_CHECK(cColor.getC2() == cColor.minChanVal);
7425 BOOST_TEST_CHECK(cColor.getC3() == cColor.maxChanVal);
7426
7427 dColor.setToBlack();
7428 dColor.setToYellow();
7429 BOOST_TEST_CHECK(dColor.getC0() == dColor.maxChanVal);
7430 BOOST_TEST_CHECK(dColor.getC1() == dColor.maxChanVal);
7431 BOOST_TEST_CHECK(dColor.getC2() == dColor.minChanVal);
7432 BOOST_TEST_CHECK(dColor.getC3() == dColor.maxChanVal);
7433
7434 ////////////////////////////////////////////////////////////////////////////////
7435 aColor.setToWhite();
7436 aColor.setToYellow();
7437 BOOST_TEST_CHECK(aColor.getC0() == aColor.maxChanVal);
7438 BOOST_TEST_CHECK(aColor.getC1() == aColor.maxChanVal);
7439 BOOST_TEST_CHECK(aColor.getC2() == aColor.minChanVal);
7440 BOOST_TEST_CHECK(aColor.getC3() == aColor.maxChanVal);
7441
7442 bColor.setToWhite();
7443 bColor.setToYellow();
7444 BOOST_TEST_CHECK(bColor.getC0() == bColor.maxChanVal);
7445 BOOST_TEST_CHECK(bColor.getC1() == bColor.maxChanVal);
7446 BOOST_TEST_CHECK(bColor.getC2() == bColor.minChanVal);
7447 BOOST_TEST_CHECK(bColor.getC3() == bColor.maxChanVal);
7448
7449 cColor.setToWhite();
7450 cColor.setToYellow();
7451 BOOST_TEST_CHECK(cColor.getC0() == cColor.maxChanVal);
7452 BOOST_TEST_CHECK(cColor.getC1() == cColor.maxChanVal);
7453 BOOST_TEST_CHECK(cColor.getC2() == cColor.minChanVal);
7454 BOOST_TEST_CHECK(cColor.getC3() == cColor.maxChanVal);
7455
7456 dColor.setToWhite();
7457 dColor.setToYellow();
7458 BOOST_TEST_CHECK(dColor.getC0() == dColor.maxChanVal);
7459 BOOST_TEST_CHECK(dColor.getC1() == dColor.maxChanVal);
7460 BOOST_TEST_CHECK(dColor.getC2() == dColor.minChanVal);
7461 BOOST_TEST_CHECK(dColor.getC3() == dColor.maxChanVal);
7462
7463 ////////////////////////////////////////////////////////////////////////////////
7464 aColor.setToBlack();
7465 aColor.setToHalf();
7466 BOOST_TEST_CHECK(aColor.getC0() == aColor.meanChanVal);
7467 BOOST_TEST_CHECK(aColor.getC1() == aColor.meanChanVal);
7468 BOOST_TEST_CHECK(aColor.getC2() == aColor.meanChanVal);
7469 BOOST_TEST_CHECK(aColor.getC3() == aColor.meanChanVal);
7470
7471 bColor.setToBlack();
7472 bColor.setToHalf();
7473 BOOST_TEST_CHECK(bColor.getC0() == bColor.meanChanVal);
7474 BOOST_TEST_CHECK(bColor.getC1() == bColor.meanChanVal);
7475 BOOST_TEST_CHECK(bColor.getC2() == bColor.meanChanVal);
7476 BOOST_TEST_CHECK(bColor.getC3() == bColor.meanChanVal);
7477
7478 cColor.setToBlack();
7479 cColor.setToHalf();
7480 BOOST_TEST_CHECK(cColor.getC0() == cColor.meanChanVal);
7481 BOOST_TEST_CHECK(cColor.getC1() == cColor.meanChanVal);
7482 BOOST_TEST_CHECK(cColor.getC2() == cColor.meanChanVal);
7483 BOOST_TEST_CHECK(cColor.getC3() == cColor.meanChanVal);
7484
7485 dColor.setToBlack();
7486 dColor.setToHalf();
7487 BOOST_TEST_CHECK(dColor.getC0() == dColor.meanChanVal);
7488 BOOST_TEST_CHECK(dColor.getC1() == dColor.meanChanVal);
7489 BOOST_TEST_CHECK(dColor.getC2() == dColor.meanChanVal);
7490 BOOST_TEST_CHECK(dColor.getC3() == dColor.meanChanVal);
7491
7492 ////////////////////////////////////////////////////////////////////////////////
7493 aColor.setToWhite();
7494 aColor.setToHalf();
7495 BOOST_TEST_CHECK(aColor.getC0() == aColor.meanChanVal);
7496 BOOST_TEST_CHECK(aColor.getC1() == aColor.meanChanVal);
7497 BOOST_TEST_CHECK(aColor.getC2() == aColor.meanChanVal);
7498 BOOST_TEST_CHECK(aColor.getC3() == aColor.meanChanVal);
7499
7500 bColor.setToWhite();
7501 bColor.setToHalf();
7502 BOOST_TEST_CHECK(bColor.getC0() == bColor.meanChanVal);
7503 BOOST_TEST_CHECK(bColor.getC1() == bColor.meanChanVal);
7504 BOOST_TEST_CHECK(bColor.getC2() == bColor.meanChanVal);
7505 BOOST_TEST_CHECK(bColor.getC3() == bColor.meanChanVal);
7506
7507 cColor.setToWhite();
7508 cColor.setToHalf();
7509 BOOST_TEST_CHECK(cColor.getC0() == cColor.meanChanVal);
7510 BOOST_TEST_CHECK(cColor.getC1() == cColor.meanChanVal);
7511 BOOST_TEST_CHECK(cColor.getC2() == cColor.meanChanVal);
7512 BOOST_TEST_CHECK(cColor.getC3() == cColor.meanChanVal);
7513
7514 dColor.setToWhite();
7515 dColor.setToHalf();
7516 BOOST_TEST_CHECK(dColor.getC0() == dColor.meanChanVal);
7517 BOOST_TEST_CHECK(dColor.getC1() == dColor.meanChanVal);
7518 BOOST_TEST_CHECK(dColor.getC2() == dColor.meanChanVal);
7519 BOOST_TEST_CHECK(dColor.getC3() == dColor.meanChanVal);
7520
7521}
7522
7523////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7524BOOST_AUTO_TEST_CASE(csHSLh) {
7525
7526 ////////////////////////////////////////////////////////////////////////////////
7527
7528 mjr::colorRGBA8b aColor;
7529
7530 aColor.setToWhite();
7531 mjr::colorRGBA8b::csHSLhB::c(aColor, mjr::colorRGB8b::meanChanVal);
7532 BOOST_TEST_CHECK(aColor.getAlpha() == mjr::colorRGB8b::maxChanVal); // unchanged
7533
7534 aColor.setToBlack();
7535 mjr::colorRGBA8b::csHSLhB::c(aColor, mjr::colorRGB8b::meanChanVal);
7536 BOOST_TEST_CHECK(aColor.getAlpha() == mjr::colorRGB8b::minChanVal); // unchanged
7537
7538 ////////////////////////////////////////////////////////////////////////////////
7539
7540 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhB::c(mjr::colorRGB8b::minChanVal).getRed() == mjr::colorRGB8b::meanChanVal);
7541 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhB::c(mjr::colorRGB8b::minChanVal).getGreen() == mjr::colorRGB8b::meanChanVal);
7542 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhB::c(mjr::colorRGB8b::minChanVal).getBlue() == mjr::colorRGB8b::meanChanVal);
7543
7544 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhC::c(mjr::colorRGB8b::minChanVal).getRed() == mjr::colorRGB8b::meanChanVal);
7545 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhC::c(mjr::colorRGB8b::minChanVal).getGreen() == mjr::colorRGB8b::meanChanVal);
7546 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhC::c(mjr::colorRGB8b::minChanVal).getBlue() == mjr::colorRGB8b::meanChanVal);
7547
7548 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhG::c(mjr::colorRGB8b::minChanVal).getRed() == mjr::colorRGB8b::meanChanVal);
7549 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhG::c(mjr::colorRGB8b::minChanVal).getGreen() == mjr::colorRGB8b::meanChanVal);
7550 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhG::c(mjr::colorRGB8b::minChanVal).getBlue() == mjr::colorRGB8b::meanChanVal);
7551
7552 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhM::c(mjr::colorRGB8b::minChanVal).getRed() == mjr::colorRGB8b::meanChanVal);
7553 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhM::c(mjr::colorRGB8b::minChanVal).getGreen() == mjr::colorRGB8b::meanChanVal);
7554 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhM::c(mjr::colorRGB8b::minChanVal).getBlue() == mjr::colorRGB8b::meanChanVal);
7555
7556 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhR::c(mjr::colorRGB8b::minChanVal).getRed() == mjr::colorRGB8b::meanChanVal);
7557 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhR::c(mjr::colorRGB8b::minChanVal).getGreen() == mjr::colorRGB8b::meanChanVal);
7558 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhR::c(mjr::colorRGB8b::minChanVal).getBlue() == mjr::colorRGB8b::meanChanVal);
7559
7560 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhY::c(mjr::colorRGB8b::minChanVal).getRed() == mjr::colorRGB8b::meanChanVal);
7561 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhY::c(mjr::colorRGB8b::minChanVal).getGreen() == mjr::colorRGB8b::meanChanVal);
7562 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhY::c(mjr::colorRGB8b::minChanVal).getBlue() == mjr::colorRGB8b::meanChanVal);
7563
7564 ////////////////////////////////////////////////////////////////////////////////
7565
7566 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhB::c(mjr::colorRGB8b::meanChanVal).getRed() == mjr::colorRGB8b::minChanVal);
7567 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhB::c(mjr::colorRGB8b::meanChanVal).getGreen() == mjr::colorRGB8b::minChanVal);
7568 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhB::c(mjr::colorRGB8b::meanChanVal).getBlue() == mjr::colorRGB8b::maxChanVal - 1);
7569
7570 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhC::c(mjr::colorRGB8b::meanChanVal).getRed() == mjr::colorRGB8b::minChanVal);
7571 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhC::c(mjr::colorRGB8b::meanChanVal).getGreen() == mjr::colorRGB8b::maxChanVal - 1);
7572 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhC::c(mjr::colorRGB8b::meanChanVal).getBlue() == mjr::colorRGB8b::maxChanVal - 1);
7573
7574 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhG::c(mjr::colorRGB8b::meanChanVal).getRed() == mjr::colorRGB8b::minChanVal);
7575 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhG::c(mjr::colorRGB8b::meanChanVal).getGreen() == mjr::colorRGB8b::maxChanVal - 1);
7576 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhG::c(mjr::colorRGB8b::meanChanVal).getBlue() == mjr::colorRGB8b::minChanVal);
7577
7578 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhM::c(mjr::colorRGB8b::meanChanVal).getRed() == mjr::colorRGB8b::maxChanVal - 1);
7579 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhM::c(mjr::colorRGB8b::meanChanVal).getGreen() == mjr::colorRGB8b::minChanVal);
7580 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhM::c(mjr::colorRGB8b::meanChanVal).getBlue() == mjr::colorRGB8b::maxChanVal - 1);
7581
7582 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhR::c(mjr::colorRGB8b::meanChanVal).getRed() == mjr::colorRGB8b::maxChanVal - 1);
7583 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhR::c(mjr::colorRGB8b::meanChanVal).getGreen() == mjr::colorRGB8b::minChanVal);
7584 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhR::c(mjr::colorRGB8b::meanChanVal).getBlue() == mjr::colorRGB8b::minChanVal);
7585
7586 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhY::c(mjr::colorRGB8b::meanChanVal).getRed() == mjr::colorRGB8b::maxChanVal - 1);
7587 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhY::c(mjr::colorRGB8b::meanChanVal).getGreen() == mjr::colorRGB8b::maxChanVal - 1);
7588 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhY::c(mjr::colorRGB8b::meanChanVal).getBlue() == mjr::colorRGB8b::minChanVal);
7589
7590 ////////////////////////////////////////////////////////////////////////////////
7591
7592 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhB::c(mjr::colorRGB8b::meanChanVal + 1).getRed() == mjr::colorRGB8b::meanChanVal); // wrap
7593 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhB::c(mjr::colorRGB8b::meanChanVal + 1).getGreen() == mjr::colorRGB8b::meanChanVal);
7594 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhB::c(mjr::colorRGB8b::meanChanVal + 1).getBlue() == mjr::colorRGB8b::meanChanVal);
7595
7596 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhC::c(mjr::colorRGB8b::meanChanVal + 1).getRed() == mjr::colorRGB8b::meanChanVal);
7597 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhC::c(mjr::colorRGB8b::meanChanVal + 1).getGreen() == mjr::colorRGB8b::meanChanVal);
7598 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhC::c(mjr::colorRGB8b::meanChanVal + 1).getBlue() == mjr::colorRGB8b::meanChanVal);
7599
7600 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhG::c(mjr::colorRGB8b::meanChanVal + 1).getRed() == mjr::colorRGB8b::meanChanVal);
7601 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhG::c(mjr::colorRGB8b::meanChanVal + 1).getGreen() == mjr::colorRGB8b::meanChanVal);
7602 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhG::c(mjr::colorRGB8b::meanChanVal + 1).getBlue() == mjr::colorRGB8b::meanChanVal);
7603
7604 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhM::c(mjr::colorRGB8b::meanChanVal + 1).getRed() == mjr::colorRGB8b::meanChanVal);
7605 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhM::c(mjr::colorRGB8b::meanChanVal + 1).getGreen() == mjr::colorRGB8b::meanChanVal);
7606 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhM::c(mjr::colorRGB8b::meanChanVal + 1).getBlue() == mjr::colorRGB8b::meanChanVal);
7607
7608 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhR::c(mjr::colorRGB8b::meanChanVal + 1).getRed() == mjr::colorRGB8b::meanChanVal);
7609 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhR::c(mjr::colorRGB8b::meanChanVal + 1).getGreen() == mjr::colorRGB8b::meanChanVal);
7610 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhR::c(mjr::colorRGB8b::meanChanVal + 1).getBlue() == mjr::colorRGB8b::meanChanVal);
7611
7612 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhY::c(mjr::colorRGB8b::meanChanVal + 1).getRed() == mjr::colorRGB8b::meanChanVal);
7613 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhY::c(mjr::colorRGB8b::meanChanVal + 1).getGreen() == mjr::colorRGB8b::meanChanVal);
7614 BOOST_TEST_CHECK(mjr::colorRGB8b::csHSLhY::c(mjr::colorRGB8b::meanChanVal + 1).getBlue() == mjr::colorRGB8b::meanChanVal);
7615
7616 ////////////////////////////////////////////////////////////////////////////////
7617
7618 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhB::c(mjr::colorRGB16b::minChanVal).getRed() == mjr::colorRGB16b::meanChanVal);
7619 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhB::c(mjr::colorRGB16b::minChanVal).getGreen() == mjr::colorRGB16b::meanChanVal);
7620 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhB::c(mjr::colorRGB16b::minChanVal).getBlue() == mjr::colorRGB16b::meanChanVal);
7621
7622 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhC::c(mjr::colorRGB16b::minChanVal).getRed() == mjr::colorRGB16b::meanChanVal);
7623 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhC::c(mjr::colorRGB16b::minChanVal).getGreen() == mjr::colorRGB16b::meanChanVal);
7624 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhC::c(mjr::colorRGB16b::minChanVal).getBlue() == mjr::colorRGB16b::meanChanVal);
7625
7626 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhG::c(mjr::colorRGB16b::minChanVal).getRed() == mjr::colorRGB16b::meanChanVal);
7627 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhG::c(mjr::colorRGB16b::minChanVal).getGreen() == mjr::colorRGB16b::meanChanVal);
7628 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhG::c(mjr::colorRGB16b::minChanVal).getBlue() == mjr::colorRGB16b::meanChanVal);
7629
7630 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhM::c(mjr::colorRGB16b::minChanVal).getRed() == mjr::colorRGB16b::meanChanVal);
7631 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhM::c(mjr::colorRGB16b::minChanVal).getGreen() == mjr::colorRGB16b::meanChanVal);
7632 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhM::c(mjr::colorRGB16b::minChanVal).getBlue() == mjr::colorRGB16b::meanChanVal);
7633
7634 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhR::c(mjr::colorRGB16b::minChanVal).getRed() == mjr::colorRGB16b::meanChanVal);
7635 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhR::c(mjr::colorRGB16b::minChanVal).getGreen() == mjr::colorRGB16b::meanChanVal);
7636 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhR::c(mjr::colorRGB16b::minChanVal).getBlue() == mjr::colorRGB16b::meanChanVal);
7637
7638 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhY::c(mjr::colorRGB16b::minChanVal).getRed() == mjr::colorRGB16b::meanChanVal);
7639 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhY::c(mjr::colorRGB16b::minChanVal).getGreen() == mjr::colorRGB16b::meanChanVal);
7640 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhY::c(mjr::colorRGB16b::minChanVal).getBlue() == mjr::colorRGB16b::meanChanVal);
7641
7642 ////////////////////////////////////////////////////////////////////////////////
7643
7644 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhB::c(mjr::colorRGB16b::meanChanVal).getRed() == mjr::colorRGB16b::minChanVal);
7645 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhB::c(mjr::colorRGB16b::meanChanVal).getGreen() == mjr::colorRGB16b::minChanVal);
7646 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhB::c(mjr::colorRGB16b::meanChanVal).getBlue() == mjr::colorRGB16b::maxChanVal - 1);
7647
7648 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhC::c(mjr::colorRGB16b::meanChanVal).getRed() == mjr::colorRGB16b::minChanVal);
7649 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhC::c(mjr::colorRGB16b::meanChanVal).getGreen() == mjr::colorRGB16b::maxChanVal - 1);
7650 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhC::c(mjr::colorRGB16b::meanChanVal).getBlue() == mjr::colorRGB16b::maxChanVal - 1);
7651
7652 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhG::c(mjr::colorRGB16b::meanChanVal).getRed() == mjr::colorRGB16b::minChanVal);
7653 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhG::c(mjr::colorRGB16b::meanChanVal).getGreen() == mjr::colorRGB16b::maxChanVal - 1);
7654 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhG::c(mjr::colorRGB16b::meanChanVal).getBlue() == mjr::colorRGB16b::minChanVal);
7655
7656 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhM::c(mjr::colorRGB16b::meanChanVal).getRed() == mjr::colorRGB16b::maxChanVal - 1);
7657 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhM::c(mjr::colorRGB16b::meanChanVal).getGreen() == mjr::colorRGB16b::minChanVal);
7658 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhM::c(mjr::colorRGB16b::meanChanVal).getBlue() == mjr::colorRGB16b::maxChanVal - 1);
7659
7660 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhR::c(mjr::colorRGB16b::meanChanVal).getRed() == mjr::colorRGB16b::maxChanVal - 1);
7661 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhR::c(mjr::colorRGB16b::meanChanVal).getGreen() == mjr::colorRGB16b::minChanVal);
7662 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhR::c(mjr::colorRGB16b::meanChanVal).getBlue() == mjr::colorRGB16b::minChanVal);
7663
7664 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhY::c(mjr::colorRGB16b::meanChanVal).getRed() == mjr::colorRGB16b::maxChanVal - 1);
7665 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhY::c(mjr::colorRGB16b::meanChanVal).getGreen() == mjr::colorRGB16b::maxChanVal - 1);
7666 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhY::c(mjr::colorRGB16b::meanChanVal).getBlue() == mjr::colorRGB16b::minChanVal);
7667
7668 ////////////////////////////////////////////////////////////////////////////////
7669
7670 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhB::c(mjr::colorRGB16b::meanChanVal + 1).getRed() == mjr::colorRGB16b::meanChanVal); // wrap
7671 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhB::c(mjr::colorRGB16b::meanChanVal + 1).getGreen() == mjr::colorRGB16b::meanChanVal);
7672 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhB::c(mjr::colorRGB16b::meanChanVal + 1).getBlue() == mjr::colorRGB16b::meanChanVal);
7673
7674 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhC::c(mjr::colorRGB16b::meanChanVal + 1).getRed() == mjr::colorRGB16b::meanChanVal);
7675 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhC::c(mjr::colorRGB16b::meanChanVal + 1).getGreen() == mjr::colorRGB16b::meanChanVal);
7676 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhC::c(mjr::colorRGB16b::meanChanVal + 1).getBlue() == mjr::colorRGB16b::meanChanVal);
7677
7678 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhG::c(mjr::colorRGB16b::meanChanVal + 1).getRed() == mjr::colorRGB16b::meanChanVal);
7679 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhG::c(mjr::colorRGB16b::meanChanVal + 1).getGreen() == mjr::colorRGB16b::meanChanVal);
7680 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhG::c(mjr::colorRGB16b::meanChanVal + 1).getBlue() == mjr::colorRGB16b::meanChanVal);
7681
7682 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhM::c(mjr::colorRGB16b::meanChanVal + 1).getRed() == mjr::colorRGB16b::meanChanVal);
7683 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhM::c(mjr::colorRGB16b::meanChanVal + 1).getGreen() == mjr::colorRGB16b::meanChanVal);
7684 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhM::c(mjr::colorRGB16b::meanChanVal + 1).getBlue() == mjr::colorRGB16b::meanChanVal);
7685
7686 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhR::c(mjr::colorRGB16b::meanChanVal + 1).getRed() == mjr::colorRGB16b::meanChanVal);
7687 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhR::c(mjr::colorRGB16b::meanChanVal + 1).getGreen() == mjr::colorRGB16b::meanChanVal);
7688 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhR::c(mjr::colorRGB16b::meanChanVal + 1).getBlue() == mjr::colorRGB16b::meanChanVal);
7689
7690 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhY::c(mjr::colorRGB16b::meanChanVal + 1).getRed() == mjr::colorRGB16b::meanChanVal);
7691 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhY::c(mjr::colorRGB16b::meanChanVal + 1).getGreen() == mjr::colorRGB16b::meanChanVal);
7692 BOOST_TEST_CHECK(mjr::colorRGB16b::csHSLhY::c(mjr::colorRGB16b::meanChanVal + 1).getBlue() == mjr::colorRGB16b::meanChanVal);
7693
7694
7695 ////////////////////////////////////////////////////////////////////////////////
7696
7697 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhB::c(0.0).getRed() == mjr::colorRGB32F::meanChanVal);
7698 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhB::c(0.0).getGreen() == mjr::colorRGB32F::meanChanVal);
7699 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhB::c(0.0).getBlue() == mjr::colorRGB32F::meanChanVal);
7700
7701 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhC::c(0.0).getRed() == mjr::colorRGB32F::meanChanVal);
7702 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhC::c(0.0).getGreen() == mjr::colorRGB32F::meanChanVal);
7703 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhC::c(0.0).getBlue() == mjr::colorRGB32F::meanChanVal);
7704
7705 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhG::c(0.0).getRed() == mjr::colorRGB32F::meanChanVal);
7706 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhG::c(0.0).getGreen() == mjr::colorRGB32F::meanChanVal);
7707 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhG::c(0.0).getBlue() == mjr::colorRGB32F::meanChanVal);
7708
7709 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhM::c(0.0).getRed() == mjr::colorRGB32F::meanChanVal);
7710 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhM::c(0.0).getGreen() == mjr::colorRGB32F::meanChanVal);
7711 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhM::c(0.0).getBlue() == mjr::colorRGB32F::meanChanVal);
7712
7713 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhR::c(0.0).getRed() == mjr::colorRGB32F::meanChanVal);
7714 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhR::c(0.0).getGreen() == mjr::colorRGB32F::meanChanVal);
7715 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhR::c(0.0).getBlue() == mjr::colorRGB32F::meanChanVal);
7716
7717 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhY::c(0.0).getRed() == mjr::colorRGB32F::meanChanVal);
7718 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhY::c(0.0).getGreen() == mjr::colorRGB32F::meanChanVal);
7719 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhY::c(0.0).getBlue() == mjr::colorRGB32F::meanChanVal);
7720
7721 // ////////////////////////////////////////////////////////////////////////////////
7722
7723 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhB::c(mjr::colorRGBA32F::meanChanVal).getRed() == mjr::colorRGB32F::minChanVal);
7724 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhB::c(mjr::colorRGBA32F::meanChanVal).getGreen() == mjr::colorRGB32F::minChanVal);
7725 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhB::c(mjr::colorRGBA32F::meanChanVal).getBlue() == mjr::colorRGB32F::maxChanVal); // Note for floating point clrChanT, csHSLh_tpl gets to maxChanVal
7726
7727 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhC::c(mjr::colorRGBA32F::meanChanVal).getRed() == mjr::colorRGB32F::minChanVal);
7728 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhC::c(mjr::colorRGBA32F::meanChanVal).getGreen() == mjr::colorRGB32F::maxChanVal);
7729 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhC::c(mjr::colorRGBA32F::meanChanVal).getBlue() == mjr::colorRGB32F::maxChanVal);
7730
7731 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhG::c(mjr::colorRGBA32F::meanChanVal).getRed() == mjr::colorRGB32F::minChanVal);
7732 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhG::c(mjr::colorRGBA32F::meanChanVal).getGreen() == mjr::colorRGB32F::maxChanVal);
7733 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhG::c(mjr::colorRGBA32F::meanChanVal).getBlue() == mjr::colorRGB32F::minChanVal);
7734
7735 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhM::c(mjr::colorRGBA32F::meanChanVal).getRed() == mjr::colorRGB32F::maxChanVal);
7736 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhM::c(mjr::colorRGBA32F::meanChanVal).getGreen() == mjr::colorRGB32F::minChanVal);
7737 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhM::c(mjr::colorRGBA32F::meanChanVal).getBlue() == mjr::colorRGB32F::maxChanVal);
7738
7739 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhR::c(mjr::colorRGBA32F::meanChanVal).getRed() == mjr::colorRGB32F::maxChanVal);
7740 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhR::c(mjr::colorRGBA32F::meanChanVal).getGreen() == mjr::colorRGB32F::minChanVal);
7741 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhR::c(mjr::colorRGBA32F::meanChanVal).getBlue() == mjr::colorRGB32F::minChanVal);
7742
7743 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhY::c(mjr::colorRGBA32F::meanChanVal).getRed() == mjr::colorRGB32F::maxChanVal);
7744 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhY::c(mjr::colorRGBA32F::meanChanVal).getGreen() == mjr::colorRGB32F::maxChanVal);
7745 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhY::c(mjr::colorRGBA32F::meanChanVal).getBlue() == mjr::colorRGB32F::minChanVal);
7746
7747 // ////////////////////////////////////////////////////////////////////////////////
7748
7749 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhB::c(mjr::colorRGBA32F::meanChanVal + 1).getRed() == mjr::colorRGB32F::meanChanVal); // wrap to zoeo -- not meanChanVal. One of the oddities of floating pont wrap.
7750 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhB::c(mjr::colorRGBA32F::meanChanVal + 1).getGreen() == mjr::colorRGB32F::meanChanVal);
7751 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhB::c(mjr::colorRGBA32F::meanChanVal + 1).getBlue() == mjr::colorRGB32F::meanChanVal);
7752
7753 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhC::c(mjr::colorRGBA32F::meanChanVal + 1).getRed() == mjr::colorRGB32F::meanChanVal);
7754 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhC::c(mjr::colorRGBA32F::meanChanVal + 1).getGreen() == mjr::colorRGB32F::meanChanVal);
7755 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhC::c(mjr::colorRGBA32F::meanChanVal + 1).getBlue() == mjr::colorRGB32F::meanChanVal);
7756
7757 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhG::c(mjr::colorRGBA32F::meanChanVal + 1).getRed() == mjr::colorRGB32F::meanChanVal);
7758 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhG::c(mjr::colorRGBA32F::meanChanVal + 1).getGreen() == mjr::colorRGB32F::meanChanVal);
7759 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhG::c(mjr::colorRGBA32F::meanChanVal + 1).getBlue() == mjr::colorRGB32F::meanChanVal);
7760
7761 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhM::c(mjr::colorRGBA32F::meanChanVal + 1).getRed() == mjr::colorRGB32F::meanChanVal);
7762 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhM::c(mjr::colorRGBA32F::meanChanVal + 1).getGreen() == mjr::colorRGB32F::meanChanVal);
7763 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhM::c(mjr::colorRGBA32F::meanChanVal + 1).getBlue() == mjr::colorRGB32F::meanChanVal);
7764
7765 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhR::c(mjr::colorRGBA32F::meanChanVal + 1).getRed() == mjr::colorRGB32F::meanChanVal);
7766 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhR::c(mjr::colorRGBA32F::meanChanVal + 1).getGreen() == mjr::colorRGB32F::meanChanVal);
7767 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhR::c(mjr::colorRGBA32F::meanChanVal + 1).getBlue() == mjr::colorRGB32F::meanChanVal);
7768
7769 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhY::c(mjr::colorRGBA32F::meanChanVal + 1).getRed() == mjr::colorRGB32F::meanChanVal);
7770 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhY::c(mjr::colorRGBA32F::meanChanVal + 1).getGreen() == mjr::colorRGB32F::meanChanVal);
7771 BOOST_TEST_CHECK(mjr::colorRGB32F::csHSLhY::c(mjr::colorRGBA32F::meanChanVal + 1).getBlue() == mjr::colorRGB32F::meanChanVal);
7772}
7773
7774#if !(MISSING_P1907R1)
7775////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7776BOOST_AUTO_TEST_CASE(csPLY) {
7777
7778 ////////////////////////////////////////////////////////////////////////////////
7779
7780 mjr::colorRGBA8b aColor;
7781
7782 aColor.setToWhite();
7783 mjr::colorRGBA8b::csPLYgrey::c(aColor, 0.0);
7784 BOOST_TEST_CHECK(aColor.getRed() == mjr::colorRGB8b::minChanVal);
7785 BOOST_TEST_CHECK(aColor.getBlue() == mjr::colorRGB8b::minChanVal);
7786 BOOST_TEST_CHECK(aColor.getGreen() == mjr::colorRGB8b::minChanVal);
7787 BOOST_TEST_CHECK(aColor.getAlpha() == mjr::colorRGB8b::maxChanVal); // unchanged
7788
7789 aColor.setToBlack();
7790 mjr::colorRGBA8b::csPLYgrey::c(aColor, 0.0);
7791 BOOST_TEST_CHECK(aColor.getRed() == mjr::colorRGB8b::minChanVal);
7792 BOOST_TEST_CHECK(aColor.getBlue() == mjr::colorRGB8b::minChanVal);
7793 BOOST_TEST_CHECK(aColor.getGreen() == mjr::colorRGB8b::minChanVal);
7794 BOOST_TEST_CHECK(aColor.getAlpha() == mjr::colorRGB8b::minChanVal); // unchanged
7795
7796 ////////////////////////////////////////////////////////////////////////////////
7797
7798 BOOST_TEST_CHECK(mjr::colorRGB8b::csPLYgrey::c(0.0).getRed() == mjr::colorRGB8b::minChanVal);
7799 BOOST_TEST_CHECK(mjr::colorRGB8b::csPLYgrey::c(0.0).getGreen() == mjr::colorRGB8b::minChanVal);
7800 BOOST_TEST_CHECK(mjr::colorRGB8b::csPLYgrey::c(0.0).getBlue() == mjr::colorRGB8b::minChanVal);
7801
7802 BOOST_TEST_CHECK(mjr::colorRGB8b::csPLYgrey::c(0.5).getRed() == mjr::colorRGB8b::meanChanVal);
7803 BOOST_TEST_CHECK(mjr::colorRGB8b::csPLYgrey::c(0.5).getGreen() == mjr::colorRGB8b::meanChanVal);
7804 BOOST_TEST_CHECK(mjr::colorRGB8b::csPLYgrey::c(0.5).getBlue() == mjr::colorRGB8b::meanChanVal);
7805
7806 BOOST_TEST_CHECK(mjr::colorRGB8b::csPLYgrey::c(1.0).getRed() == mjr::colorRGB8b::maxChanVal);
7807 BOOST_TEST_CHECK(mjr::colorRGB8b::csPLYgrey::c(1.0).getGreen() == mjr::colorRGB8b::maxChanVal);
7808 BOOST_TEST_CHECK(mjr::colorRGB8b::csPLYgrey::c(1.0).getBlue() == mjr::colorRGB8b::maxChanVal);
7809
7810 ////////////////////////////////////////////////////////////////////////////////
7811
7812 BOOST_TEST_CHECK(mjr::colorRGB8b::csPLYquad::c(0.0).getRed() == mjr::colorRGB8b::minChanVal);
7813 BOOST_TEST_CHECK(mjr::colorRGB8b::csPLYquad::c(0.0).getGreen() == mjr::colorRGB8b::minChanVal);
7814 BOOST_TEST_CHECK(mjr::colorRGB8b::csPLYquad::c(0.0).getBlue() == mjr::colorRGB8b::minChanVal);
7815
7816 BOOST_TEST_CHECK(mjr::colorRGB8b::csPLYquad::c(0.5).getRed() == 0x3F); // 255 * 0.5 * 0.5 = 63.75
7817 BOOST_TEST_CHECK(mjr::colorRGB8b::csPLYquad::c(0.5).getGreen() == 0x3F);
7818 BOOST_TEST_CHECK(mjr::colorRGB8b::csPLYquad::c(0.5).getBlue() == 0x3F);
7819
7820 BOOST_TEST_CHECK(mjr::colorRGB8b::csPLYquad::c(1.0).getRed() == mjr::colorRGB8b::maxChanVal);
7821 BOOST_TEST_CHECK(mjr::colorRGB8b::csPLYquad::c(1.0).getGreen() == mjr::colorRGB8b::maxChanVal);
7822 BOOST_TEST_CHECK(mjr::colorRGB8b::csPLYquad::c(1.0).getBlue() == mjr::colorRGB8b::maxChanVal);
7823
7824 ////////////////////////////////////////////////////////////////////////////////
7825
7826 typedef mjr::colorRGB64F::csPLY_tpl< 10.6666666666667, -16.000000000000, 6.3333333333333, 0.00000000000000, // [[0.0, 0.00000], [0.25, 0.750000], [0.50, 0.500000], [1.0, 1.00000]];
7827 -9.3333333333333, 13.000000000000, -4.6666666666666, 1.00000000000000, // [[0.0, 1.00000], [0.25, 0.500000], [0.50, 0.750000], [1.0, 0.00000]];
7828 4.4117333333333, -5.902400000000, 1.9936666666666, 0.28480000000000> csPLYfoo; // [[0.0, 0.28480], [0.25, 0.483250], [0.50, 0.357500], [1.0, 0.78780]]
7829
7830 BOOST_TEST_CHECK(csPLYfoo::c(0.00).getRed() == 0.000000, boost::test_tools::tolerance(0.00001));
7831 BOOST_TEST_CHECK(csPLYfoo::c(0.00).getGreen() == 1.000000, boost::test_tools::tolerance(0.00001));
7832 BOOST_TEST_CHECK(csPLYfoo::c(0.00).getBlue() == 0.284800, boost::test_tools::tolerance(0.00001));
7833
7834 BOOST_TEST_CHECK(csPLYfoo::c(0.25).getRed() == 0.750000, boost::test_tools::tolerance(0.00001));
7835 BOOST_TEST_CHECK(csPLYfoo::c(0.25).getGreen() == 0.500000, boost::test_tools::tolerance(0.00001));
7836 BOOST_TEST_CHECK(csPLYfoo::c(0.25).getBlue() == 0.483250, boost::test_tools::tolerance(0.00001));
7837
7838 BOOST_TEST_CHECK(csPLYfoo::c(0.50).getRed() == 0.500000, boost::test_tools::tolerance(0.00001));
7839 BOOST_TEST_CHECK(csPLYfoo::c(0.50).getGreen() == 0.750000, boost::test_tools::tolerance(0.00001));
7840 BOOST_TEST_CHECK(csPLYfoo::c(0.50).getBlue() == 0.357500, boost::test_tools::tolerance(0.00001));
7841
7842 BOOST_TEST_CHECK(csPLYfoo::c(1.00).getRed() == 1.000000, boost::test_tools::tolerance(0.00001));
7843 BOOST_TEST_CHECK(csPLYfoo::c(1.00).getGreen() == 0.000000, boost::test_tools::tolerance(0.00001));
7844 BOOST_TEST_CHECK(csPLYfoo::c(1.00).getBlue() == 0.787800, boost::test_tools::tolerance(0.00001));
7845}
7846#endif
7847
7848////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7849BOOST_AUTO_TEST_CASE(csCColdeRainbow_flt) {
7850
7851 mjr::colorRGBA8b aColor;
7852 mjr::colorRGBA32F bColor;
7853
7854 aColor.setToWhite();
7855 mjr::colorRGBA8b::csCColdeRainbow::c(aColor, 0.0);
7856 BOOST_TEST_CHECK(aColor.getRed() == mjr::colorRGBA8b::maxChanVal);
7857 BOOST_TEST_CHECK(aColor.getGreen() == mjr::colorRGBA8b::minChanVal);
7858 BOOST_TEST_CHECK(aColor.getBlue() == mjr::colorRGBA8b::minChanVal);
7859 BOOST_TEST_CHECK(aColor.getAlpha() == mjr::colorRGBA8b::minChanVal); // Corner colors set ALL channels -- primary colors set them all to minChanVal
7860
7861 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCColdeRainbow::c( 0/1530.0).isEqualRGB(aColor.setToRed()) == true);
7862 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCColdeRainbow::c( 255/1530.0).isEqualRGB(aColor.setToYellow()) == true);
7863 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCColdeRainbow::c( 510/1530.0).isEqualRGB(aColor.setToGreen()) == true);
7864 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCColdeRainbow::c( 765/1530.0).isEqualRGB(aColor.setToCyan()) == true);
7865 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCColdeRainbow::c(1020/1530.0).isEqualRGB(aColor.setToBlue()) == true);
7866 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCColdeRainbow::c(1275/1530.0).isEqualRGB(aColor.setToMagenta()) == true);
7867 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCColdeRainbow::c(1530/1530.0).isEqualRGB(aColor.setToRed()) == true);
7868
7869 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCColdeRainbow::c(2.0).isEqualRGB(aColor.setToRed()) == true);
7870 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCColdeRainbow::c(3.0).isEqualRGB(aColor.setToRed()) == true);
7871
7872 for(double i=0.0; i<1.0; i=i+0.001) // BOOST_TEST_CHECK x 1000
7873 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCColdeRainbow::c(i).isEqualRGB(aColor.cmpRGBcornerCGradiant(i, "RYGCBMR")) == true);
7874
7875 aColor.cmpRGBcornerCGradiant(10/1530.0, "RYGCBMR");
7876 BOOST_TEST_CHECK(aColor.getRed() == 0xff);
7877 BOOST_TEST_CHECK(aColor.getGreen() == 10);
7878 BOOST_TEST_CHECK(aColor.getBlue() == 0);
7879
7880////////////////////////////////////////////////////////////////////////////////
7881
7882 bColor.setToWhite();
7883 mjr::colorRGBA32F::csCColdeRainbow::c(bColor, 0.0F);
7884 BOOST_TEST_CHECK(bColor.getRed() == mjr::colorRGBA32F::maxChanVal);
7885 BOOST_TEST_CHECK(bColor.getGreen() == mjr::colorRGBA32F::minChanVal);
7886 BOOST_TEST_CHECK(bColor.getBlue() == mjr::colorRGBA32F::minChanVal);
7887 BOOST_TEST_CHECK(bColor.getAlpha() == mjr::colorRGBA32F::minChanVal); // Corner colors set ALL channels -- primary colors set them all to minChanVal
7888
7889 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCColdeRainbow::c( 0/1530.0).isCloseRGB(bColor.setToRed(), 0.000001F) == true);
7890 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCColdeRainbow::c( 255/1530.0).isCloseRGB(bColor.setToYellow(), 0.000001F) == true);
7891 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCColdeRainbow::c( 510/1530.0).isCloseRGB(bColor.setToGreen(), 0.000001F) == true);
7892 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCColdeRainbow::c( 765/1530.0).isCloseRGB(bColor.setToCyan(), 0.000001F) == true);
7893 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCColdeRainbow::c(1020/1530.0).isCloseRGB(bColor.setToBlue(), 0.000001F) == true);
7894 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCColdeRainbow::c(1275/1530.0).isCloseRGB(bColor.setToMagenta(), 0.000001F) == true);
7895 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCColdeRainbow::c(1530/1530.0).isCloseRGB(bColor.setToRed(), 0.000001F) == true);
7896
7897 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCColdeRainbow::c(2.0).isCloseRGB(bColor.setToRed(), 0.000001F) == true);
7898 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCColdeRainbow::c(3.0).isCloseRGB(bColor.setToRed(), 0.000001F) == true);
7899
7900 for(double i=0.0; i<1.0; i=i+0.001) // BOOST_TEST_CHECK x 1000
7901 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCColdeRainbow::c(i).isCloseRGB(bColor.cmpRGBcornerCGradiant(i, "RYGCBMR"), 0.000001F) == true);
7902
7903 bColor.cmpRGBcornerCGradiant(10/1530.0, "RYGCBMR");
7904 BOOST_TEST_CHECK(bColor.getRed() == 1, boost::test_tools::tolerance(0.00001));
7905 BOOST_TEST_CHECK(bColor.getGreen() == 0.0392156862745, boost::test_tools::tolerance(0.00001));
7906 BOOST_TEST_CHECK(bColor.getBlue() == 0, boost::test_tools::tolerance(0.00001));
7907}
7908
7909////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7910BOOST_AUTO_TEST_CASE(csCColdeRainbow_int) {
7911
7912 mjr::colorRGBA8b aColor;
7913 mjr::colorRGBA32F bColor;
7914
7915 aColor.setToWhite();
7916 mjr::colorRGBA8b::csCColdeRainbow::c(aColor, 0u);
7917 BOOST_TEST_CHECK(aColor.getRed() == mjr::colorRGBA8b::maxChanVal);
7918 BOOST_TEST_CHECK(aColor.getGreen() == mjr::colorRGBA8b::minChanVal);
7919 BOOST_TEST_CHECK(aColor.getBlue() == mjr::colorRGBA8b::minChanVal);
7920 BOOST_TEST_CHECK(aColor.getAlpha() == mjr::colorRGBA8b::maxChanVal); // unchanged
7921
7922 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCColdeRainbow::c( 0u).isEqualRGB(aColor.setToRed()) == true);
7923 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCColdeRainbow::c( 255u).isEqualRGB(aColor.setToYellow()) == true);
7924 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCColdeRainbow::c( 510u).isEqualRGB(aColor.setToGreen()) == true);
7925 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCColdeRainbow::c( 765u).isEqualRGB(aColor.setToCyan()) == true);
7926 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCColdeRainbow::c(1020u).isEqualRGB(aColor.setToBlue()) == true);
7927 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCColdeRainbow::c(1275u).isEqualRGB(aColor.setToMagenta()) == true);
7928 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCColdeRainbow::c(1530u).isEqualRGB(aColor.setToRed()) == true);
7929
7930 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCColdeRainbow::c(1531u).isEqualRGB(aColor.setToRed()) == true);
7931 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCColdeRainbow::c(1786u).isEqualRGB(aColor.setToYellow()) == true);
7932
7933 for(unsigned int i=0; i<1531; i++) // BOOST_TEST_CHECK x 1531
7934 BOOST_TEST_CHECK(mjr::colorRGBA8b::csCColdeRainbow::c(i).isEqualRGB(aColor.cmpRGBcornerDGradiant(i, "RYGCBMR")) == true);
7935
7936 aColor.cmpRGBcornerDGradiant(10u, "RYGCBMR");
7937 BOOST_TEST_CHECK(aColor.getRed() == 0xff);
7938 BOOST_TEST_CHECK(aColor.getGreen() == 10);
7939 BOOST_TEST_CHECK(aColor.getBlue() == 0);
7940
7941////////////////////////////////////////////////////////////////////////////////
7942
7943 bColor.setToWhite();
7944 mjr::colorRGBA32F::csCColdeRainbow::c(bColor, 0u);
7945 BOOST_TEST_CHECK(bColor.getRed() == mjr::colorRGBA32F::maxChanVal);
7946 BOOST_TEST_CHECK(bColor.getGreen() == mjr::colorRGBA32F::minChanVal);
7947 BOOST_TEST_CHECK(bColor.getBlue() == mjr::colorRGBA32F::minChanVal);
7948 BOOST_TEST_CHECK(bColor.getAlpha() == mjr::colorRGBA32F::maxChanVal); // unchanged
7949
7950 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCColdeRainbow::c(0*0x100000000ul).isCloseRGB(bColor.setToRed(), 0.000001F) == true);
7951 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCColdeRainbow::c(1*0x100000000ul).isCloseRGB(bColor.setToYellow(), 0.000001F) == true);
7952 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCColdeRainbow::c(2*0x100000000ul).isCloseRGB(bColor.setToGreen(), 0.000001F) == true);
7953 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCColdeRainbow::c(3*0x100000000ul).isCloseRGB(bColor.setToCyan(), 0.000001F) == true);
7954 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCColdeRainbow::c(4*0x100000000ul).isCloseRGB(bColor.setToBlue(), 0.000001F) == true);
7955 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCColdeRainbow::c(5*0x100000000ul).isCloseRGB(bColor.setToMagenta(), 0.000001F) == true);
7956 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCColdeRainbow::c(6*0x100000000ul).isCloseRGB(bColor.setToRed(), 0.000001F) == true);
7957
7958 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCColdeRainbow::c(6*0x100000000ul+1).isCloseRGB(bColor.setToRed(), 0.000001F) == true);
7959 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCColdeRainbow::c(7*0x100000000ul+1).isCloseRGB(bColor.setToYellow(), 0.000001F) == true);
7960
7961 for(uint64_t i=0; i<0x600000000; i=i+0x600000) // BOOST_TEST_CHECK x 4096
7962 BOOST_TEST_CHECK(mjr::colorRGBA32F::csCColdeRainbow::c(i).isCloseRGB(bColor.cmpRGBcornerDGradiant(i, "RYGCBMR"), 0.000001F) == true);
7963
7964 bColor.cmpRGBcornerDGradiant(168430090, "RYGCBMR");
7965 BOOST_TEST_CHECK(bColor.getRed() == 1, boost::test_tools::tolerance(0.00001));
7966 BOOST_TEST_CHECK(bColor.getGreen() == 0.0392156862745, boost::test_tools::tolerance(0.00001));
7967 BOOST_TEST_CHECK(bColor.getBlue() == 0, boost::test_tools::tolerance(0.00001));
7968}
7969
7970////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7971BOOST_AUTO_TEST_CASE(conCol) {
7972 // The simplicity of these functions doesn't warrant complex testing. If the constructors & set/get work on a simple test case, then they probably work.
7973
7974 mjr::color8c16b aColor {mjr::colorRGBA16b::minChanVal, mjr::colorRGBA16b::maxChanVal, mjr::colorRGBA16b::minChanVal, mjr::colorRGBA16b::maxChanVal, mjr::colorRGBA16b::minChanVal, mjr::colorRGBA16b::maxChanVal, mjr::colorRGBA16b::minChanVal, mjr::colorRGBA16b::maxChanVal, mjr::colorRGBA16b::minChanVal};
7975 mjr::color8c16b bColor {mjr::colorRGBA16b::maxChanVal, mjr::colorRGBA16b::minChanVal, mjr::colorRGBA16b::maxChanVal, mjr::colorRGBA16b::minChanVal, mjr::colorRGBA16b::maxChanVal, mjr::colorRGBA16b::minChanVal, mjr::colorRGBA16b::maxChanVal, mjr::colorRGBA16b::minChanVal, mjr::colorRGBA16b::maxChanVal};
7976
7977 BOOST_TEST_CHECK(aColor.getColConRGB_byte().isEqual( mjr::color8c16b::colConRGBbyte { 0, 255, 0 }) == true);
7978 BOOST_TEST_CHECK(bColor.getColConRGB_byte().isEqual( mjr::color8c16b::colConRGBbyte { 255, 0, 255 }) == true);
7979 BOOST_TEST_CHECK(aColor.getColConRGBA_byte().isEqual(mjr::color8c16b::colConRGBAbyte{ 0, 255, 0, 255 }) == true);
7980 BOOST_TEST_CHECK(bColor.getColConRGBA_byte().isEqual(mjr::color8c16b::colConRGBAbyte{ 255, 0, 255, 0 }) == true);
7981 BOOST_TEST_CHECK(aColor.getColConRGB_dbl().isEqual( mjr::color8c16b::colConRGBdbl { 0.0, 1.0, 0.0 }) == true);
7982 BOOST_TEST_CHECK(bColor.getColConRGB_dbl().isEqual( mjr::color8c16b::colConRGBdbl { 1.0, 0.0, 1.0 }) == true);
7983 BOOST_TEST_CHECK(aColor.getColConRGBA_dbl().isEqual( mjr::color8c16b::colConRGBAdbl { 0.0, 1.0, 0.0, 1.0 }) == true);
7984 BOOST_TEST_CHECK(bColor.getColConRGBA_dbl().isEqual( mjr::color8c16b::colConRGBAdbl { 1.0, 0.0, 1.0, 0.0 }) == true);
7985 BOOST_TEST_CHECK(aColor.getColCon_byte().isEqual( mjr::color8c16b::colConALLbyte { 0, 255, 0, 255, 0, 255, 0, 255 }) == true);
7986 BOOST_TEST_CHECK(bColor.getColCon_byte().isEqual( mjr::color8c16b::colConALLbyte { 255, 0, 255, 0, 255, 0, 255, 0 }) == true);
7987 BOOST_TEST_CHECK(aColor.getColCon_dbl().isEqual( mjr::color8c16b::colConALLdbl { 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0 }) == true);
7988 BOOST_TEST_CHECK(bColor.getColCon_dbl().isEqual( mjr::color8c16b::colConALLdbl { 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0 }) == true);
7989
7990 mjr::color8c16b cColor;
7991 mjr::color8c16b dColor;
7992
7993 mjr::color8c16b a3nColor {mjr::colorRGBA16b::minChanVal, mjr::colorRGBA16b::maxChanVal, mjr::colorRGBA16b::minChanVal, mjr::colorRGBA16b::minChanVal, mjr::colorRGBA16b::minChanVal, mjr::colorRGBA16b::minChanVal, mjr::colorRGBA16b::minChanVal, mjr::colorRGBA16b::minChanVal, mjr::colorRGBA16b::minChanVal};
7994 mjr::color8c16b b3xColor {mjr::colorRGBA16b::maxChanVal, mjr::colorRGBA16b::minChanVal, mjr::colorRGBA16b::maxChanVal, mjr::colorRGBA16b::maxChanVal, mjr::colorRGBA16b::maxChanVal, mjr::colorRGBA16b::maxChanVal, mjr::colorRGBA16b::maxChanVal, mjr::colorRGBA16b::maxChanVal, mjr::colorRGBA16b::maxChanVal};
7995 mjr::color8c16b a4nColor {mjr::colorRGBA16b::minChanVal, mjr::colorRGBA16b::maxChanVal, mjr::colorRGBA16b::minChanVal, mjr::colorRGBA16b::maxChanVal, mjr::colorRGBA16b::minChanVal, mjr::colorRGBA16b::minChanVal, mjr::colorRGBA16b::minChanVal, mjr::colorRGBA16b::minChanVal, mjr::colorRGBA16b::minChanVal};
7996 mjr::color8c16b b4xColor {mjr::colorRGBA16b::maxChanVal, mjr::colorRGBA16b::minChanVal, mjr::colorRGBA16b::maxChanVal, mjr::colorRGBA16b::minChanVal, mjr::colorRGBA16b::maxChanVal, mjr::colorRGBA16b::maxChanVal, mjr::colorRGBA16b::maxChanVal, mjr::colorRGBA16b::maxChanVal, mjr::colorRGBA16b::maxChanVal};
7997
7998 cColor.setToCorner(mjr::color8c16b::cornerColorEnum::BLACK);
7999 BOOST_TEST_CHECK(a3nColor.isEqual(cColor.setChansRGB_byte( mjr::color8c16b::colConRGBbyte { 0, 255, 0 })) == true);
8000 dColor.setToCorner(mjr::color8c16b::cornerColorEnum::WHITE);
8001 BOOST_TEST_CHECK(b3xColor.isEqual(dColor.setChansRGB_byte( mjr::color8c16b::colConRGBbyte { 255, 0, 255 })) == true);
8002 cColor.setToCorner(mjr::color8c16b::cornerColorEnum::BLACK);
8003 BOOST_TEST_CHECK(a4nColor.isEqual(cColor.setChansRGBA_byte(mjr::color8c16b::colConRGBAbyte{ 0, 255, 0, 255 })) == true);
8004 dColor.setToCorner(mjr::color8c16b::cornerColorEnum::WHITE);
8005 BOOST_TEST_CHECK(b4xColor.isEqual(dColor.setChansRGBA_byte(mjr::color8c16b::colConRGBAbyte{ 255, 0, 255, 0 })) == true);
8006 cColor.setToCorner(mjr::color8c16b::cornerColorEnum::BLACK);
8007 BOOST_TEST_CHECK(a3nColor.isEqual(cColor.setChansRGB_dbl( mjr::color8c16b::colConRGBdbl { 0.0, 1.0, 0.0 })) == true);
8008 dColor.setToCorner(mjr::color8c16b::cornerColorEnum::WHITE);
8009 BOOST_TEST_CHECK(b3xColor.isEqual(dColor.setChansRGB_dbl( mjr::color8c16b::colConRGBdbl { 1.0, 0.0, 1.0 })) == true);
8010 cColor.setToCorner(mjr::color8c16b::cornerColorEnum::BLACK);
8011 BOOST_TEST_CHECK(a4nColor.isEqual(cColor.setChansRGBA_dbl( mjr::color8c16b::colConRGBAdbl { 0.0, 1.0, 0.0, 1.0 })) == true);
8012 dColor.setToCorner(mjr::color8c16b::cornerColorEnum::WHITE);
8013 BOOST_TEST_CHECK(b4xColor.isEqual(dColor.setChansRGBA_dbl( mjr::color8c16b::colConRGBAdbl { 1.0, 0.0, 1.0, 0.0 })) == true);
8014 cColor.setToCorner(mjr::color8c16b::cornerColorEnum::BLACK);
8015 BOOST_TEST_CHECK(aColor.isEqual(cColor.setChans_byte( mjr::color8c16b::colConALLbyte { 0, 255, 0, 255, 0, 255, 0, 255 })) == true);
8016 dColor.setToCorner(mjr::color8c16b::cornerColorEnum::WHITE);
8017 BOOST_TEST_CHECK(bColor.isEqual(dColor.setChans_byte( mjr::color8c16b::colConALLbyte { 255, 0, 255, 0, 255, 0, 255, 0 })) == true);
8018 cColor.setToCorner(mjr::color8c16b::cornerColorEnum::BLACK);
8019 BOOST_TEST_CHECK(aColor.isEqual(cColor.setChans_dbl( mjr::color8c16b::colConALLdbl { 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0 })) == true);
8020 dColor.setToCorner(mjr::color8c16b::cornerColorEnum::WHITE);
8021 BOOST_TEST_CHECK(bColor.isEqual(dColor.setChans_dbl( mjr::color8c16b::colConALLdbl { 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0 })) == true);
8022}
8023
8024////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
8025BOOST_AUTO_TEST_CASE(bestNamedChan) {
8026 mjr::color1c8b aColor;
8027 mjr::color2c8b bColor;
8028 mjr::color3c8b cColor;
8029 mjr::color4c8b dColor;
8030 mjr::color8c8b eColor;
8031
8032 BOOST_TEST_CHECK(aColor.bestRedChan() == 0);
8033 BOOST_TEST_CHECK(bColor.bestRedChan() == 0);
8034 BOOST_TEST_CHECK(cColor.bestRedChan() == 0);
8035 BOOST_TEST_CHECK(dColor.bestRedChan() == 0);
8036 BOOST_TEST_CHECK(eColor.bestRedChan() == 0);
8037
8038 BOOST_TEST_CHECK(aColor.bestGreenChan() == 0);
8039 BOOST_TEST_CHECK(bColor.bestGreenChan() == 1);
8040 BOOST_TEST_CHECK(cColor.bestGreenChan() == 1);
8041 BOOST_TEST_CHECK(dColor.bestGreenChan() == 1);
8042 BOOST_TEST_CHECK(eColor.bestGreenChan() == 1);
8043
8044 BOOST_TEST_CHECK(aColor.bestBlueChan() == 0);
8045 BOOST_TEST_CHECK(bColor.bestBlueChan() == -1);
8046 BOOST_TEST_CHECK(cColor.bestBlueChan() == 2);
8047 BOOST_TEST_CHECK(dColor.bestBlueChan() == 2);
8048 BOOST_TEST_CHECK(eColor.bestBlueChan() == 2);
8049
8050 BOOST_TEST_CHECK(aColor.bestAlphaChan() == -1);
8051 BOOST_TEST_CHECK(bColor.bestAlphaChan() == -1);
8052 BOOST_TEST_CHECK(cColor.bestAlphaChan() == -1);
8053 BOOST_TEST_CHECK(dColor.bestAlphaChan() == 3);
8054 BOOST_TEST_CHECK(eColor.bestAlphaChan() == 3);
8055}
8056
8057////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
8058BOOST_AUTO_TEST_CASE(dist_deltaE, * boost::unit_test::tolerance(0.01)) {
8059
8060 mjr::colorRGBA8b aColor;
8061 mjr::colorRGBA8b bColor;
8062
8063 ////////////////////////////////////////////////////////////////////////////////
8064 aColor.setToWhite();
8065 bColor.setToBlack();
8066 BOOST_TEST_CHECK(aColor.distDeltaE1976(bColor) == 100.0);
8067 BOOST_TEST_CHECK(aColor.distDeltaE1994(bColor) == 100.0);
8068 aColor.setToWhite();
8069 bColor.setToWhite();
8070 BOOST_TEST_CHECK(aColor.distDeltaE1976(bColor) == 0.0);
8071 BOOST_TEST_CHECK(aColor.distDeltaE1994(bColor) == 0.0);
8072 aColor.setToBlack();
8073 bColor.setChansRGB(128, 64, 192);
8074 BOOST_TEST_CHECK(aColor.distDeltaE1976(bColor) == 87.0379);
8075 BOOST_TEST_CHECK(aColor.distDeltaE1994(bColor) == 87.0382);
8076 //BOOST_TEST_CHECK(aColor.distDeltaE2000(bColor) == 40.2871);
8077 aColor.setToBlack();
8078 bColor.setChansRGB(128, 128, 128);
8079 BOOST_TEST_CHECK(aColor.distDeltaE1976(bColor) == 53.585);
8080 BOOST_TEST_CHECK(aColor.distDeltaE1994(bColor) == 53.585);
8081 //BOOST_TEST_CHECK(aColor.distDeltaE2000(bColor) == 39.9344);
8082 aColor.setToBlack();
8083 bColor.setChansRGB(32, 64, 128);
8084 BOOST_TEST_CHECK(aColor.distDeltaE1976(bColor) == 50.1239);
8085 BOOST_TEST_CHECK(aColor.distDeltaE1994(bColor) == 50.1239);
8086 //BOOST_TEST_CHECK(aColor.distDeltaE2000(bColor) == 28.4580);
8087 aColor.setToWhite();
8088 bColor.setChansRGB(32, 64, 128);
8089 BOOST_TEST_CHECK(aColor.distDeltaE1976(bColor) == 82.8934);
8090 BOOST_TEST_CHECK(aColor.distDeltaE1994(bColor) == 82.8807);
8091 //BOOST_TEST_CHECK(aColor.distDeltaE2000(bColor) == 63.5853);
8092}
8093
8094/** @endcond */
8095
8096
8097// So far: 4239 hand written test cases
8098// So far: 8627 generated test cases