From cc1efe12cdadf51ecfd7681218b362f059332959 Mon Sep 17 00:00:00 2001
From: patrick96
Date: Mon, 28 Oct 2019 00:48:46 +0100
Subject: [PATCH] Add tests for apply_alpha
---
tests/unit_tests/utils/color.cpp | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/tests/unit_tests/utils/color.cpp b/tests/unit_tests/utils/color.cpp
index 5f1a8437..b28dabc9 100644
--- a/tests/unit_tests/utils/color.cpp
+++ b/tests/unit_tests/utils/color.cpp
@@ -112,6 +112,16 @@ TEST(Rgba, channel) {
EXPECT_EQ(0x99 / 255.0, rgba{0x88449933}.g());
}
+TEST(Rgba, applyAlpha) {
+ rgba v{0xCC123456};
+ v.apply_alpha(rgba{0xAA000000, rgba::ALPHA_ONLY});
+ EXPECT_EQ(0xAA123456, v.m_value);
+
+ v = rgba{0x00123456};
+ v.apply_alpha(rgba{0xCC999999});
+ EXPECT_EQ(0xCC123456, v.m_value);
+}
+
TEST(ColorUtil, simplify) {
EXPECT_EQ("#111", color_util::simplify_hex("#FF111111"));
EXPECT_EQ("#234", color_util::simplify_hex("#ff223344"));