X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Ftests%2Fxestiacalendar_commonfunctions.h;h=1b8af0b4a50ccbb2a533fc20f54338d9a2d6a55a;hb=b21ea336e08289c984eccd4baeefdb67e5901281;hp=ce4fc7c0301b332b78f36e8d63e5d6ef9fe8b364;hpb=ae6657a9d645df0ffbbf7ddac8535b794f98b266;p=xestiacalendar%2F.git diff --git a/source/tests/xestiacalendar_commonfunctions.h b/source/tests/xestiacalendar_commonfunctions.h index ce4fc7c..1b8af0b 100644 --- a/source/tests/xestiacalendar_commonfunctions.h +++ b/source/tests/xestiacalendar_commonfunctions.h @@ -18,6 +18,7 @@ #include "../common/file.h" #include "../common/text.h" +#include "../common/colour.h" TEST(CommonFunctions, FileTests){ @@ -258,4 +259,71 @@ TEST(CommonFunctions, HexToInt){ Result = HexToInt(&Value11, &OutputValue); ASSERT_EQ(Result, false); +} + +TEST(CommonFunctions, SplitPathFilename){ + + // Setup the file split. + + string PathFilenameOriginal = "/example/file/yay.txt"; + string Path = ""; + string File = ""; + + SplitPathFilename(&PathFilenameOriginal, &Path, &File); + + ASSERT_EQ("/example/file/", Path); + ASSERT_EQ("yay.txt", File); + + PathFilenameOriginal = "/a/path/with/lots/of/bits/in/andthenthis.html"; + Path.clear(); + File.clear(); + + SplitPathFilename(&PathFilenameOriginal, &Path, &File); + + ASSERT_EQ("/a/path/with/lots/of/bits/in/", Path); + ASSERT_EQ("andthenthis.html", File); + + PathFilenameOriginal = "/one/more/for/a/laugh/hahaha.zip"; + Path.clear(); + File.clear(); + + SplitPathFilename(&PathFilenameOriginal, &Path, &File); + + ASSERT_EQ("/one/more/for/a/laugh/", Path); + ASSERT_EQ("hahaha.zip", File); + +} + +TEST(CommonFunctions, ColourStruct){ + + Colour Colour1; + Colour Colour2; + Colour Colour3; + Colour Colour4; + + Colour1.red = 0; + Colour1.green = 0; + Colour1.blue = 0; + Colour1.alpha = 0; + + Colour2.red = 512; + Colour2.green = 512; + Colour2.blue = 512; + Colour2.alpha = 512; + + Colour3.red = 16; + Colour3.green = 16; + Colour3.blue = 16; + Colour3.alpha = 16; + + Colour4.red = 80; + Colour4.green = 80; + Colour4.blue = 80; + Colour4.alpha = 80; + + ASSERT_EQ("#00000000", (string)Colour1); + ASSERT_EQ("#FFFFFFFF", (string)Colour2); + ASSERT_EQ("#10101010", (string)Colour3); + ASSERT_EQ("#50505050", (string)Colour4); + } \ No newline at end of file