|
|
@@ -0,0 +1,33 @@
|
|
|
+#include <catch2/catch_test_macros.hpp>
|
|
|
+
|
|
|
+#include "WallpaperEngine/Data/Parsers/PropertyParser.h"
|
|
|
+#include "WallpaperEngine/Data/Model/Property.h"
|
|
|
+
|
|
|
+using WallpaperEngine::Data::JSON::JSON;
|
|
|
+using WallpaperEngine::Data::Model::DynamicValue;
|
|
|
+using WallpaperEngine::Data::Parsers::PropertyParser;
|
|
|
+
|
|
|
+TEST_CASE ("Bool properties without a value default to false") {
|
|
|
+ const JSON propertyData = {
|
|
|
+ { "type", "bool" },
|
|
|
+ { "text", "Enabled" },
|
|
|
+ };
|
|
|
+
|
|
|
+ const auto property = PropertyParser::parse (propertyData, "enabled");
|
|
|
+
|
|
|
+ REQUIRE (property != nullptr);
|
|
|
+ CHECK (property->getType () == DynamicValue::Boolean);
|
|
|
+ CHECK_FALSE (property->getBool ());
|
|
|
+}
|
|
|
+
|
|
|
+TEST_CASE ("Directory properties are parsed as file-like properties") {
|
|
|
+ const JSON propertyData = {
|
|
|
+ { "type", "directory" },
|
|
|
+ { "text", "Folder" },
|
|
|
+ };
|
|
|
+
|
|
|
+ const auto property = PropertyParser::parse (propertyData, "folder");
|
|
|
+
|
|
|
+ REQUIRE (property != nullptr);
|
|
|
+ CHECK (property->dump ().find ("folder - file") != std::string::npos);
|
|
|
+}
|