From 6493408bd21c2af6dbfa00fca55a6e3b41754c37 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sun, 25 Dec 2016 01:29:49 +0000 Subject: [PATCH] Updated ColourStruct unit tests --- source/tests/xestiacalendar_commonfunctions.h | 36 ++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/source/tests/xestiacalendar_commonfunctions.h b/source/tests/xestiacalendar_commonfunctions.h index d5c065d..d8cace2 100644 --- a/source/tests/xestiacalendar_commonfunctions.h +++ b/source/tests/xestiacalendar_commonfunctions.h @@ -326,7 +326,41 @@ TEST(CommonFunctions, ColourStruct){ ASSERT_EQ("#FFFFFFFF", (string)Colour2); ASSERT_EQ("#10101010", (string)Colour3); ASSERT_EQ("#50505050", (string)Colour4); - + + string ColourInput1 = "#204040FF"; + string ColourInput2 = "#408080FF"; + string ColourInput3 = "#A0A0A000"; + string ColourInput4 = "#FFFFFF20"; + + Colour Colour5; + Colour Colour6; + Colour Colour7; + Colour Colour8; + + Colour5 = ColourInput1; + Colour6 = ColourInput2; + Colour7 = ColourInput3; + Colour8 = ColourInput4; + + ASSERT_EQ(32, Colour5.red); + ASSERT_EQ(64, Colour5.green); + ASSERT_EQ(64, Colour5.blue); + ASSERT_EQ(255, Colour5.alpha); + + ASSERT_EQ(64, Colour6.red); + ASSERT_EQ(128, Colour6.green); + ASSERT_EQ(128, Colour6.blue); + ASSERT_EQ(255, Colour6.alpha); + + ASSERT_EQ(160, Colour7.red); + ASSERT_EQ(160, Colour7.green); + ASSERT_EQ(160, Colour7.blue); + ASSERT_EQ(0, Colour7.alpha); + + ASSERT_EQ(255, Colour8.red); + ASSERT_EQ(255, Colour8.green); + ASSERT_EQ(255, Colour8.blue); + ASSERT_EQ(32, Colour8.alpha); } TEST(CommonFunctions, OutputText){ -- 2.39.5