From b94f1498542be0e83fe8060a50bce5ff2d5a1c39 Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Fri, 8 May 2026 15:31:02 +0100 Subject: config: allow hashes for parsing colors (#14337) --- tests/helpers/MiscFunctions.cpp | 46 ----------------------------------------- 1 file changed, 46 deletions(-) (limited to 'tests/helpers/MiscFunctions.cpp') diff --git a/tests/helpers/MiscFunctions.cpp b/tests/helpers/MiscFunctions.cpp index e0857987..4eefb5d3 100644 --- a/tests/helpers/MiscFunctions.cpp +++ b/tests/helpers/MiscFunctions.cpp @@ -97,49 +97,3 @@ TEST(Helpers, truthyFalse) { EXPECT_FALSE(truthy("")); EXPECT_FALSE(truthy("random")); } - -// configStringToInt - -TEST(Helpers, configStringToIntDecimal) { - EXPECT_EQ(configStringToInt("42").value(), 42); - EXPECT_EQ(configStringToInt("0").value(), 0); - EXPECT_EQ(configStringToInt("-1").value(), -1); -} - -TEST(Helpers, configStringToIntHex) { - EXPECT_EQ(configStringToInt("0xFF").value(), 255); - EXPECT_EQ(configStringToInt("0x00").value(), 0); - EXPECT_EQ(configStringToInt("0x10").value(), 16); -} - -TEST(Helpers, configStringToIntRgba) { - auto result = configStringToInt("rgba(255, 0, 0, 1.0)"); - EXPECT_TRUE(result.has_value()); -} - -TEST(Helpers, configStringToIntBooleanStrings) { - // "true", "yes", "on" -> 1; "false", "no", "off" -> 0 - EXPECT_EQ(configStringToInt("true").value(), 1); - EXPECT_EQ(configStringToInt("yes").value(), 1); - EXPECT_EQ(configStringToInt("on").value(), 1); - EXPECT_EQ(configStringToInt("false").value(), 0); - EXPECT_EQ(configStringToInt("no").value(), 0); - EXPECT_EQ(configStringToInt("off").value(), 0); -} - -TEST(Helpers, configStringToIntInvalid) { - EXPECT_FALSE(configStringToInt("").has_value()); - EXPECT_FALSE(configStringToInt("abc").has_value()); -} - -// configStringToVector2D - -TEST(Helpers, configStringToVector2DValid) { - EXPECT_EQ(configStringToVector2D("1920 1080"), Vector2D(1920, 1080)); - EXPECT_EQ(configStringToVector2D("0 0"), Vector2D(0, 0)); -} - -TEST(Helpers, configStringToVector2DInvalid) { - EXPECT_THROW(configStringToVector2D("notvalid"), std::invalid_argument); - EXPECT_THROW(configStringToVector2D(""), std::invalid_argument); -} -- cgit v1.2.3