From 877b5e00a3d96b976612dc2d6b9180d137643a51 Mon Sep 17 00:00:00 2001 From: David Capello Date: Tue, 30 Aug 2022 14:14:06 -0300 Subject: [PATCH] Add color_scales_tests --- src/doc/color_scales_tests.cpp | 46 ++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/doc/color_scales_tests.cpp diff --git a/src/doc/color_scales_tests.cpp b/src/doc/color_scales_tests.cpp new file mode 100644 index 000000000..c0f0cc65d --- /dev/null +++ b/src/doc/color_scales_tests.cpp @@ -0,0 +1,46 @@ +// Aseprite Document Library +// Copyright (c) 2022 Igara Studio S.A. +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "doc/color_scales.h" + +#include +#include + +using namespace doc; + +TEST(Scale, MatchValues) +{ + for (int x=1; x<=8; ++x) { + switch (x) { + case 3: + for (int v=0; v<8; ++v) + EXPECT_EQ(scale_3bits_to_8bits(v), scale_xxbits_to_8bits(3, v)); + break; + case 5: + for (int v=0; v<32; ++v) + EXPECT_EQ(scale_5bits_to_8bits(v), scale_xxbits_to_8bits(5, v)); + break; + case 6: + for (int v=0; v<64; ++v) + EXPECT_EQ(scale_6bits_to_8bits(v), scale_xxbits_to_8bits(6, v)); + break; + } + for (int v=0; v<(1<