From b5e438d6fc483d2d91932e8e28d05ba406bffbc9 Mon Sep 17 00:00:00 2001 From: Christophe Date: Mon, 8 Jan 2024 19:37:22 +0100 Subject: [PATCH] vkconfig: fix LOAD_FOLDER unit test Change-Id: I5b001f3d086b135061fbc641a779db07c0493521 --- vkconfig_core/setting_string.h | 2 +- .../test/VK_LAYER_LUNARG_reference_1_2_0.json | 48 ++++++++++++++++++- vkconfig_core/test/test_layer.cpp | 20 ++++---- 3 files changed, 57 insertions(+), 13 deletions(-) diff --git a/vkconfig_core/setting_string.h b/vkconfig_core/setting_string.h index e9f6092d9a..068f48d981 100644 --- a/vkconfig_core/setting_string.h +++ b/vkconfig_core/setting_string.h @@ -55,9 +55,9 @@ struct SettingDataString : public SettingData { const char* GetValue() const; void SetValue(const char* value); - protected: std::string value; + protected: SettingDataString(const std::string& key, const SettingType& type); bool Equal(const SettingData& other) const override; diff --git a/vkconfig_core/test/VK_LAYER_LUNARG_reference_1_2_0.json b/vkconfig_core/test/VK_LAYER_LUNARG_reference_1_2_0.json index 6d187002b3..8f3d6dfb1c 100644 --- a/vkconfig_core/test/VK_LAYER_LUNARG_reference_1_2_0.json +++ b/vkconfig_core/test/VK_LAYER_LUNARG_reference_1_2_0.json @@ -99,6 +99,22 @@ } ] }, + { + "label": "Preset Load Folder", + "description": "Description Load Folder", + "platforms": [ "WINDOWS", "MACOS" ], + "status": "DEPRECATED", + "settings": [ + { + "key": "load_folder_required_only", + "value": "./text" + }, + { + "key": "load_folder_with_optional", + "value": "./text" + } + ] + }, { "label": "Preset Save File", "description": "Description Save File", @@ -123,11 +139,11 @@ "settings": [ { "key": "save_folder_required_only", - "value": "./text.log" + "value": "./text" }, { "key": "save_folder_with_optional", - "value": "./text.log" + "value": "./text" } ] }, @@ -440,6 +456,34 @@ ] } }, + { + "key": "load_folder_required_only", + "type": "LOAD_FOLDER", + "label": "Load folder", + "description": "Load folder path", + "default": "./test" + }, + { + "key": "load_folder_with_optional", + "env": "VK_REF_LOAD_FOLDER", + "type": "LOAD_FOLDER", + "label": "Load folder", + "description": "Load folder path", + "url": "https://vulkan.lunarg.com/doc/sdk/latest/windows/layer_dummy.html#load_folder", + "status": "BETA", + "view": "ADVANCED", + "platforms": [ "WINDOWS", "LINUX" ], + "default": "./test", + "dependence": { + "mode": "ALL", + "settings": [ + { + "key": "toogle", + "value": true + } + ] + } + }, { "key": "save_file_required_only", "type": "SAVE_FILE", diff --git a/vkconfig_core/test/test_layer.cpp b/vkconfig_core/test/test_layer.cpp index c70f232aca..83bd9a318c 100644 --- a/vkconfig_core/test/test_layer.cpp +++ b/vkconfig_core/test/test_layer.cpp @@ -327,7 +327,7 @@ TEST(test_layer, load_1_2_0_preset_and_setting_type) { // Preset Load Folder { - const std::size_t index = 4; + const std::size_t index = 5; const SettingDataFolderLoad* setting_only = static_cast(FindSetting(layer.presets[index].settings, "load_folder_required_only")); @@ -340,13 +340,13 @@ TEST(test_layer, load_1_2_0_preset_and_setting_type) { EXPECT_STREQ("Description Load Folder", layer.presets[index].description.c_str()); EXPECT_EQ(PLATFORM_WINDOWS_BIT | PLATFORM_MACOS_BIT, layer.presets[index].platform_flags); EXPECT_EQ(STATUS_DEPRECATED, layer.presets[index].status); - EXPECT_STREQ("./text.log", setting_only->value.c_str()); - EXPECT_STREQ("./text.log", setting_opt->value.c_str()); + EXPECT_STREQ("./text", setting_only->value.c_str()); + EXPECT_STREQ("./text", setting_opt->value.c_str()); } // Preset Save File { - const std::size_t index = 5; + const std::size_t index = 6; const SettingDataFileSave* setting_only = static_cast(FindSetting(layer.presets[index].settings, "save_file_required_only")); @@ -365,7 +365,7 @@ TEST(test_layer, load_1_2_0_preset_and_setting_type) { // Preset Save Folder { - const std::size_t index = 6; + const std::size_t index = 7; const SettingDataFolderSave* setting_only = static_cast(FindSetting(layer.presets[index].settings, "save_folder_required_only")); @@ -378,13 +378,13 @@ TEST(test_layer, load_1_2_0_preset_and_setting_type) { EXPECT_STREQ("Description Save Folder", layer.presets[index].description.c_str()); EXPECT_EQ(PLATFORM_WINDOWS_BIT | PLATFORM_MACOS_BIT, layer.presets[index].platform_flags); EXPECT_EQ(STATUS_DEPRECATED, layer.presets[index].status); - EXPECT_STREQ("./text.log", setting_only->value.c_str()); - EXPECT_STREQ("./text.log", setting_opt->value.c_str()); + EXPECT_STREQ("./text", setting_only->value.c_str()); + EXPECT_STREQ("./text", setting_opt->value.c_str()); } // Preset int { - const std::size_t index = 7; + const std::size_t index = 8; const SettingDataInt* setting_only = static_cast(FindSetting(layer.presets[index].settings, "int_required_only")); @@ -403,7 +403,7 @@ TEST(test_layer, load_1_2_0_preset_and_setting_type) { // Preset Frames { - const std::size_t index = 8; + const std::size_t index = 9; EXPECT_STREQ("Preset Frames", layer.presets[index].label.c_str()); EXPECT_STREQ("Description Frames", layer.presets[index].description.c_str()); @@ -419,7 +419,7 @@ TEST(test_layer, load_1_2_0_preset_and_setting_type) { // Preset List { - const std::size_t index = 9; + const std::size_t index = 10; const SettingDataList* setting_only = static_cast(FindSetting(layer.presets[index].settings, "list_required_only"));