| 1 |
// SPDX-FileCopyrightText: 2008 Dominik Seichter <[email protected]> |
| 2 |
// SPDX-FileCopyrightText: 2021 Francesco Pretto <[email protected]> |
| 3 |
// SPDX-License-Identifier: MIT-0 |
| 4 |
|
| 5 |
#include <utility> |
| 6 |
|
| 7 |
#include <PdfTest.h> |
| 8 |
|
| 9 |
using namespace std; |
| 10 |
using namespace PoDoFo; |
| 11 |
|
| 12 |
class TestColor |
| 13 |
{ |
| 14 |
public: |
| 15 |
TestColor(int r, int g, int b, const char* colorName) : |
| 16 |
m_r(static_cast<double>(r) / 255.0), |
| 17 |
m_g(static_cast<double>(g) / 255.0), |
| 18 |
m_b(static_cast<double>(b) / 255.0), |
| 19 |
m_colorName(colorName) |
| 20 |
{ |
| 21 |
//do nothing |
| 22 |
} |
| 23 |
|
| 24 |
~TestColor() {} |
| 25 |
|
| 26 |
double getR() const { return m_r; } |
| 27 |
double getG() const { return m_g; } |
| 28 |
double getB() const { return m_b; } |
| 29 |
const char* getColorName() const { return m_colorName; } |
| 30 |
|
| 31 |
TestColor(const TestColor& rhs) : |
| 32 |
m_r(rhs.m_r), |
| 33 |
m_g(rhs.m_g), |
| 34 |
m_b(rhs.m_b), |
| 35 |
m_colorName(rhs.m_colorName) |
| 36 |
{ |
| 37 |
//do nothing |
| 38 |
} |
| 39 |
|
| 40 |
private: |
| 41 |
TestColor(); |
| 42 |
TestColor& operator=(const TestColor&) = delete; |
| 43 |
|
| 44 |
double m_r; |
| 45 |
double m_g; |
| 46 |
double m_b; |
| 47 |
const char* m_colorName; |
| 48 |
}; |
| 49 |
|
| 50 |
TEST_CASE("TestDefaultConstructor") |
| 51 |
{ |
| 52 |
PdfColor color; |
| 53 |
|
| 54 |
REQUIRE(color.IsGrayScale()); |
| 55 |
REQUIRE(color.GetColorSpace() == PdfColorSpaceType::DeviceGray); |
| 56 |
REQUIRE(color.GetGrayScale() == 0); |
| 57 |
REQUIRE(color.ConvertToGrayScale().GetGrayScale() == 0); |
| 58 |
REQUIRE(color.ConvertToRGB() == PdfColor(0, 0, 0)); |
| 59 |
REQUIRE(color.ConvertToCMYK() == PdfColor(0, 0, 0, 1)); |
| 60 |
|
| 61 |
auto arr = color.ToArray(); |
| 62 |
REQUIRE(arr.GetSize() == 1); |
| 63 |
REQUIRE(arr[0] == PdfObject(0.0)); |
| 64 |
|
| 65 |
REQUIRE(!color.IsRGB()); |
| 66 |
REQUIRE(!color.IsCMYK()); |
| 67 |
|
| 68 |
ASSERT_THROW_WITH_ERROR_CODE( |
| 69 |
color.GetRed(), |
| 70 |
PdfErrorCode::InternalLogic); |
| 71 |
|
| 72 |
ASSERT_THROW_WITH_ERROR_CODE( |
| 73 |
color.GetGreen(), |
| 74 |
PdfErrorCode::InternalLogic); |
| 75 |
|
| 76 |
ASSERT_THROW_WITH_ERROR_CODE( |
| 77 |
color.GetBlue(), |
| 78 |
PdfErrorCode::InternalLogic); |
| 79 |
|
| 80 |
ASSERT_THROW_WITH_ERROR_CODE( |
| 81 |
color.GetCyan(), |
| 82 |
PdfErrorCode::InternalLogic); |
| 83 |
|
| 84 |
ASSERT_THROW_WITH_ERROR_CODE( |
| 85 |
color.GetMagenta(), |
| 86 |
PdfErrorCode::InternalLogic); |
| 87 |
|
| 88 |
ASSERT_THROW_WITH_ERROR_CODE( |
| 89 |
color.GetYellow(), |
| 90 |
PdfErrorCode::InternalLogic); |
| 91 |
|
| 92 |
ASSERT_THROW_WITH_ERROR_CODE( |
| 93 |
color.GetBlack(), |
| 94 |
PdfErrorCode::InternalLogic); |
| 95 |
} |
| 96 |
|
| 97 |
TEST_CASE("TestGreyConstructor") |
| 98 |
{ |
| 99 |
const double GRAY_VALUE = 0.123; |
| 100 |
PdfColor color(GRAY_VALUE); |
| 101 |
|
| 102 |
REQUIRE(color.IsGrayScale()); |
| 103 |
REQUIRE(!color.IsRGB()); |
| 104 |
REQUIRE(!color.IsCMYK()); |
| 105 |
REQUIRE(color.GetColorSpace() == PdfColorSpaceType::DeviceGray); |
| 106 |
|
| 107 |
REQUIRE(color.GetGrayScale() == GRAY_VALUE); |
| 108 |
|
| 109 |
ASSERT_THROW_WITH_ERROR_CODE( |
| 110 |
color.GetRed(), |
| 111 |
PdfErrorCode::InternalLogic); |
| 112 |
|
| 113 |
ASSERT_THROW_WITH_ERROR_CODE( |
| 114 |
color.GetGreen(), |
| 115 |
PdfErrorCode::InternalLogic); |
| 116 |
|
| 117 |
ASSERT_THROW_WITH_ERROR_CODE( |
| 118 |
color.GetBlue(), |
| 119 |
PdfErrorCode::InternalLogic); |
| 120 |
|
| 121 |
ASSERT_THROW_WITH_ERROR_CODE( |
| 122 |
color.GetCyan(), |
| 123 |
PdfErrorCode::InternalLogic); |
| 124 |
|
| 125 |
ASSERT_THROW_WITH_ERROR_CODE( |
| 126 |
color.GetMagenta(), |
| 127 |
PdfErrorCode::InternalLogic); |
| 128 |
|
| 129 |
ASSERT_THROW_WITH_ERROR_CODE( |
| 130 |
color.GetYellow(), |
| 131 |
PdfErrorCode::InternalLogic); |
| 132 |
|
| 133 |
ASSERT_THROW_WITH_ERROR_CODE( |
| 134 |
color.GetBlack(), |
| 135 |
PdfErrorCode::InternalLogic); |
| 136 |
|
| 137 |
REQUIRE(color.ConvertToGrayScale() == color); |
| 138 |
|
| 139 |
REQUIRE(color.ConvertToRGB() == PdfColor(GRAY_VALUE, GRAY_VALUE, GRAY_VALUE)); |
| 140 |
|
| 141 |
REQUIRE(color.ConvertToRGB().ConvertToCMYK() == color.ConvertToCMYK()); |
| 142 |
|
| 143 |
const PdfArray COLOR_ARRAY = color.ToArray(); |
| 144 |
REQUIRE(COLOR_ARRAY.GetSize() == 1); |
| 145 |
REQUIRE(COLOR_ARRAY[0] == PdfObject(GRAY_VALUE)); |
| 146 |
|
| 147 |
} |
| 148 |
|
| 149 |
TEST_CASE("TestGrayConstructorInvalid") |
| 150 |
{ |
| 151 |
{ |
| 152 |
const double GRAY_VALUE = 1.01; |
| 153 |
ASSERT_THROW_WITH_ERROR_CODE( |
| 154 |
const PdfColor TEST_COLOR(GRAY_VALUE), |
| 155 |
PdfErrorCode::ValueOutOfRange); |
| 156 |
} |
| 157 |
|
| 158 |
{ |
| 159 |
const double GRAY_VALUE = -0.01; |
| 160 |
ASSERT_THROW_WITH_ERROR_CODE( |
| 161 |
const PdfColor TEST_COLOR(GRAY_VALUE), |
| 162 |
PdfErrorCode::ValueOutOfRange); |
| 163 |
} |
| 164 |
} |
| 165 |
|
| 166 |
TEST_CASE("TestRGBConstructor") |
| 167 |
{ |
| 168 |
const double R_VALUE = 0.023; |
| 169 |
const double G_VALUE = 0.345; |
| 170 |
const double B_VALUE = 0.678; |
| 171 |
PdfColor color(R_VALUE, G_VALUE, B_VALUE); |
| 172 |
|
| 173 |
REQUIRE(!color.IsGrayScale()); |
| 174 |
REQUIRE(color.IsRGB()); |
| 175 |
REQUIRE(!color.IsCMYK()); |
| 176 |
REQUIRE(color.GetColorSpace() == PdfColorSpaceType::DeviceRGB); |
| 177 |
|
| 178 |
ASSERT_THROW_WITH_ERROR_CODE( |
| 179 |
color.GetGrayScale(), |
| 180 |
PdfErrorCode::InternalLogic); |
| 181 |
|
| 182 |
REQUIRE(color.GetRed() == R_VALUE); |
| 183 |
REQUIRE(color.GetGreen() == G_VALUE); |
| 184 |
REQUIRE(color.GetBlue() == B_VALUE); |
| 185 |
|
| 186 |
ASSERT_THROW_WITH_ERROR_CODE( |
| 187 |
color.GetCyan(), |
| 188 |
PdfErrorCode::InternalLogic); |
| 189 |
|
| 190 |
ASSERT_THROW_WITH_ERROR_CODE( |
| 191 |
color.GetMagenta(), |
| 192 |
PdfErrorCode::InternalLogic); |
| 193 |
|
| 194 |
ASSERT_THROW_WITH_ERROR_CODE( |
| 195 |
color.GetYellow(), |
| 196 |
PdfErrorCode::InternalLogic); |
| 197 |
|
| 198 |
ASSERT_THROW_WITH_ERROR_CODE( |
| 199 |
color.GetBlack(), |
| 200 |
PdfErrorCode::InternalLogic); |
| 201 |
|
| 202 |
REQUIRE(color.ConvertToGrayScale() == PdfColor(0.299 * R_VALUE + 0.587 * G_VALUE + 0.114 * B_VALUE)); |
| 203 |
|
| 204 |
REQUIRE(color.ConvertToRGB() == PdfColor(R_VALUE, G_VALUE, B_VALUE)); |
| 205 |
|
| 206 |
{ |
| 207 |
double dBlack = std::min(1.0 - R_VALUE, std::min(1.0 - G_VALUE, 1.0 - B_VALUE)); |
| 208 |
double dCyan = (1.0 - R_VALUE - dBlack) / (1.0 - dBlack); |
| 209 |
double dMagenta = (1.0 - G_VALUE - dBlack) / (1.0 - dBlack); |
| 210 |
double dYellow = (1.0 - B_VALUE - dBlack) / (1.0 - dBlack); |
| 211 |
|
| 212 |
REQUIRE(color.ConvertToCMYK() == PdfColor(dCyan, dMagenta, dYellow, dBlack)); |
| 213 |
} |
| 214 |
|
| 215 |
const PdfArray COLOR_ARRAY = color.ToArray(); |
| 216 |
REQUIRE(COLOR_ARRAY.GetSize() == 3); |
| 217 |
REQUIRE(COLOR_ARRAY[0] == PdfObject(R_VALUE)); |
| 218 |
REQUIRE(COLOR_ARRAY[1] == PdfObject(G_VALUE)); |
| 219 |
REQUIRE(COLOR_ARRAY[2] == PdfObject(B_VALUE)); |
| 220 |
} |
| 221 |
|
| 222 |
TEST_CASE("TestRGBConstructorInvalid") |
| 223 |
{ |
| 224 |
{ |
| 225 |
const double R_VALUE = 1.023; |
| 226 |
const double G_VALUE = 0.345; |
| 227 |
const double B_VALUE = 0.678; |
| 228 |
ASSERT_THROW_WITH_ERROR_CODE( |
| 229 |
const PdfColor TEST_COLOR(R_VALUE, G_VALUE, B_VALUE), |
| 230 |
PdfErrorCode::ValueOutOfRange); |
| 231 |
} |
| 232 |
|
| 233 |
{ |
| 234 |
const double R_VALUE = 0.023; |
| 235 |
const double G_VALUE = 1.345; |
| 236 |
const double B_VALUE = 0.678; |
| 237 |
ASSERT_THROW_WITH_ERROR_CODE( |
| 238 |
const PdfColor TEST_COLOR(R_VALUE, G_VALUE, B_VALUE), |
| 239 |
PdfErrorCode::ValueOutOfRange); |
| 240 |
} |
| 241 |
|
| 242 |
{ |
| 243 |
const double R_VALUE = 0.023; |
| 244 |
const double G_VALUE = 0.345; |
| 245 |
const double B_VALUE = 2.678; |
| 246 |
ASSERT_THROW_WITH_ERROR_CODE( |
| 247 |
const PdfColor TEST_COLOR(R_VALUE, G_VALUE, B_VALUE), |
| 248 |
PdfErrorCode::ValueOutOfRange); |
| 249 |
} |
| 250 |
|
| 251 |
{ |
| 252 |
const double R_VALUE = -0.023; |
| 253 |
const double G_VALUE = 0.345; |
| 254 |
const double B_VALUE = 0.678; |
| 255 |
ASSERT_THROW_WITH_ERROR_CODE( |
| 256 |
const PdfColor TEST_COLOR(R_VALUE, G_VALUE, B_VALUE), |
| 257 |
PdfErrorCode::ValueOutOfRange); |
| 258 |
} |
| 259 |
|
| 260 |
{ |
| 261 |
const double R_VALUE = 0.023; |
| 262 |
const double G_VALUE = -0.345; |
| 263 |
const double B_VALUE = 0.678; |
| 264 |
ASSERT_THROW_WITH_ERROR_CODE( |
| 265 |
const PdfColor TEST_COLOR(R_VALUE, G_VALUE, B_VALUE), |
| 266 |
PdfErrorCode::ValueOutOfRange); |
| 267 |
} |
| 268 |
|
| 269 |
{ |
| 270 |
const double R_VALUE = 0.023; |
| 271 |
const double G_VALUE = 0.345; |
| 272 |
const double B_VALUE = -0.678; |
| 273 |
ASSERT_THROW_WITH_ERROR_CODE( |
| 274 |
const PdfColor TEST_COLOR(R_VALUE, G_VALUE, B_VALUE), |
| 275 |
PdfErrorCode::ValueOutOfRange); |
| 276 |
} |
| 277 |
|
| 278 |
} |
| 279 |
|
| 280 |
TEST_CASE("TestCMYKConstructor") |
| 281 |
{ |
| 282 |
const double C_VALUE = 0.1; |
| 283 |
const double M_VALUE = 0.2; |
| 284 |
const double Y_VALUE = 0.3; |
| 285 |
const double B_VALUE = 0.4; |
| 286 |
PdfColor color(C_VALUE, M_VALUE, Y_VALUE, B_VALUE); |
| 287 |
|
| 288 |
REQUIRE(!color.IsGrayScale()); |
| 289 |
REQUIRE(!color.IsRGB()); |
| 290 |
REQUIRE(color.IsCMYK()); |
| 291 |
REQUIRE(color.GetColorSpace() == PdfColorSpaceType::DeviceCMYK); |
| 292 |
|
| 293 |
ASSERT_THROW_WITH_ERROR_CODE( |
| 294 |
color.GetGrayScale(), |
| 295 |
PdfErrorCode::InternalLogic); |
| 296 |
|
| 297 |
ASSERT_THROW_WITH_ERROR_CODE( |
| 298 |
color.GetRed(), |
| 299 |
PdfErrorCode::InternalLogic); |
| 300 |
|
| 301 |
ASSERT_THROW_WITH_ERROR_CODE( |
| 302 |
color.GetGreen(), |
| 303 |
PdfErrorCode::InternalLogic); |
| 304 |
|
| 305 |
ASSERT_THROW_WITH_ERROR_CODE( |
| 306 |
color.GetBlue(), |
| 307 |
PdfErrorCode::InternalLogic); |
| 308 |
|
| 309 |
REQUIRE(color.GetCyan() == C_VALUE); |
| 310 |
REQUIRE(color.GetMagenta() == M_VALUE); |
| 311 |
REQUIRE(color.GetYellow() == Y_VALUE); |
| 312 |
REQUIRE(color.GetBlack() == B_VALUE); |
| 313 |
|
| 314 |
REQUIRE(color.ConvertToRGB().ConvertToGrayScale() == color.ConvertToGrayScale()); |
| 315 |
|
| 316 |
{ |
| 317 |
double dRed = C_VALUE * (1.0 - B_VALUE) + B_VALUE; |
| 318 |
double dGreen = M_VALUE * (1.0 - B_VALUE) + B_VALUE; |
| 319 |
double dBlue = Y_VALUE * (1.0 - B_VALUE) + B_VALUE; |
| 320 |
|
| 321 |
auto rgb1 = color.ConvertToRGB(); |
| 322 |
PdfColor rgb2(1.0 - dRed, 1.0 - dGreen, 1.0 - dBlue); |
| 323 |
|
| 324 |
ASSERT_EQUAL(rgb1.GetRed(), rgb2.GetRed()); |
| 325 |
ASSERT_EQUAL(rgb1.GetGreen(), rgb2.GetGreen()); |
| 326 |
ASSERT_EQUAL(rgb1.GetBlue(), rgb2.GetBlue()); |
| 327 |
} |
| 328 |
|
| 329 |
REQUIRE(color.ConvertToCMYK() == PdfColor(C_VALUE, M_VALUE, Y_VALUE, B_VALUE)); |
| 330 |
|
| 331 |
const PdfArray COLOR_ARRAY = color.ToArray(); |
| 332 |
REQUIRE(COLOR_ARRAY.GetSize() == 4); |
| 333 |
REQUIRE(COLOR_ARRAY[0] == PdfObject(C_VALUE)); |
| 334 |
REQUIRE(COLOR_ARRAY[1] == PdfObject(M_VALUE)); |
| 335 |
REQUIRE(COLOR_ARRAY[2] == PdfObject(Y_VALUE)); |
| 336 |
REQUIRE(COLOR_ARRAY[3] == PdfObject(B_VALUE)); |
| 337 |
} |
| 338 |
|
| 339 |
TEST_CASE("TestCMYKConstructorInvalid") |
| 340 |
{ |
| 341 |
{ |
| 342 |
const double C_VALUE = 1.1; |
| 343 |
const double M_VALUE = 0.2; |
| 344 |
const double Y_VALUE = 0.3; |
| 345 |
const double B_VALUE = 0.4; |
| 346 |
ASSERT_THROW_WITH_ERROR_CODE( |
| 347 |
const PdfColor TEST_COLOR(C_VALUE, M_VALUE, Y_VALUE, B_VALUE), |
| 348 |
PdfErrorCode::ValueOutOfRange); |
| 349 |
} |
| 350 |
|
| 351 |
{ |
| 352 |
const double C_VALUE = 0.1; |
| 353 |
const double M_VALUE = 1.2; |
| 354 |
const double Y_VALUE = 0.3; |
| 355 |
const double B_VALUE = 0.4; |
| 356 |
ASSERT_THROW_WITH_ERROR_CODE( |
| 357 |
const PdfColor TEST_COLOR(C_VALUE, M_VALUE, Y_VALUE, B_VALUE), |
| 358 |
PdfErrorCode::ValueOutOfRange); |
| 359 |
} |
| 360 |
|
| 361 |
{ |
| 362 |
const double C_VALUE = 0.1; |
| 363 |
const double M_VALUE = 0.2; |
| 364 |
const double Y_VALUE = 1.3; |
| 365 |
const double B_VALUE = 0.4; |
| 366 |
ASSERT_THROW_WITH_ERROR_CODE( |
| 367 |
const PdfColor TEST_COLOR(C_VALUE, M_VALUE, Y_VALUE, B_VALUE), |
| 368 |
PdfErrorCode::ValueOutOfRange); |
| 369 |
} |
| 370 |
|
| 371 |
{ |
| 372 |
const double C_VALUE = 0.1; |
| 373 |
const double M_VALUE = 0.2; |
| 374 |
const double Y_VALUE = 0.3; |
| 375 |
const double B_VALUE = 1.4; |
| 376 |
ASSERT_THROW_WITH_ERROR_CODE( |
| 377 |
const PdfColor TEST_COLOR(C_VALUE, M_VALUE, Y_VALUE, B_VALUE), |
| 378 |
PdfErrorCode::ValueOutOfRange); |
| 379 |
} |
| 380 |
|
| 381 |
{ |
| 382 |
const double C_VALUE = -0.1; |
| 383 |
const double M_VALUE = 0.2; |
| 384 |
const double Y_VALUE = 0.3; |
| 385 |
const double B_VALUE = 0.4; |
| 386 |
ASSERT_THROW_WITH_ERROR_CODE( |
| 387 |
const PdfColor TEST_COLOR(C_VALUE, M_VALUE, Y_VALUE, B_VALUE), |
| 388 |
PdfErrorCode::ValueOutOfRange); |
| 389 |
} |
| 390 |
|
| 391 |
{ |
| 392 |
const double C_VALUE = 0.1; |
| 393 |
const double M_VALUE = -0.2; |
| 394 |
const double Y_VALUE = 0.3; |
| 395 |
const double B_VALUE = 0.4; |
| 396 |
ASSERT_THROW_WITH_ERROR_CODE( |
| 397 |
const PdfColor TEST_COLOR(C_VALUE, M_VALUE, Y_VALUE, B_VALUE), |
| 398 |
PdfErrorCode::ValueOutOfRange); |
| 399 |
} |
| 400 |
|
| 401 |
{ |
| 402 |
const double C_VALUE = 0.1; |
| 403 |
const double M_VALUE = 0.2; |
| 404 |
const double Y_VALUE = -0.3; |
| 405 |
const double B_VALUE = 0.4; |
| 406 |
ASSERT_THROW_WITH_ERROR_CODE( |
| 407 |
const PdfColor TEST_COLOR(C_VALUE, M_VALUE, Y_VALUE, B_VALUE), |
| 408 |
PdfErrorCode::ValueOutOfRange); |
| 409 |
} |
| 410 |
|
| 411 |
{ |
| 412 |
const double C_VALUE = 0.1; |
| 413 |
const double M_VALUE = 0.2; |
| 414 |
const double Y_VALUE = 0.3; |
| 415 |
const double B_VALUE = -0.4; |
| 416 |
ASSERT_THROW_WITH_ERROR_CODE( |
| 417 |
const PdfColor TEST_COLOR(C_VALUE, M_VALUE, Y_VALUE, B_VALUE), |
| 418 |
PdfErrorCode::ValueOutOfRange); |
| 419 |
} |
| 420 |
|
| 421 |
} |
| 422 |
|
| 423 |
TEST_CASE("TestCopyConstructor") |
| 424 |
{ |
| 425 |
{ |
| 426 |
const double GRAY_VALUE = 0.123; |
| 427 |
PdfColor initialColor(GRAY_VALUE); |
| 428 |
PdfColor color(initialColor); |
| 429 |
|
| 430 |
REQUIRE(color.IsGrayScale()); |
| 431 |
REQUIRE(!color.IsRGB()); |
| 432 |
REQUIRE(!color.IsCMYK()); |
| 433 |
REQUIRE(color.GetColorSpace() == PdfColorSpaceType::DeviceGray); |
| 434 |
|
| 435 |
REQUIRE(color.GetGrayScale() == GRAY_VALUE); |
| 436 |
} |
| 437 |
|
| 438 |
{ |
| 439 |
const double R_VALUE = 0.023; |
| 440 |
const double G_VALUE = 0.345; |
| 441 |
const double B_VALUE = 0.678; |
| 442 |
PdfColor initialColor(R_VALUE, G_VALUE, B_VALUE); |
| 443 |
PdfColor color(initialColor); |
| 444 |
|
| 445 |
REQUIRE(!color.IsGrayScale()); |
| 446 |
REQUIRE(color.IsRGB()); |
| 447 |
REQUIRE(!color.IsCMYK()); |
| 448 |
REQUIRE(color.GetColorSpace() == PdfColorSpaceType::DeviceRGB); |
| 449 |
|
| 450 |
REQUIRE(color.GetRed() == R_VALUE); |
| 451 |
REQUIRE(color.GetGreen() == G_VALUE); |
| 452 |
REQUIRE(color.GetBlue() == B_VALUE); |
| 453 |
} |
| 454 |
|
| 455 |
{ |
| 456 |
const double C_VALUE = 0.1; |
| 457 |
const double M_VALUE = 0.2; |
| 458 |
const double Y_VALUE = 0.3; |
| 459 |
const double B_VALUE = 0.4; |
| 460 |
PdfColor initialColor(C_VALUE, M_VALUE, Y_VALUE, B_VALUE); |
| 461 |
PdfColor color(initialColor); |
| 462 |
|
| 463 |
REQUIRE(!color.IsGrayScale()); |
| 464 |
REQUIRE(!color.IsRGB()); |
| 465 |
REQUIRE(color.IsCMYK()); |
| 466 |
REQUIRE(color.GetColorSpace() == PdfColorSpaceType::DeviceCMYK); |
| 467 |
|
| 468 |
REQUIRE(color.GetCyan() == C_VALUE); |
| 469 |
REQUIRE(color.GetMagenta() == M_VALUE); |
| 470 |
REQUIRE(color.GetYellow() == Y_VALUE); |
| 471 |
REQUIRE(color.GetBlack() == B_VALUE); |
| 472 |
} |
| 473 |
} |
| 474 |
|
| 475 |
TEST_CASE("TestAssignmentOperator") |
| 476 |
{ |
| 477 |
{ |
| 478 |
const double GRAY_VALUE = 0.123; |
| 479 |
PdfColor initialColor(GRAY_VALUE); |
| 480 |
PdfColor color; |
| 481 |
color = initialColor; |
| 482 |
|
| 483 |
REQUIRE(color.IsGrayScale()); |
| 484 |
REQUIRE(!color.IsRGB()); |
| 485 |
REQUIRE(!color.IsCMYK()); |
| 486 |
REQUIRE(color.GetColorSpace() == PdfColorSpaceType::DeviceGray); |
| 487 |
|
| 488 |
REQUIRE(color.GetGrayScale() == GRAY_VALUE); |
| 489 |
} |
| 490 |
|
| 491 |
{ |
| 492 |
const double R_VALUE = 0.023; |
| 493 |
const double G_VALUE = 0.345; |
| 494 |
const double B_VALUE = 0.678; |
| 495 |
PdfColor initialColor(R_VALUE, G_VALUE, B_VALUE); |
| 496 |
PdfColor color; |
| 497 |
color = initialColor; |
| 498 |
|
| 499 |
REQUIRE(!color.IsGrayScale()); |
| 500 |
REQUIRE(color.IsRGB()); |
| 501 |
REQUIRE(!color.IsCMYK()); |
| 502 |
REQUIRE(color.GetColorSpace() == PdfColorSpaceType::DeviceRGB); |
| 503 |
|
| 504 |
REQUIRE(color.GetRed() == R_VALUE); |
| 505 |
REQUIRE(color.GetGreen() == G_VALUE); |
| 506 |
REQUIRE(color.GetBlue() == B_VALUE); |
| 507 |
} |
| 508 |
|
| 509 |
{ |
| 510 |
const double C_VALUE = 0.1; |
| 511 |
const double M_VALUE = 0.2; |
| 512 |
const double Y_VALUE = 0.3; |
| 513 |
const double B_VALUE = 0.4; |
| 514 |
PdfColor initialColor(C_VALUE, M_VALUE, Y_VALUE, B_VALUE); |
| 515 |
PdfColor color; |
| 516 |
color = initialColor; |
| 517 |
|
| 518 |
REQUIRE(!color.IsGrayScale()); |
| 519 |
REQUIRE(!color.IsRGB()); |
| 520 |
REQUIRE(color.IsCMYK()); |
| 521 |
REQUIRE(color.GetColorSpace() == PdfColorSpaceType::DeviceCMYK); |
| 522 |
|
| 523 |
REQUIRE(color.GetCyan() == C_VALUE); |
| 524 |
REQUIRE(color.GetMagenta() == M_VALUE); |
| 525 |
REQUIRE(color.GetYellow() == Y_VALUE); |
| 526 |
REQUIRE(color.GetBlack() == B_VALUE); |
| 527 |
} |
| 528 |
} |
| 529 |
|
| 530 |
TEST_CASE("TestEqualsOperator") |
| 531 |
{ |
| 532 |
//Grey test |
| 533 |
{ //Positive |
| 534 |
const double GRAY_VALUE = 0.123; |
| 535 |
PdfColor lColor(GRAY_VALUE); |
| 536 |
PdfColor rColor(GRAY_VALUE); |
| 537 |
|
| 538 |
REQUIRE(lColor == rColor); |
| 539 |
} |
| 540 |
|
| 541 |
{ //Negative |
| 542 |
const double L_GREY_VALUE = 0.123; |
| 543 |
PdfColor lColor(L_GREY_VALUE); |
| 544 |
const double R_GREY_VALUE = 0.124; |
| 545 |
PdfColor rColor(R_GREY_VALUE); |
| 546 |
|
| 547 |
REQUIRE(L_GREY_VALUE != R_GREY_VALUE); |
| 548 |
REQUIRE(lColor != rColor); |
| 549 |
} |
| 550 |
|
| 551 |
//RGB tests |
| 552 |
{ //Positive |
| 553 |
const double L_R_VALUE = 0.023; |
| 554 |
const double L_G_VALUE = 0.345; |
| 555 |
const double L_B_VALUE = 0.678; |
| 556 |
PdfColor lColor(L_R_VALUE, L_G_VALUE, L_B_VALUE); |
| 557 |
const double R_R_VALUE = 0.023; |
| 558 |
const double R_G_VALUE = 0.345; |
| 559 |
const double R_B_VALUE = 0.678; |
| 560 |
PdfColor rColor(R_R_VALUE, R_G_VALUE, R_B_VALUE); |
| 561 |
|
| 562 |
REQUIRE(L_R_VALUE == R_R_VALUE); |
| 563 |
REQUIRE(L_G_VALUE == R_G_VALUE); |
| 564 |
REQUIRE(L_B_VALUE == R_B_VALUE); |
| 565 |
REQUIRE(lColor == rColor); |
| 566 |
} |
| 567 |
|
| 568 |
{ //Negative |
| 569 |
const double L_R_VALUE = 0.023; |
| 570 |
const double L_G_VALUE = 0.345; |
| 571 |
const double L_B_VALUE = 0.678; |
| 572 |
PdfColor lColor(L_R_VALUE, L_G_VALUE, L_B_VALUE); |
| 573 |
const double R_R_VALUE = 0.100; |
| 574 |
const double R_G_VALUE = 0.345; |
| 575 |
const double R_B_VALUE = 0.678; |
| 576 |
PdfColor rColor(R_R_VALUE, R_G_VALUE, R_B_VALUE); |
| 577 |
|
| 578 |
REQUIRE(L_R_VALUE != R_R_VALUE); |
| 579 |
REQUIRE(L_G_VALUE == R_G_VALUE); |
| 580 |
REQUIRE(L_B_VALUE == R_B_VALUE); |
| 581 |
REQUIRE(lColor != rColor); |
| 582 |
} |
| 583 |
|
| 584 |
{ //Negative |
| 585 |
const double L_R_VALUE = 0.023; |
| 586 |
const double L_G_VALUE = 0.345; |
| 587 |
const double L_B_VALUE = 0.678; |
| 588 |
PdfColor lColor(L_R_VALUE, L_G_VALUE, L_B_VALUE); |
| 589 |
const double R_R_VALUE = 0.023; |
| 590 |
const double R_G_VALUE = 0.340; |
| 591 |
const double R_B_VALUE = 0.678; |
| 592 |
PdfColor rColor(R_R_VALUE, R_G_VALUE, R_B_VALUE); |
| 593 |
|
| 594 |
REQUIRE(L_R_VALUE == R_R_VALUE); |
| 595 |
REQUIRE(L_G_VALUE != R_G_VALUE); |
| 596 |
REQUIRE(L_B_VALUE == R_B_VALUE); |
| 597 |
REQUIRE(lColor != rColor); |
| 598 |
} |
| 599 |
|
| 600 |
{ //Negative |
| 601 |
const double L_R_VALUE = 0.023; |
| 602 |
const double L_G_VALUE = 0.345; |
| 603 |
const double L_B_VALUE = 0.678; |
| 604 |
PdfColor lColor(L_R_VALUE, L_G_VALUE, L_B_VALUE); |
| 605 |
const double R_R_VALUE = 0.023; |
| 606 |
const double R_G_VALUE = 0.345; |
| 607 |
const double R_B_VALUE = 0.677; |
| 608 |
PdfColor rColor(R_R_VALUE, R_G_VALUE, R_B_VALUE); |
| 609 |
|
| 610 |
REQUIRE(L_R_VALUE == R_R_VALUE); |
| 611 |
REQUIRE(L_G_VALUE == R_G_VALUE); |
| 612 |
REQUIRE(L_B_VALUE != R_B_VALUE); |
| 613 |
REQUIRE(lColor != rColor); |
| 614 |
} |
| 615 |
|
| 616 |
//CMYB tests |
| 617 |
{ //Positive |
| 618 |
const double L_C_VALUE = 0.1; |
| 619 |
const double L_M_VALUE = 0.2; |
| 620 |
const double L_Y_VALUE = 0.3; |
| 621 |
const double L_B_VALUE = 0.4; |
| 622 |
PdfColor lColor(L_C_VALUE, L_M_VALUE, L_Y_VALUE, L_B_VALUE); |
| 623 |
const double R_C_VALUE = 0.1; |
| 624 |
const double R_M_VALUE = 0.2; |
| 625 |
const double R_Y_VALUE = 0.3; |
| 626 |
const double R_B_VALUE = 0.4; |
| 627 |
PdfColor rColor(R_C_VALUE, R_M_VALUE, R_Y_VALUE, R_B_VALUE); |
| 628 |
|
| 629 |
REQUIRE(L_C_VALUE == R_C_VALUE); |
| 630 |
REQUIRE(L_M_VALUE == R_M_VALUE); |
| 631 |
REQUIRE(L_Y_VALUE == R_Y_VALUE); |
| 632 |
REQUIRE(L_B_VALUE == R_B_VALUE); |
| 633 |
REQUIRE(lColor == rColor); |
| 634 |
} |
| 635 |
|
| 636 |
{ //Negative |
| 637 |
const double L_C_VALUE = 0.1; |
| 638 |
const double L_M_VALUE = 0.2; |
| 639 |
const double L_Y_VALUE = 0.3; |
| 640 |
const double L_B_VALUE = 0.4; |
| 641 |
PdfColor lColor(L_C_VALUE, L_M_VALUE, L_Y_VALUE, L_B_VALUE); |
| 642 |
const double R_C_VALUE = 0.11; |
| 643 |
const double R_M_VALUE = 0.2; |
| 644 |
const double R_Y_VALUE = 0.3; |
| 645 |
const double R_B_VALUE = 0.4; |
| 646 |
PdfColor rColor(R_C_VALUE, R_M_VALUE, R_Y_VALUE, R_B_VALUE); |
| 647 |
|
| 648 |
REQUIRE(L_C_VALUE != R_C_VALUE); |
| 649 |
REQUIRE(L_M_VALUE == R_M_VALUE); |
| 650 |
REQUIRE(L_Y_VALUE == R_Y_VALUE); |
| 651 |
REQUIRE(L_B_VALUE == R_B_VALUE); |
| 652 |
REQUIRE(lColor != rColor); |
| 653 |
} |
| 654 |
|
| 655 |
{ //Negative |
| 656 |
const double L_C_VALUE = 0.1; |
| 657 |
const double L_M_VALUE = 0.2; |
| 658 |
const double L_Y_VALUE = 0.3; |
| 659 |
const double L_B_VALUE = 0.4; |
| 660 |
PdfColor lColor(L_C_VALUE, L_M_VALUE, L_Y_VALUE, L_B_VALUE); |
| 661 |
const double R_C_VALUE = 0.1; |
| 662 |
const double R_M_VALUE = 0.21; |
| 663 |
const double R_Y_VALUE = 0.3; |
| 664 |
const double R_B_VALUE = 0.4; |
| 665 |
PdfColor rColor(R_C_VALUE, R_M_VALUE, R_Y_VALUE, R_B_VALUE); |
| 666 |
|
| 667 |
REQUIRE(L_C_VALUE == R_C_VALUE); |
| 668 |
REQUIRE(L_M_VALUE != R_M_VALUE); |
| 669 |
REQUIRE(L_Y_VALUE == R_Y_VALUE); |
| 670 |
REQUIRE(L_B_VALUE == R_B_VALUE); |
| 671 |
REQUIRE(lColor != rColor); |
| 672 |
} |
| 673 |
|
| 674 |
{ //Negative |
| 675 |
const double L_C_VALUE = 0.1; |
| 676 |
const double L_M_VALUE = 0.2; |
| 677 |
const double L_Y_VALUE = 0.31; |
| 678 |
const double L_B_VALUE = 0.4; |
| 679 |
PdfColor lColor(L_C_VALUE, L_M_VALUE, L_Y_VALUE, L_B_VALUE); |
| 680 |
const double R_C_VALUE = 0.1; |
| 681 |
const double R_M_VALUE = 0.2; |
| 682 |
const double R_Y_VALUE = 0.3; |
| 683 |
const double R_B_VALUE = 0.4; |
| 684 |
PdfColor rColor(R_C_VALUE, R_M_VALUE, R_Y_VALUE, R_B_VALUE); |
| 685 |
|
| 686 |
REQUIRE(L_C_VALUE == R_C_VALUE); |
| 687 |
REQUIRE(L_M_VALUE == R_M_VALUE); |
| 688 |
REQUIRE(L_Y_VALUE != R_Y_VALUE); |
| 689 |
REQUIRE(L_B_VALUE == R_B_VALUE); |
| 690 |
REQUIRE(lColor != rColor); |
| 691 |
} |
| 692 |
|
| 693 |
{ //Negative |
| 694 |
const double L_C_VALUE = 0.1; |
| 695 |
const double L_M_VALUE = 0.2; |
| 696 |
const double L_Y_VALUE = 0.3; |
| 697 |
const double L_B_VALUE = 0.4; |
| 698 |
PdfColor lColor(L_C_VALUE, L_M_VALUE, L_Y_VALUE, L_B_VALUE); |
| 699 |
const double R_C_VALUE = 0.1; |
| 700 |
const double R_M_VALUE = 0.2; |
| 701 |
const double R_Y_VALUE = 0.3; |
| 702 |
const double R_B_VALUE = 0.45; |
| 703 |
PdfColor rColor(R_C_VALUE, R_M_VALUE, R_Y_VALUE, R_B_VALUE); |
| 704 |
|
| 705 |
REQUIRE(L_C_VALUE == R_C_VALUE); |
| 706 |
REQUIRE(L_M_VALUE == R_M_VALUE); |
| 707 |
REQUIRE(L_Y_VALUE == R_Y_VALUE); |
| 708 |
REQUIRE(L_B_VALUE != R_B_VALUE); |
| 709 |
REQUIRE(lColor != rColor); |
| 710 |
} |
| 711 |
|
| 712 |
} |
| 713 |
|
| 714 |
TEST_CASE("TestHexNames") |
| 715 |
{ |
| 716 |
{ |
| 717 |
PdfColor rgb = PdfColor::CreateFromString("#FF0AEF"); |
| 718 |
REQUIRE(rgb.IsRGB()); |
| 719 |
REQUIRE(static_cast<int>(rgb.GetRed() * 255.0) == 0xFF); |
| 720 |
REQUIRE(static_cast<int>(rgb.GetGreen() * 255.0) == 0x0A); |
| 721 |
REQUIRE(static_cast<int>(rgb.GetBlue() * 255.0) == 0xEF); |
| 722 |
} |
| 723 |
|
| 724 |
{ |
| 725 |
PdfColor rgb = PdfColor::CreateFromString("#012345"); |
| 726 |
REQUIRE(rgb.IsRGB()); |
| 727 |
REQUIRE(static_cast<int>(rgb.GetRed() * 255.0) == 0x01); |
| 728 |
REQUIRE(static_cast<int>(rgb.GetGreen() * 255.0) == 0x23); |
| 729 |
REQUIRE(static_cast<int>(rgb.GetBlue() * 255.0) == 0x45); |
| 730 |
} |
| 731 |
|
| 732 |
{ |
| 733 |
PdfColor rgb = PdfColor::CreateFromString("#ABCDEF"); |
| 734 |
REQUIRE(rgb.IsRGB()); |
| 735 |
REQUIRE(static_cast<int>(rgb.GetRed() * 255.0) == 0xAB); |
| 736 |
REQUIRE(static_cast<int>(rgb.GetGreen() * 255.0) == 0xCD); |
| 737 |
REQUIRE(static_cast<int>(rgb.GetBlue() * 255.0) == 0xEF); |
| 738 |
} |
| 739 |
|
| 740 |
{ |
| 741 |
PdfColor rgb = PdfColor::CreateFromString("#abcdef"); |
| 742 |
REQUIRE(rgb.IsRGB()); |
| 743 |
REQUIRE(static_cast<int>(rgb.GetRed() * 255.0) == 0xAB); |
| 744 |
REQUIRE(static_cast<int>(rgb.GetGreen() * 255.0) == 0xCD); |
| 745 |
REQUIRE(static_cast<int>(rgb.GetBlue() * 255.0) == 0xEF); |
| 746 |
} |
| 747 |
|
| 748 |
{ |
| 749 |
PdfColor invalidColour = PdfColor::CreateFromString("#01"); |
| 750 |
REQUIRE(invalidColour == PdfColor()); |
| 751 |
} |
| 752 |
|
| 753 |
{ |
| 754 |
PdfColor invalidColour = PdfColor::CreateFromString("#123456789"); |
| 755 |
REQUIRE(invalidColour == PdfColor()); |
| 756 |
} |
| 757 |
|
| 758 |
{ |
| 759 |
ASSERT_THROW_WITH_ERROR_CODE( |
| 760 |
PdfColor::CreateFromString("#12345g"), |
| 761 |
PdfErrorCode::CannotConvertColor); |
| 762 |
} |
| 763 |
|
| 764 |
{ |
| 765 |
ASSERT_THROW_WITH_ERROR_CODE( |
| 766 |
PdfColor::CreateFromString("#1234g5"), |
| 767 |
PdfErrorCode::CannotConvertColor); |
| 768 |
} |
| 769 |
|
| 770 |
PdfColor cmyk = PdfColor::CreateFromString("#ABCDEF01"); |
| 771 |
REQUIRE(cmyk.IsCMYK()); |
| 772 |
REQUIRE(static_cast<int>(cmyk.GetCyan() * 255.0) == 0xAB); |
| 773 |
REQUIRE(static_cast<int>(cmyk.GetMagenta() * 255.0) == 0xCD); |
| 774 |
REQUIRE(static_cast<int>(cmyk.GetYellow() * 255.0) == 0xEF); |
| 775 |
REQUIRE(static_cast<int>(cmyk.GetBlack() * 255.0) == 0x01); |
| 776 |
} |
| 777 |
|
| 778 |
TEST_CASE("TestNamesGeneral") |
| 779 |
{ |
| 780 |
PdfColor aliceBlue = PdfColor::CreateFromString("aliceblue"); |
| 781 |
REQUIRE(aliceBlue == PdfColor::CreateFromString("#F0F8FF")); |
| 782 |
REQUIRE(aliceBlue.GetRed() == static_cast<double>(0xF0) / 255.0); |
| 783 |
REQUIRE(aliceBlue.GetGreen() == static_cast<double>(0xF8) / 255.0); |
| 784 |
REQUIRE(aliceBlue.GetBlue() == static_cast<double>(0xFF) / 255.0); |
| 785 |
|
| 786 |
PdfColor lime = PdfColor::CreateFromString("lime"); |
| 787 |
REQUIRE(lime == PdfColor(0.000, 1.000, 0.000)); |
| 788 |
|
| 789 |
PdfColor yellowGreen = PdfColor::CreateFromString("yellowgreen"); |
| 790 |
REQUIRE(yellowGreen == PdfColor::CreateFromString("#9ACD32")); |
| 791 |
|
| 792 |
{ |
| 793 |
// Test a not existing color |
| 794 |
PdfColor notExist = PdfColor::CreateFromString("asfaf9q341"); |
| 795 |
REQUIRE(notExist == PdfColor()); |
| 796 |
} |
| 797 |
|
| 798 |
{ |
| 799 |
// Test a not existing color |
| 800 |
PdfColor notExist = PdfColor::CreateFromString("A"); |
| 801 |
REQUIRE(notExist == PdfColor()); |
| 802 |
} |
| 803 |
|
| 804 |
{ |
| 805 |
// Test a not existing color |
| 806 |
PdfColor notExist = PdfColor::CreateFromString(""); |
| 807 |
REQUIRE(notExist == PdfColor()); |
| 808 |
} |
| 809 |
|
| 810 |
{ |
| 811 |
// Test a not existing color |
| 812 |
PdfColor notExist = PdfColor::CreateFromString("yellowgree"); |
| 813 |
REQUIRE(notExist == PdfColor()); |
| 814 |
} |
| 815 |
|
| 816 |
{ |
| 817 |
// Test a not existing color |
| 818 |
PdfColor notExist = PdfColor::CreateFromString("yellowgreem"); |
| 819 |
REQUIRE(notExist == PdfColor()); |
| 820 |
} |
| 821 |
|
| 822 |
{ |
| 823 |
// Test a not existing color |
| 824 |
PdfColor notExist = PdfColor::CreateFromString("yellowgreen "); |
| 825 |
REQUIRE(notExist == PdfColor()); |
| 826 |
} |
| 827 |
} |
| 828 |
|
| 829 |
TEST_CASE("TestNamesOneByOne") |
| 830 |
{ |
| 831 |
//Copied and adjusted from http://cvsweb.xfree86.org/cvsweb/xc/programs/rgb/rgb.txt?rev=1.2 |
| 832 |
const TestColor TABLE_OF_TEST_COLORS[] = |
| 833 |
{ |
| 834 |
TestColor(255, 250, 250, "snow"), |
| 835 |
TestColor(248, 248, 255, "GhostWhite"), |
| 836 |
TestColor(245, 245, 245, "WhiteSmoke"), |
| 837 |
TestColor(220, 220, 220, "gainsboro"), |
| 838 |
TestColor(255, 250, 240, "FloralWhite"), |
| 839 |
TestColor(253, 245, 230, "OldLace"), |
| 840 |
TestColor(250, 240, 230, "linen"), |
| 841 |
TestColor(250, 235, 215, "AntiqueWhite"), |
| 842 |
TestColor(255, 239, 213, "PapayaWhip"), |
| 843 |
TestColor(255, 235, 205, "BlanchedAlmond"), |
| 844 |
TestColor(255, 228, 196, "bisque"), |
| 845 |
TestColor(255, 218, 185, "PeachPuff"), |
| 846 |
TestColor(255, 222, 173, "NavajoWhite"), |
| 847 |
TestColor(255, 228, 181, "moccasin"), |
| 848 |
TestColor(255, 248, 220, "cornsilk"), |
| 849 |
TestColor(255, 255, 240, "ivory"), |
| 850 |
TestColor(255, 250, 205, "LemonChiffon"), |
| 851 |
TestColor(255, 245, 238, "seashell"), |
| 852 |
TestColor(240, 255, 240, "honeydew"), |
| 853 |
TestColor(245, 255, 250, "MintCream"), |
| 854 |
TestColor(240, 255, 255, "azure"), |
| 855 |
TestColor(240, 248, 255, "AliceBlue"), |
| 856 |
TestColor(230, 230, 250, "lavender"), |
| 857 |
TestColor(255, 240, 245, "LavenderBlush"), |
| 858 |
TestColor(255, 228, 225, "MistyRose"), |
| 859 |
TestColor(255, 255, 255, "white"), |
| 860 |
TestColor(0, 0, 0, "black"), |
| 861 |
TestColor(47, 79, 79, "DarkSlateGray"), |
| 862 |
TestColor(47, 79, 79, "DarkSlateGrey"), |
| 863 |
TestColor(105, 105, 105, "DimGray"), |
| 864 |
TestColor(105, 105, 105, "DimGrey"), |
| 865 |
TestColor(112, 128, 144, "SlateGray"), |
| 866 |
TestColor(112, 128, 144, "SlateGrey"), |
| 867 |
TestColor(119, 136, 153, "LightSlateGray"), |
| 868 |
TestColor(119, 136, 153, "LightSlateGrey"), |
| 869 |
TestColor(190, 190, 190, "gray"), |
| 870 |
TestColor(190, 190, 190, "grey"), |
| 871 |
TestColor(211, 211, 211, "LightGrey"), |
| 872 |
TestColor(211, 211, 211, "LightGray"), |
| 873 |
TestColor(25, 25, 112, "MidnightBlue"), |
| 874 |
TestColor(0, 0, 128, "navy"), |
| 875 |
TestColor(0, 0, 128, "NavyBlue"), |
| 876 |
TestColor(100, 149, 237, "CornflowerBlue"), |
| 877 |
TestColor(72, 61, 139, "DarkSlateBlue"), |
| 878 |
TestColor(106, 90, 205, "SlateBlue"), |
| 879 |
TestColor(123, 104, 238, "MediumSlateBlue"), |
| 880 |
TestColor(132, 112, 255, "LightSlateBlue"), |
| 881 |
TestColor(0, 0, 205, "MediumBlue"), |
| 882 |
TestColor(65, 105, 225, "RoyalBlue"), |
| 883 |
TestColor(0, 0, 255, "blue"), |
| 884 |
TestColor(30, 144, 255, "DodgerBlue"), |
| 885 |
TestColor(0, 191, 255, "DeepSkyBlue"), |
| 886 |
TestColor(135, 206, 235, "SkyBlue"), |
| 887 |
TestColor(135, 206, 250, "LightSkyBlue"), |
| 888 |
TestColor(70, 130, 180, "SteelBlue"), |
| 889 |
TestColor(176, 196, 222, "LightSteelBlue"), |
| 890 |
TestColor(173, 216, 230, "LightBlue"), |
| 891 |
TestColor(176, 224, 230, "PowderBlue"), |
| 892 |
TestColor(175, 238, 238, "PaleTurquoise"), |
| 893 |
TestColor(0, 206, 209, "DarkTurquoise"), |
| 894 |
TestColor(72, 209, 204, "MediumTurquoise"), |
| 895 |
TestColor(64, 224, 208, "turquoise"), |
| 896 |
TestColor(0, 255, 255, "cyan"), |
| 897 |
TestColor(224, 255, 255, "LightCyan"), |
| 898 |
TestColor(95, 158, 160, "CadetBlue"), |
| 899 |
TestColor(102, 205, 170, "MediumAquamarine"), |
| 900 |
TestColor(127, 255, 212, "aquamarine"), |
| 901 |
TestColor(0, 100, 0, "DarkGreen"), |
| 902 |
TestColor(85, 107, 47, "DarkOliveGreen"), |
| 903 |
TestColor(143, 188, 143, "DarkSeaGreen"), |
| 904 |
TestColor(46, 139, 87, "SeaGreen"), |
| 905 |
TestColor(60, 179, 113, "MediumSeaGreen"), |
| 906 |
TestColor(32, 178, 170, "LightSeaGreen"), |
| 907 |
TestColor(152, 251, 152, "PaleGreen"), |
| 908 |
TestColor(0, 255, 127, "SpringGreen"), |
| 909 |
TestColor(124, 252, 0, "LawnGreen"), |
| 910 |
TestColor(0, 255, 0, "green"), |
| 911 |
TestColor(127, 255, 0, "chartreuse"), |
| 912 |
TestColor(0, 250, 154, "MediumSpringGreen"), |
| 913 |
TestColor(173, 255, 47, "GreenYellow"), |
| 914 |
TestColor(50, 205, 50, "LimeGreen"), |
| 915 |
TestColor(154, 205, 50, "YellowGreen"), |
| 916 |
TestColor(34, 139, 34, "ForestGreen"), |
| 917 |
TestColor(107, 142, 35, "OliveDrab"), |
| 918 |
TestColor(189, 183, 107, "DarkKhaki"), |
| 919 |
TestColor(240, 230, 140, "khaki"), |
| 920 |
TestColor(238, 232, 170, "PaleGoldenrod"), |
| 921 |
TestColor(250, 250, 210, "LightGoldenrodYellow"), |
| 922 |
TestColor(255, 255, 224, "LightYellow"), |
| 923 |
TestColor(255, 255, 0, "yellow"), |
| 924 |
TestColor(255, 215, 0, "gold"), |
| 925 |
TestColor(238, 221, 130, "LightGoldenrod"), |
| 926 |
TestColor(218, 165, 32, "goldenrod"), |
| 927 |
TestColor(184, 134, 11, "DarkGoldenrod"), |
| 928 |
TestColor(188, 143, 143, "RosyBrown"), |
| 929 |
TestColor(205, 92, 92, "IndianRed"), |
| 930 |
TestColor(139, 69, 19, "SaddleBrown"), |
| 931 |
TestColor(160, 82, 45, "sienna"), |
| 932 |
TestColor(205, 133, 63, "peru"), |
| 933 |
TestColor(222, 184, 135, "burlywood"), |
| 934 |
TestColor(245, 245, 220, "beige"), |
| 935 |
TestColor(245, 222, 179, "wheat"), |
| 936 |
TestColor(244, 164, 96, "SandyBrown"), |
| 937 |
TestColor(210, 180, 140, "tan"), |
| 938 |
TestColor(210, 105, 30, "chocolate"), |
| 939 |
TestColor(178, 34, 34, "firebrick"), |
| 940 |
TestColor(165, 42, 42, "brown"), |
| 941 |
TestColor(233, 150, 122, "DarkSalmon"), |
| 942 |
TestColor(250, 128, 114, "salmon"), |
| 943 |
TestColor(255, 160, 122, "LightSalmon"), |
| 944 |
TestColor(255, 165, 0, "orange"), |
| 945 |
TestColor(255, 140, 0, "DarkOrange"), |
| 946 |
TestColor(255, 127, 80, "coral"), |
| 947 |
TestColor(240, 128, 128, "LightCoral"), |
| 948 |
TestColor(255, 99, 71, "tomato"), |
| 949 |
TestColor(255, 69, 0, "OrangeRed"), |
| 950 |
TestColor(255, 0, 0, "red"), |
| 951 |
TestColor(255, 105, 180, "HotPink"), |
| 952 |
TestColor(255, 20, 147, "DeepPink"), |
| 953 |
TestColor(255, 192, 203, "pink"), |
| 954 |
TestColor(255, 182, 193, "LightPink"), |
| 955 |
TestColor(219, 112, 147, "PaleVioletRed"), |
| 956 |
TestColor(176, 48, 96, "maroon"), |
| 957 |
TestColor(199, 21, 133, "MediumVioletRed"), |
| 958 |
TestColor(208, 32, 144, "VioletRed"), |
| 959 |
TestColor(255, 0, 255, "magenta"), |
| 960 |
TestColor(238, 130, 238, "violet"), |
| 961 |
TestColor(221, 160, 221, "plum"), |
| 962 |
TestColor(218, 112, 214, "orchid"), |
| 963 |
TestColor(186, 85, 211, "MediumOrchid"), |
| 964 |
TestColor(153, 50, 204, "DarkOrchid"), |
| 965 |
TestColor(148, 0, 211, "DarkViolet"), |
| 966 |
TestColor(138, 43, 226, "BlueViolet"), |
| 967 |
TestColor(160, 32, 240, "purple"), |
| 968 |
TestColor(147, 112, 219, "MediumPurple"), |
| 969 |
TestColor(216, 191, 216, "thistle"), |
| 970 |
TestColor(255, 250, 250, "snow1"), |
| 971 |
TestColor(238, 233, 233, "snow2"), |
| 972 |
TestColor(205, 201, 201, "snow3"), |
| 973 |
TestColor(139, 137, 137, "snow4"), |
| 974 |
TestColor(255, 245, 238, "seashell1"), |
| 975 |
TestColor(238, 229, 222, "seashell2"), |
| 976 |
TestColor(205, 197, 191, "seashell3"), |
| 977 |
TestColor(139, 134, 130, "seashell4"), |
| 978 |
TestColor(255, 239, 219, "AntiqueWhite1"), |
| 979 |
TestColor(238, 223, 204, "AntiqueWhite2"), |
| 980 |
TestColor(205, 192, 176, "AntiqueWhite3"), |
| 981 |
TestColor(139, 131, 120, "AntiqueWhite4"), |
| 982 |
TestColor(255, 228, 196, "bisque1"), |
| 983 |
TestColor(238, 213, 183, "bisque2"), |
| 984 |
TestColor(205, 183, 158, "bisque3"), |
| 985 |
TestColor(139, 125, 107, "bisque4"), |
| 986 |
TestColor(255, 218, 185, "PeachPuff1"), |
| 987 |
TestColor(238, 203, 173, "PeachPuff2"), |
| 988 |
TestColor(205, 175, 149, "PeachPuff3"), |
| 989 |
TestColor(139, 119, 101, "PeachPuff4"), |
| 990 |
TestColor(255, 222, 173, "NavajoWhite1"), |
| 991 |
TestColor(238, 207, 161, "NavajoWhite2"), |
| 992 |
TestColor(205, 179, 139, "NavajoWhite3"), |
| 993 |
TestColor(139, 121, 94, "NavajoWhite4"), |
| 994 |
TestColor(255, 250, 205, "LemonChiffon1"), |
| 995 |
TestColor(238, 233, 191, "LemonChiffon2"), |
| 996 |
TestColor(205, 201, 165, "LemonChiffon3"), |
| 997 |
TestColor(139, 137, 112, "LemonChiffon4"), |
| 998 |
TestColor(255, 248, 220, "cornsilk1"), |
| 999 |
TestColor(238, 232, 205, "cornsilk2"), |
| 1000 |
TestColor(205, 200, 177, "cornsilk3"), |
| 1001 |
TestColor(139, 136, 120, "cornsilk4"), |
| 1002 |
TestColor(255, 255, 240, "ivory1"), |
| 1003 |
TestColor(238, 238, 224, "ivory2"), |
| 1004 |
TestColor(205, 205, 193, "ivory3"), |
| 1005 |
TestColor(139, 139, 131, "ivory4"), |
| 1006 |
TestColor(240, 255, 240, "honeydew1"), |
| 1007 |
TestColor(224, 238, 224, "honeydew2"), |
| 1008 |
TestColor(193, 205, 193, "honeydew3"), |
| 1009 |
TestColor(131, 139, 131, "honeydew4"), |
| 1010 |
TestColor(255, 240, 245, "LavenderBlush1"), |
| 1011 |
TestColor(238, 224, 229, "LavenderBlush2"), |
| 1012 |
TestColor(205, 193, 197, "LavenderBlush3"), |
| 1013 |
TestColor(139, 131, 134, "LavenderBlush4"), |
| 1014 |
TestColor(255, 228, 225, "MistyRose1"), |
| 1015 |
TestColor(238, 213, 210, "MistyRose2"), |
| 1016 |
TestColor(205, 183, 181, "MistyRose3"), |
| 1017 |
TestColor(139, 125, 123, "MistyRose4"), |
| 1018 |
TestColor(240, 255, 255, "azure1"), |
| 1019 |
TestColor(224, 238, 238, "azure2"), |
| 1020 |
TestColor(193, 205, 205, "azure3"), |
| 1021 |
TestColor(131, 139, 139, "azure4"), |
| 1022 |
TestColor(131, 111, 255, "SlateBlue1"), |
| 1023 |
TestColor(122, 103, 238, "SlateBlue2"), |
| 1024 |
TestColor(105, 89, 205, "SlateBlue3"), |
| 1025 |
TestColor(71, 60, 139, "SlateBlue4"), |
| 1026 |
TestColor(72, 118, 255, "RoyalBlue1"), |
| 1027 |
TestColor(67, 110, 238, "RoyalBlue2"), |
| 1028 |
TestColor(58, 95, 205, "RoyalBlue3"), |
| 1029 |
TestColor(39, 64, 139, "RoyalBlue4"), |
| 1030 |
TestColor(0, 0, 255, "blue1"), |
| 1031 |
TestColor(0, 0, 238, "blue2"), |
| 1032 |
TestColor(0, 0, 205, "blue3"), |
| 1033 |
TestColor(0, 0, 139, "blue4"), |
| 1034 |
TestColor(30, 144, 255, "DodgerBlue1"), |
| 1035 |
TestColor(28, 134, 238, "DodgerBlue2"), |
| 1036 |
TestColor(24, 116, 205, "DodgerBlue3"), |
| 1037 |
TestColor(16, 78, 139, "DodgerBlue4"), |
| 1038 |
TestColor(99, 184, 255, "SteelBlue1"), |
| 1039 |
TestColor(92, 172, 238, "SteelBlue2"), |
| 1040 |
TestColor(79, 148, 205, "SteelBlue3"), |
| 1041 |
TestColor(54, 100, 139, "SteelBlue4"), |
| 1042 |
TestColor(0, 191, 255, "DeepSkyBlue1"), |
| 1043 |
TestColor(0, 178, 238, "DeepSkyBlue2"), |
| 1044 |
TestColor(0, 154, 205, "DeepSkyBlue3"), |
| 1045 |
TestColor(0, 104, 139, "DeepSkyBlue4"), |
| 1046 |
TestColor(135, 206, 255, "SkyBlue1"), |
| 1047 |
TestColor(126, 192, 238, "SkyBlue2"), |
| 1048 |
TestColor(108, 166, 205, "SkyBlue3"), |
| 1049 |
TestColor(74, 112, 139, "SkyBlue4"), |
| 1050 |
TestColor(176, 226, 255, "LightSkyBlue1"), |
| 1051 |
TestColor(164, 211, 238, "LightSkyBlue2"), |
| 1052 |
TestColor(141, 182, 205, "LightSkyBlue3"), |
| 1053 |
TestColor(96, 123, 139, "LightSkyBlue4"), |
| 1054 |
TestColor(198, 226, 255, "SlateGray1"), |
| 1055 |
TestColor(185, 211, 238, "SlateGray2"), |
| 1056 |
TestColor(159, 182, 205, "SlateGray3"), |
| 1057 |
TestColor(108, 123, 139, "SlateGray4"), |
| 1058 |
TestColor(202, 225, 255, "LightSteelBlue1"), |
| 1059 |
TestColor(188, 210, 238, "LightSteelBlue2"), |
| 1060 |
TestColor(162, 181, 205, "LightSteelBlue3"), |
| 1061 |
TestColor(110, 123, 139, "LightSteelBlue4"), |
| 1062 |
TestColor(191, 239, 255, "LightBlue1"), |
| 1063 |
TestColor(178, 223, 238, "LightBlue2"), |
| 1064 |
TestColor(154, 192, 205, "LightBlue3"), |
| 1065 |
TestColor(104, 131, 139, "LightBlue4"), |
| 1066 |
TestColor(224, 255, 255, "LightCyan1"), |
| 1067 |
TestColor(209, 238, 238, "LightCyan2"), |
| 1068 |
TestColor(180, 205, 205, "LightCyan3"), |
| 1069 |
TestColor(122, 139, 139, "LightCyan4"), |
| 1070 |
TestColor(187, 255, 255, "PaleTurquoise1"), |
| 1071 |
TestColor(174, 238, 238, "PaleTurquoise2"), |
| 1072 |
TestColor(150, 205, 205, "PaleTurquoise3"), |
| 1073 |
TestColor(102, 139, 139, "PaleTurquoise4"), |
| 1074 |
TestColor(152, 245, 255, "CadetBlue1"), |
| 1075 |
TestColor(142, 229, 238, "CadetBlue2"), |
| 1076 |
TestColor(122, 197, 205, "CadetBlue3"), |
| 1077 |
TestColor(83, 134, 139, "CadetBlue4"), |
| 1078 |
TestColor(0, 245, 255, "turquoise1"), |
| 1079 |
TestColor(0, 229, 238, "turquoise2"), |
| 1080 |
TestColor(0, 197, 205, "turquoise3"), |
| 1081 |
TestColor(0, 134, 139, "turquoise4"), |
| 1082 |
TestColor(0, 255, 255, "cyan1"), |
| 1083 |
TestColor(0, 238, 238, "cyan2"), |
| 1084 |
TestColor(0, 205, 205, "cyan3"), |
| 1085 |
TestColor(0, 139, 139, "cyan4"), |
| 1086 |
TestColor(151, 255, 255, "DarkSlateGray1"), |
| 1087 |
TestColor(141, 238, 238, "DarkSlateGray2"), |
| 1088 |
TestColor(121, 205, 205, "DarkSlateGray3"), |
| 1089 |
TestColor(82, 139, 139, "DarkSlateGray4"), |
| 1090 |
TestColor(127, 255, 212, "aquamarine1"), |
| 1091 |
TestColor(118, 238, 198, "aquamarine2"), |
| 1092 |
TestColor(102, 205, 170, "aquamarine3"), |
| 1093 |
TestColor(69, 139, 116, "aquamarine4"), |
| 1094 |
TestColor(193, 255, 193, "DarkSeaGreen1"), |
| 1095 |
TestColor(180, 238, 180, "DarkSeaGreen2"), |
| 1096 |
TestColor(155, 205, 155, "DarkSeaGreen3"), |
| 1097 |
TestColor(105, 139, 105, "DarkSeaGreen4"), |
| 1098 |
TestColor(84, 255, 159, "SeaGreen1"), |
| 1099 |
TestColor(78, 238, 148, "SeaGreen2"), |
| 1100 |
TestColor(67, 205, 128, "SeaGreen3"), |
| 1101 |
TestColor(46, 139, 87, "SeaGreen4"), |
| 1102 |
TestColor(154, 255, 154, "PaleGreen1"), |
| 1103 |
TestColor(144, 238, 144, "PaleGreen2"), |
| 1104 |
TestColor(124, 205, 124, "PaleGreen3"), |
| 1105 |
TestColor(84, 139, 84, "PaleGreen4"), |
| 1106 |
TestColor(0, 255, 127, "SpringGreen1"), |
| 1107 |
TestColor(0, 238, 118, "SpringGreen2"), |
| 1108 |
TestColor(0, 205, 102, "SpringGreen3"), |
| 1109 |
TestColor(0, 139, 69, "SpringGreen4"), |
| 1110 |
TestColor(0, 255, 0, "green1"), |
| 1111 |
TestColor(0, 238, 0, "green2"), |
| 1112 |
TestColor(0, 205, 0, "green3"), |
| 1113 |
TestColor(0, 139, 0, "green4"), |
| 1114 |
TestColor(127, 255, 0, "chartreuse1"), |
| 1115 |
TestColor(118, 238, 0, "chartreuse2"), |
| 1116 |
TestColor(102, 205, 0, "chartreuse3"), |
| 1117 |
TestColor(69, 139, 0, "chartreuse4"), |
| 1118 |
TestColor(192, 255, 62, "OliveDrab1"), |
| 1119 |
TestColor(179, 238, 58, "OliveDrab2"), |
| 1120 |
TestColor(154, 205, 50, "OliveDrab3"), |
| 1121 |
TestColor(105, 139, 34, "OliveDrab4"), |
| 1122 |
TestColor(202, 255, 112, "DarkOliveGreen1"), |
| 1123 |
TestColor(188, 238, 104, "DarkOliveGreen2"), |
| 1124 |
TestColor(162, 205, 90, "DarkOliveGreen3"), |
| 1125 |
TestColor(110, 139, 61, "DarkOliveGreen4"), |
| 1126 |
TestColor(255, 246, 143, "khaki1"), |
| 1127 |
TestColor(238, 230, 133, "khaki2"), |
| 1128 |
TestColor(205, 198, 115, "khaki3"), |
| 1129 |
TestColor(139, 134, 78, "khaki4"), |
| 1130 |
TestColor(255, 236, 139, "LightGoldenrod1"), |
| 1131 |
TestColor(238, 220, 130, "LightGoldenrod2"), |
| 1132 |
TestColor(205, 190, 112, "LightGoldenrod3"), |
| 1133 |
TestColor(139, 129, 76, "LightGoldenrod4"), |
| 1134 |
TestColor(255, 255, 224, "LightYellow1"), |
| 1135 |
TestColor(238, 238, 209, "LightYellow2"), |
| 1136 |
TestColor(205, 205, 180, "LightYellow3"), |
| 1137 |
TestColor(139, 139, 122, "LightYellow4"), |
| 1138 |
TestColor(255, 255, 0, "yellow1"), |
| 1139 |
TestColor(238, 238, 0, "yellow2"), |
| 1140 |
TestColor(205, 205, 0, "yellow3"), |
| 1141 |
TestColor(139, 139, 0, "yellow4"), |
| 1142 |
TestColor(255, 215, 0, "gold1"), |
| 1143 |
TestColor(238, 201, 0, "gold2"), |
| 1144 |
TestColor(205, 173, 0, "gold3"), |
| 1145 |
TestColor(139, 117, 0, "gold4"), |
| 1146 |
TestColor(255, 193, 37, "goldenrod1"), |
| 1147 |
TestColor(238, 180, 34, "goldenrod2"), |
| 1148 |
TestColor(205, 155, 29, "goldenrod3"), |
| 1149 |
TestColor(139, 105, 20, "goldenrod4"), |
| 1150 |
TestColor(255, 185, 15, "DarkGoldenrod1"), |
| 1151 |
TestColor(238, 173, 14, "DarkGoldenrod2"), |
| 1152 |
TestColor(205, 149, 12, "DarkGoldenrod3"), |
| 1153 |
TestColor(139, 101, 8, "DarkGoldenrod4"), |
| 1154 |
TestColor(255, 193, 193, "RosyBrown1"), |
| 1155 |
TestColor(238, 180, 180, "RosyBrown2"), |
| 1156 |
TestColor(205, 155, 155, "RosyBrown3"), |
| 1157 |
TestColor(139, 105, 105, "RosyBrown4"), |
| 1158 |
TestColor(255, 106, 106, "IndianRed1"), |
| 1159 |
TestColor(238, 99, 99, "IndianRed2"), |
| 1160 |
TestColor(205, 85, 85, "IndianRed3"), |
| 1161 |
TestColor(139, 58, 58, "IndianRed4"), |
| 1162 |
TestColor(255, 130, 71, "sienna1"), |
| 1163 |
TestColor(238, 121, 66, "sienna2"), |
| 1164 |
TestColor(205, 104, 57, "sienna3"), |
| 1165 |
TestColor(139, 71, 38, "sienna4"), |
| 1166 |
TestColor(255, 211, 155, "burlywood1"), |
| 1167 |
TestColor(238, 197, 145, "burlywood2"), |
| 1168 |
TestColor(205, 170, 125, "burlywood3"), |
| 1169 |
TestColor(139, 115, 85, "burlywood4"), |
| 1170 |
TestColor(255, 231, 186, "wheat1"), |
| 1171 |
TestColor(238, 216, 174, "wheat2"), |
| 1172 |
TestColor(205, 186, 150, "wheat3"), |
| 1173 |
TestColor(139, 126, 102, "wheat4"), |
| 1174 |
TestColor(255, 165, 79, "tan1"), |
| 1175 |
TestColor(238, 154, 73, "tan2"), |
| 1176 |
TestColor(205, 133, 63, "tan3"), |
| 1177 |
TestColor(139, 90, 43, "tan4"), |
| 1178 |
TestColor(255, 127, 36, "chocolate1"), |
| 1179 |
TestColor(238, 118, 33, "chocolate2"), |
| 1180 |
TestColor(205, 102, 29, "chocolate3"), |
| 1181 |
TestColor(139, 69, 19, "chocolate4"), |
| 1182 |
TestColor(255, 48, 48, "firebrick1"), |
| 1183 |
TestColor(238, 44, 44, "firebrick2"), |
| 1184 |
TestColor(205, 38, 38, "firebrick3"), |
| 1185 |
TestColor(139, 26, 26, "firebrick4"), |
| 1186 |
TestColor(255, 64, 64, "brown1"), |
| 1187 |
TestColor(238, 59, 59, "brown2"), |
| 1188 |
TestColor(205, 51, 51, "brown3"), |
| 1189 |
TestColor(139, 35, 35, "brown4"), |
| 1190 |
TestColor(255, 140, 105, "salmon1"), |
| 1191 |
TestColor(238, 130, 98, "salmon2"), |
| 1192 |
TestColor(205, 112, 84, "salmon3"), |
| 1193 |
TestColor(139, 76, 57, "salmon4"), |
| 1194 |
TestColor(255, 160, 122, "LightSalmon1"), |
| 1195 |
TestColor(238, 149, 114, "LightSalmon2"), |
| 1196 |
TestColor(205, 129, 98, "LightSalmon3"), |
| 1197 |
TestColor(139, 87, 66, "LightSalmon4"), |
| 1198 |
TestColor(255, 165, 0, "orange1"), |
| 1199 |
TestColor(238, 154, 0, "orange2"), |
| 1200 |
TestColor(205, 133, 0, "orange3"), |
| 1201 |
TestColor(139, 90, 0, "orange4"), |
| 1202 |
TestColor(255, 127, 0, "DarkOrange1"), |
| 1203 |
TestColor(238, 118, 0, "DarkOrange2"), |
| 1204 |
TestColor(205, 102, 0, "DarkOrange3"), |
| 1205 |
TestColor(139, 69, 0, "DarkOrange4"), |
| 1206 |
TestColor(255, 114, 86, "coral1"), |
| 1207 |
TestColor(238, 106, 80, "coral2"), |
| 1208 |
TestColor(205, 91, 69, "coral3"), |
| 1209 |
TestColor(139, 62, 47, "coral4"), |
| 1210 |
TestColor(255, 99, 71, "tomato1"), |
| 1211 |
TestColor(238, 92, 66, "tomato2"), |
| 1212 |
TestColor(205, 79, 57, "tomato3"), |
| 1213 |
TestColor(139, 54, 38, "tomato4"), |
| 1214 |
TestColor(255, 69, 0, "OrangeRed1"), |
| 1215 |
TestColor(238, 64, 0, "OrangeRed2"), |
| 1216 |
TestColor(205, 55, 0, "OrangeRed3"), |
| 1217 |
TestColor(139, 37, 0, "OrangeRed4"), |
| 1218 |
TestColor(255, 0, 0, "red1"), |
| 1219 |
TestColor(238, 0, 0, "red2"), |
| 1220 |
TestColor(205, 0, 0, "red3"), |
| 1221 |
TestColor(139, 0, 0, "red4"), |
| 1222 |
TestColor(255, 20, 147, "DeepPink1"), |
| 1223 |
TestColor(238, 18, 137, "DeepPink2"), |
| 1224 |
TestColor(205, 16, 118, "DeepPink3"), |
| 1225 |
TestColor(139, 10, 80, "DeepPink4"), |
| 1226 |
TestColor(255, 110, 180, "HotPink1"), |
| 1227 |
TestColor(238, 106, 167, "HotPink2"), |
| 1228 |
TestColor(205, 96, 144, "HotPink3"), |
| 1229 |
TestColor(139, 58, 98, "HotPink4"), |
| 1230 |
TestColor(255, 181, 197, "pink1"), |
| 1231 |
TestColor(238, 169, 184, "pink2"), |
| 1232 |
TestColor(205, 145, 158, "pink3"), |
| 1233 |
TestColor(139, 99, 108, "pink4"), |
| 1234 |
TestColor(255, 174, 185, "LightPink1"), |
| 1235 |
TestColor(238, 162, 173, "LightPink2"), |
| 1236 |
TestColor(205, 140, 149, "LightPink3"), |
| 1237 |
TestColor(139, 95, 101, "LightPink4"), |
| 1238 |
TestColor(255, 130, 171, "PaleVioletRed1"), |
| 1239 |
TestColor(238, 121, 159, "PaleVioletRed2"), |
| 1240 |
TestColor(205, 104, 137, "PaleVioletRed3"), |
| 1241 |
TestColor(139, 71, 93, "PaleVioletRed4"), |
| 1242 |
TestColor(255, 52, 179, "maroon1"), |
| 1243 |
TestColor(238, 48, 167, "maroon2"), |
| 1244 |
TestColor(205, 41, 144, "maroon3"), |
| 1245 |
TestColor(139, 28, 98, "maroon4"), |
| 1246 |
TestColor(255, 62, 150, "VioletRed1"), |
| 1247 |
TestColor(238, 58, 140, "VioletRed2"), |
| 1248 |
TestColor(205, 50, 120, "VioletRed3"), |
| 1249 |
TestColor(139, 34, 82, "VioletRed4"), |
| 1250 |
TestColor(255, 0, 255, "magenta1"), |
| 1251 |
TestColor(238, 0, 238, "magenta2"), |
| 1252 |
TestColor(205, 0, 205, "magenta3"), |
| 1253 |
TestColor(139, 0, 139, "magenta4"), |
| 1254 |
TestColor(255, 131, 250, "orchid1"), |
| 1255 |
TestColor(238, 122, 233, "orchid2"), |
| 1256 |
TestColor(205, 105, 201, "orchid3"), |
| 1257 |
TestColor(139, 71, 137, "orchid4"), |
| 1258 |
TestColor(255, 187, 255, "plum1"), |
| 1259 |
TestColor(238, 174, 238, "plum2"), |
| 1260 |
TestColor(205, 150, 205, "plum3"), |
| 1261 |
TestColor(139, 102, 139, "plum4"), |
| 1262 |
TestColor(224, 102, 255, "MediumOrchid1"), |
| 1263 |
TestColor(209, 95, 238, "MediumOrchid2"), |
| 1264 |
TestColor(180, 82, 205, "MediumOrchid3"), |
| 1265 |
TestColor(122, 55, 139, "MediumOrchid4"), |
| 1266 |
TestColor(191, 62, 255, "DarkOrchid1"), |
| 1267 |
TestColor(178, 58, 238, "DarkOrchid2"), |
| 1268 |
TestColor(154, 50, 205, "DarkOrchid3"), |
| 1269 |
TestColor(104, 34, 139, "DarkOrchid4"), |
| 1270 |
TestColor(155, 48, 255, "purple1"), |
| 1271 |
TestColor(145, 44, 238, "purple2"), |
| 1272 |
TestColor(125, 38, 205, "purple3"), |
| 1273 |
TestColor(85, 26, 139, "purple4"), |
| 1274 |
TestColor(171, 130, 255, "MediumPurple1"), |
| 1275 |
TestColor(159, 121, 238, "MediumPurple2"), |
| 1276 |
TestColor(137, 104, 205, "MediumPurple3"), |
| 1277 |
TestColor(93, 71, 139, "MediumPurple4"), |
| 1278 |
TestColor(255, 225, 255, "thistle1"), |
| 1279 |
TestColor(238, 210, 238, "thistle2"), |
| 1280 |
TestColor(205, 181, 205, "thistle3"), |
| 1281 |
TestColor(139, 123, 139, "thistle4"), |
| 1282 |
TestColor(0, 0, 0, "gray0"), |
| 1283 |
TestColor(0, 0, 0, "grey0"), |
| 1284 |
TestColor(3, 3, 3, "gray1"), |
| 1285 |
TestColor(3, 3, 3, "grey1"), |
| 1286 |
TestColor(5, 5, 5, "gray2"), |
| 1287 |
TestColor(5, 5, 5, "grey2"), |
| 1288 |
TestColor(8, 8, 8, "gray3"), |
| 1289 |
TestColor(8, 8, 8, "grey3"), |
| 1290 |
TestColor(10, 10, 10, "gray4"), |
| 1291 |
TestColor(10, 10, 10, "grey4"), |
| 1292 |
TestColor(13, 13, 13, "gray5"), |
| 1293 |
TestColor(13, 13, 13, "grey5"), |
| 1294 |
TestColor(15, 15, 15, "gray6"), |
| 1295 |
TestColor(15, 15, 15, "grey6"), |
| 1296 |
TestColor(18, 18, 18, "gray7"), |
| 1297 |
TestColor(18, 18, 18, "grey7"), |
| 1298 |
TestColor(20, 20, 20, "gray8"), |
| 1299 |
TestColor(20, 20, 20, "grey8"), |
| 1300 |
TestColor(23, 23, 23, "gray9"), |
| 1301 |
TestColor(23, 23, 23, "grey9"), |
| 1302 |
TestColor(26, 26, 26, "gray10"), |
| 1303 |
TestColor(26, 26, 26, "grey10"), |
| 1304 |
TestColor(28, 28, 28, "gray11"), |
| 1305 |
TestColor(28, 28, 28, "grey11"), |
| 1306 |
TestColor(31, 31, 31, "gray12"), |
| 1307 |
TestColor(31, 31, 31, "grey12"), |
| 1308 |
TestColor(33, 33, 33, "gray13"), |
| 1309 |
TestColor(33, 33, 33, "grey13"), |
| 1310 |
TestColor(36, 36, 36, "gray14"), |
| 1311 |
TestColor(36, 36, 36, "grey14"), |
| 1312 |
TestColor(38, 38, 38, "gray15"), |
| 1313 |
TestColor(38, 38, 38, "grey15"), |
| 1314 |
TestColor(41, 41, 41, "gray16"), |
| 1315 |
TestColor(41, 41, 41, "grey16"), |
| 1316 |
TestColor(43, 43, 43, "gray17"), |
| 1317 |
TestColor(43, 43, 43, "grey17"), |
| 1318 |
TestColor(46, 46, 46, "gray18"), |
| 1319 |
TestColor(46, 46, 46, "grey18"), |
| 1320 |
TestColor(48, 48, 48, "gray19"), |
| 1321 |
TestColor(48, 48, 48, "grey19"), |
| 1322 |
TestColor(51, 51, 51, "gray20"), |
| 1323 |
TestColor(51, 51, 51, "grey20"), |
| 1324 |
TestColor(54, 54, 54, "gray21"), |
| 1325 |
TestColor(54, 54, 54, "grey21"), |
| 1326 |
TestColor(56, 56, 56, "gray22"), |
| 1327 |
TestColor(56, 56, 56, "grey22"), |
| 1328 |
TestColor(59, 59, 59, "gray23"), |
| 1329 |
TestColor(59, 59, 59, "grey23"), |
| 1330 |
TestColor(61, 61, 61, "gray24"), |
| 1331 |
TestColor(61, 61, 61, "grey24"), |
| 1332 |
TestColor(64, 64, 64, "gray25"), |
| 1333 |
TestColor(64, 64, 64, "grey25"), |
| 1334 |
TestColor(66, 66, 66, "gray26"), |
| 1335 |
TestColor(66, 66, 66, "grey26"), |
| 1336 |
TestColor(69, 69, 69, "gray27"), |
| 1337 |
TestColor(69, 69, 69, "grey27"), |
| 1338 |
TestColor(71, 71, 71, "gray28"), |
| 1339 |
TestColor(71, 71, 71, "grey28"), |
| 1340 |
TestColor(74, 74, 74, "gray29"), |
| 1341 |
TestColor(74, 74, 74, "grey29"), |
| 1342 |
TestColor(77, 77, 77, "gray30"), |
| 1343 |
TestColor(77, 77, 77, "grey30"), |
| 1344 |
TestColor(79, 79, 79, "gray31"), |
| 1345 |
TestColor(79, 79, 79, "grey31"), |
| 1346 |
TestColor(82, 82, 82, "gray32"), |
| 1347 |
TestColor(82, 82, 82, "grey32"), |
| 1348 |
TestColor(84, 84, 84, "gray33"), |
| 1349 |
TestColor(84, 84, 84, "grey33"), |
| 1350 |
TestColor(87, 87, 87, "gray34"), |
| 1351 |
TestColor(87, 87, 87, "grey34"), |
| 1352 |
TestColor(89, 89, 89, "gray35"), |
| 1353 |
TestColor(89, 89, 89, "grey35"), |
| 1354 |
TestColor(92, 92, 92, "gray36"), |
| 1355 |
TestColor(92, 92, 92, "grey36"), |
| 1356 |
TestColor(94, 94, 94, "gray37"), |
| 1357 |
TestColor(94, 94, 94, "grey37"), |
| 1358 |
TestColor(97, 97, 97, "gray38"), |
| 1359 |
TestColor(97, 97, 97, "grey38"), |
| 1360 |
TestColor(99, 99, 99, "gray39"), |
| 1361 |
TestColor(99, 99, 99, "grey39"), |
| 1362 |
TestColor(102, 102, 102, "gray40"), |
| 1363 |
TestColor(102, 102, 102, "grey40"), |
| 1364 |
TestColor(105, 105, 105, "gray41"), |
| 1365 |
TestColor(105, 105, 105, "grey41"), |
| 1366 |
TestColor(107, 107, 107, "gray42"), |
| 1367 |
TestColor(107, 107, 107, "grey42"), |
| 1368 |
TestColor(110, 110, 110, "gray43"), |
| 1369 |
TestColor(110, 110, 110, "grey43"), |
| 1370 |
TestColor(112, 112, 112, "gray44"), |
| 1371 |
TestColor(112, 112, 112, "grey44"), |
| 1372 |
TestColor(115, 115, 115, "gray45"), |
| 1373 |
TestColor(115, 115, 115, "grey45"), |
| 1374 |
TestColor(117, 117, 117, "gray46"), |
| 1375 |
TestColor(117, 117, 117, "grey46"), |
| 1376 |
TestColor(120, 120, 120, "gray47"), |
| 1377 |
TestColor(120, 120, 120, "grey47"), |
| 1378 |
TestColor(122, 122, 122, "gray48"), |
| 1379 |
TestColor(122, 122, 122, "grey48"), |
| 1380 |
TestColor(125, 125, 125, "gray49"), |
| 1381 |
TestColor(125, 125, 125, "grey49"), |
| 1382 |
TestColor(127, 127, 127, "gray50"), |
| 1383 |
TestColor(127, 127, 127, "grey50"), |
| 1384 |
TestColor(130, 130, 130, "gray51"), |
| 1385 |
TestColor(130, 130, 130, "grey51"), |
| 1386 |
TestColor(133, 133, 133, "gray52"), |
| 1387 |
TestColor(133, 133, 133, "grey52"), |
| 1388 |
TestColor(135, 135, 135, "gray53"), |
| 1389 |
TestColor(135, 135, 135, "grey53"), |
| 1390 |
TestColor(138, 138, 138, "gray54"), |
| 1391 |
TestColor(138, 138, 138, "grey54"), |
| 1392 |
TestColor(140, 140, 140, "gray55"), |
| 1393 |
TestColor(140, 140, 140, "grey55"), |
| 1394 |
TestColor(143, 143, 143, "gray56"), |
| 1395 |
TestColor(143, 143, 143, "grey56"), |
| 1396 |
TestColor(145, 145, 145, "gray57"), |
| 1397 |
TestColor(145, 145, 145, "grey57"), |
| 1398 |
TestColor(148, 148, 148, "gray58"), |
| 1399 |
TestColor(148, 148, 148, "grey58"), |
| 1400 |
TestColor(150, 150, 150, "gray59"), |
| 1401 |
TestColor(150, 150, 150, "grey59"), |
| 1402 |
TestColor(153, 153, 153, "gray60"), |
| 1403 |
TestColor(153, 153, 153, "grey60"), |
| 1404 |
TestColor(156, 156, 156, "gray61"), |
| 1405 |
TestColor(156, 156, 156, "grey61"), |
| 1406 |
TestColor(158, 158, 158, "gray62"), |
| 1407 |
TestColor(158, 158, 158, "grey62"), |
| 1408 |
TestColor(161, 161, 161, "gray63"), |
| 1409 |
TestColor(161, 161, 161, "grey63"), |
| 1410 |
TestColor(163, 163, 163, "gray64"), |
| 1411 |
TestColor(163, 163, 163, "grey64"), |
| 1412 |
TestColor(166, 166, 166, "gray65"), |
| 1413 |
TestColor(166, 166, 166, "grey65"), |
| 1414 |
TestColor(168, 168, 168, "gray66"), |
| 1415 |
TestColor(168, 168, 168, "grey66"), |
| 1416 |
TestColor(171, 171, 171, "gray67"), |
| 1417 |
TestColor(171, 171, 171, "grey67"), |
| 1418 |
TestColor(173, 173, 173, "gray68"), |
| 1419 |
TestColor(173, 173, 173, "grey68"), |
| 1420 |
TestColor(176, 176, 176, "gray69"), |
| 1421 |
TestColor(176, 176, 176, "grey69"), |
| 1422 |
TestColor(179, 179, 179, "gray70"), |
| 1423 |
TestColor(179, 179, 179, "grey70"), |
| 1424 |
TestColor(181, 181, 181, "gray71"), |
| 1425 |
TestColor(181, 181, 181, "grey71"), |
| 1426 |
TestColor(184, 184, 184, "gray72"), |
| 1427 |
TestColor(184, 184, 184, "grey72"), |
| 1428 |
TestColor(186, 186, 186, "gray73"), |
| 1429 |
TestColor(186, 186, 186, "grey73"), |
| 1430 |
TestColor(189, 189, 189, "gray74"), |
| 1431 |
TestColor(189, 189, 189, "grey74"), |
| 1432 |
TestColor(191, 191, 191, "gray75"), |
| 1433 |
TestColor(191, 191, 191, "grey75"), |
| 1434 |
TestColor(194, 194, 194, "gray76"), |
| 1435 |
TestColor(194, 194, 194, "grey76"), |
| 1436 |
TestColor(196, 196, 196, "gray77"), |
| 1437 |
TestColor(196, 196, 196, "grey77"), |
| 1438 |
TestColor(199, 199, 199, "gray78"), |
| 1439 |
TestColor(199, 199, 199, "grey78"), |
| 1440 |
TestColor(201, 201, 201, "gray79"), |
| 1441 |
TestColor(201, 201, 201, "grey79"), |
| 1442 |
TestColor(204, 204, 204, "gray80"), |
| 1443 |
TestColor(204, 204, 204, "grey80"), |
| 1444 |
TestColor(207, 207, 207, "gray81"), |
| 1445 |
TestColor(207, 207, 207, "grey81"), |
| 1446 |
TestColor(209, 209, 209, "gray82"), |
| 1447 |
TestColor(209, 209, 209, "grey82"), |
| 1448 |
TestColor(212, 212, 212, "gray83"), |
| 1449 |
TestColor(212, 212, 212, "grey83"), |
| 1450 |
TestColor(214, 214, 214, "gray84"), |
| 1451 |
TestColor(214, 214, 214, "grey84"), |
| 1452 |
TestColor(217, 217, 217, "gray85"), |
| 1453 |
TestColor(217, 217, 217, "grey85"), |
| 1454 |
TestColor(219, 219, 219, "gray86"), |
| 1455 |
TestColor(219, 219, 219, "grey86"), |
| 1456 |
TestColor(222, 222, 222, "gray87"), |
| 1457 |
TestColor(222, 222, 222, "grey87"), |
| 1458 |
TestColor(224, 224, 224, "gray88"), |
| 1459 |
TestColor(224, 224, 224, "grey88"), |
| 1460 |
TestColor(227, 227, 227, "gray89"), |
| 1461 |
TestColor(227, 227, 227, "grey89"), |
| 1462 |
TestColor(229, 229, 229, "gray90"), |
| 1463 |
TestColor(229, 229, 229, "grey90"), |
| 1464 |
TestColor(232, 232, 232, "gray91"), |
| 1465 |
TestColor(232, 232, 232, "grey91"), |
| 1466 |
TestColor(235, 235, 235, "gray92"), |
| 1467 |
TestColor(235, 235, 235, "grey92"), |
| 1468 |
TestColor(237, 237, 237, "gray93"), |
| 1469 |
TestColor(237, 237, 237, "grey93"), |
| 1470 |
TestColor(240, 240, 240, "gray94"), |
| 1471 |
TestColor(240, 240, 240, "grey94"), |
| 1472 |
TestColor(242, 242, 242, "gray95"), |
| 1473 |
TestColor(242, 242, 242, "grey95"), |
| 1474 |
TestColor(245, 245, 245, "gray96"), |
| 1475 |
TestColor(245, 245, 245, "grey96"), |
| 1476 |
TestColor(247, 247, 247, "gray97"), |
| 1477 |
TestColor(247, 247, 247, "grey97"), |
| 1478 |
TestColor(250, 250, 250, "gray98"), |
| 1479 |
TestColor(250, 250, 250, "grey98"), |
| 1480 |
TestColor(252, 252, 252, "gray99"), |
| 1481 |
TestColor(252, 252, 252, "grey99"), |
| 1482 |
TestColor(255, 255, 255, "gray100"), |
| 1483 |
TestColor(255, 255, 255, "grey100"), |
| 1484 |
TestColor(169, 169, 169, "DarkGrey"), |
| 1485 |
TestColor(169, 169, 169, "DarkGray"), |
| 1486 |
TestColor(0, 0, 139, "DarkBlue"), |
| 1487 |
TestColor(0, 139, 139, "DarkCyan"), |
| 1488 |
TestColor(139, 0, 139, "DarkMagenta"), |
| 1489 |
TestColor(139, 0, 0, "DarkRed"), |
| 1490 |
TestColor(144, 238, 144, "LightGreen") |
| 1491 |
}; |
| 1492 |
|
| 1493 |
const size_t SIZE_OF_TABLE_OF_TEST_COLORS = sizeof(TABLE_OF_TEST_COLORS) / sizeof(TestColor); |
| 1494 |
|
| 1495 |
for (size_t i = 0; i < SIZE_OF_TABLE_OF_TEST_COLORS; ++i) |
| 1496 |
{ |
| 1497 |
const TestColor& TEST_COLOR(TABLE_OF_TEST_COLORS[i]); |
| 1498 |
|
| 1499 |
const PdfColor COLOR_FROM_NAME(PdfColor::CreateFromString(TEST_COLOR.getColorName())); |
| 1500 |
const PdfColor EXPECTED_COLOR(TEST_COLOR.getR(), TEST_COLOR.getG(), TEST_COLOR.getB()); |
| 1501 |
|
| 1502 |
if (PdfColor() == COLOR_FROM_NAME) |
| 1503 |
{ |
| 1504 |
INFO(utls::Format("Color {} is not supported", TEST_COLOR.getColorName())); |
| 1505 |
} |
| 1506 |
else |
| 1507 |
{ |
| 1508 |
bool result = EXPECTED_COLOR == COLOR_FROM_NAME; |
| 1509 |
REQUIRE(result); |
| 1510 |
} |
| 1511 |
} |
| 1512 |
} |
| 1513 |
|
| 1514 |
TEST_CASE("TestColorGreyConstructor") |
| 1515 |
{ |
| 1516 |
const double GRAY_VALUE = 0.123; |
| 1517 |
PdfColor color(GRAY_VALUE); |
| 1518 |
|
| 1519 |
REQUIRE(color.IsGrayScale()); |
| 1520 |
REQUIRE(!color.IsRGB()); |
| 1521 |
REQUIRE(!color.IsCMYK()); |
| 1522 |
REQUIRE(color.GetColorSpace() == PdfColorSpaceType::DeviceGray); |
| 1523 |
|
| 1524 |
REQUIRE(color.GetGrayScale() == GRAY_VALUE); |
| 1525 |
} |
| 1526 |
|
| 1527 |
TEST_CASE("TestColorRGBConstructor") |
| 1528 |
{ |
| 1529 |
const double R_VALUE = 0.023; |
| 1530 |
const double G_VALUE = 0.345; |
| 1531 |
const double B_VALUE = 0.678; |
| 1532 |
PdfColor color(R_VALUE, G_VALUE, B_VALUE); |
| 1533 |
|
| 1534 |
REQUIRE(!color.IsGrayScale()); |
| 1535 |
REQUIRE(color.IsRGB()); |
| 1536 |
REQUIRE(!color.IsCMYK()); |
| 1537 |
REQUIRE(color.GetColorSpace() == PdfColorSpaceType::DeviceRGB); |
| 1538 |
|
| 1539 |
REQUIRE(color.GetRed() == R_VALUE); |
| 1540 |
REQUIRE(color.GetGreen() == G_VALUE); |
| 1541 |
REQUIRE(color.GetBlue() == B_VALUE); |
| 1542 |
} |
| 1543 |
|
| 1544 |
TEST_CASE("TestColorCMYKConstructor") |
| 1545 |
{ |
| 1546 |
const double C_VALUE = 0.1; |
| 1547 |
const double M_VALUE = 0.2; |
| 1548 |
const double Y_VALUE = 0.3; |
| 1549 |
const double B_VALUE = 0.4; |
| 1550 |
PdfColor color(C_VALUE, M_VALUE, Y_VALUE, B_VALUE); |
| 1551 |
|
| 1552 |
REQUIRE(!color.IsGrayScale()); |
| 1553 |
REQUIRE(!color.IsRGB()); |
| 1554 |
REQUIRE(color.IsCMYK()); |
| 1555 |
REQUIRE(color.GetColorSpace() == PdfColorSpaceType::DeviceCMYK); |
| 1556 |
|
| 1557 |
REQUIRE(color.GetCyan() == C_VALUE); |
| 1558 |
REQUIRE(color.GetMagenta() == M_VALUE); |
| 1559 |
REQUIRE(color.GetYellow() == Y_VALUE); |
| 1560 |
REQUIRE(color.GetBlack() == B_VALUE); |
| 1561 |
} |
| 1562 |
|
| 1563 |
TEST_CASE("TestRGBtoCMYKConversions") |
| 1564 |
{ |
| 1565 |
using TPairOfColors = std::pair<PdfColor, PdfColor>; |
| 1566 |
using TMapOfColors = std::map<std::string, TPairOfColors>; |
| 1567 |
|
| 1568 |
TMapOfColors colorTable; |
| 1569 |
colorTable["red"] = TPairOfColors(PdfColor(1.0, 0.0, 0.0), PdfColor(0.0, 1.0, 1.0, 0.0)); |
| 1570 |
colorTable["green"] = TPairOfColors(PdfColor(0.0, 1.0, 0.0), PdfColor(1.0, 0.0, 1.0, 0.0)); |
| 1571 |
colorTable["blue"] = TPairOfColors(PdfColor(0.0, 0.0, 1.0), PdfColor(1.0, 1.0, 0.0, 0.0)); |
| 1572 |
colorTable["white"] = TPairOfColors(PdfColor(1.0, 1.0, 1.0), PdfColor(0.0, 0.0, 0.0, 0.0)); |
| 1573 |
colorTable["black"] = TPairOfColors(PdfColor(0.0, 0.0, 0.0), PdfColor(0.0, 0.0, 0.0, 1.0)); |
| 1574 |
colorTable["cyan"] = TPairOfColors(PdfColor(0.0, 1.0, 1.0), PdfColor(1.0, 0.0, 0.0, 0.0)); |
| 1575 |
colorTable["magenta"] = TPairOfColors(PdfColor(1.0, 0.0, 1.0), PdfColor(0.0, 1.0, 0.0, 0.0)); |
| 1576 |
colorTable["yellow"] = TPairOfColors(PdfColor(1.0, 1.0, 0.0), PdfColor(0.0, 0.0, 1.0, 0.0)); |
| 1577 |
|
| 1578 |
for (TMapOfColors::const_iterator iter(colorTable.begin()), iterEnd(colorTable.end()); |
| 1579 |
iter != iterEnd; |
| 1580 |
++iter) |
| 1581 |
{ |
| 1582 |
const std::string COLOR_NAME(iter->first); |
| 1583 |
PdfColor namedColor(PdfColor::CreateFromString(COLOR_NAME.c_str())); |
| 1584 |
PdfColor rgbColor(iter->second.first); |
| 1585 |
PdfColor cmykColor(iter->second.second); |
| 1586 |
|
| 1587 |
REQUIRE(namedColor.ConvertToRGB() == rgbColor); |
| 1588 |
REQUIRE(rgbColor.ConvertToCMYK() == cmykColor); |
| 1589 |
REQUIRE(rgbColor == cmykColor.ConvertToRGB()); |
| 1590 |
} |
| 1591 |
} |
| 1592 |
|
| 1593 |
TEST_CASE("TestSeparationColor") |
| 1594 |
{ |
| 1595 |
// CHECK-ME: Check if this tests does something meaningful |
| 1596 |
PdfMemDocument doc; |
| 1597 |
auto& page = doc.GetPages().CreatePage(); |
| 1598 |
PdfColor separationColor = PdfColor(0.6, 0, 1, 0); |
| 1599 |
PdfColorSpaceFilterPtr sportColorFilter(new PdfColorSpaceFilterSeparation("spot_1", separationColor)); |
| 1600 |
auto spotColorSpace = doc.CreateColorSpace(sportColorFilter); |
| 1601 |
|
| 1602 |
PdfPainter painter; |
| 1603 |
painter.SetCanvas(page); |
| 1604 |
painter.GraphicsState.SetNonStrokingColorSpace(*spotColorSpace); |
| 1605 |
painter.GraphicsState.SetNonStrokingColor(PdfColorRaw{ 0.5 }); |
| 1606 |
painter.DrawRectangle(Rect(100, 600, 100, 50), PdfPathDrawMode::Fill); |
| 1607 |
painter.FinishDrawing(); |
| 1608 |
doc.Save(TestUtils::GetTestOutputFilePath("TestSeparationColor.pdf")); |
| 1609 |
} |