5 * th9x - http://code.google.com/p/th9x
6 * er9x - http://code.google.com/p/er9x
7 * gruvin9x - http://code.google.com/p/gruvin9x
9 * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
29 // test conversion from RGB to RGB565 (5 bits for R, 6 bits for G, 5 bits for B)
30 EXPECT_EQ(RGB(0, 0, 0), (uint16_t)0x0000);
31 EXPECT_EQ(RGB(255, 255, 255), (uint16_t)0xFFFF);
33 EXPECT_EQ(RGB(255, 0, 0), (uint16_t)0xF800);
34 EXPECT_EQ(RGB(0, 255, 0), (uint16_t)0x07E0);
35 EXPECT_EQ(RGB(0, 0, 255), (uint16_t)0x001F);
37 EXPECT_EQ(RGB(30, 40, 150), (uint16_t)0x1952);
42 // test conversion from RGB to ARGB4444 (4 bits for alpha, 4 bits for R, 4 bits for G, 4 bits for B)
43 EXPECT_EQ(ARGB(0, 0, 0, 0), (uint16_t)0x0000);
44 EXPECT_EQ(ARGB(255, 255, 255, 255), (uint16_t)0xFFFF);
46 EXPECT_EQ(ARGB(255, 0, 0, 0), (uint16_t)0xF000);
47 EXPECT_EQ(ARGB(0, 255, 0, 0), (uint16_t)0x0F00);
48 EXPECT_EQ(ARGB(0, 0, 255, 0), (uint16_t)0x00F0);
49 EXPECT_EQ(ARGB(0, 0, 0, 255), (uint16_t)0x000F);
51 EXPECT_EQ(ARGB(128, 30, 40, 150), (uint16_t)0x8129);