TextInputProperty.cpp 705 B

12345678910111213141516171819202122
  1. #include <catch2/catch_test_macros.hpp>
  2. #include "WallpaperEngine/Data/Model/Property.h"
  3. #include "WallpaperEngine/Data/Parsers/PropertyParser.h"
  4. using WallpaperEngine::Data::JSON::JSON;
  5. using WallpaperEngine::Data::Model::DynamicValue;
  6. using WallpaperEngine::Data::Parsers::PropertyParser;
  7. TEST_CASE ("Text input properties keep their string value without JSON quotes") {
  8. const JSON propertyData = {
  9. { "type", "textinput" },
  10. { "text", "Format" },
  11. { "value", "HH:mm" },
  12. };
  13. const auto property = PropertyParser::parse (propertyData, "format");
  14. REQUIRE (property != nullptr);
  15. CHECK (property->getType () == DynamicValue::String);
  16. CHECK (property->getString () == "HH:mm");
  17. }