Skip to content

Commit

Permalink
vkconfig: fix LOAD_FOLDER unit test
Browse files Browse the repository at this point in the history
Change-Id: I5b001f3d086b135061fbc641a779db07c0493521
  • Loading branch information
christophe-lunarg committed Jan 8, 2024
1 parent 96986ef commit b5e438d
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 13 deletions.
2 changes: 1 addition & 1 deletion vkconfig_core/setting_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
48 changes: 46 additions & 2 deletions vkconfig_core/test/VK_LAYER_LUNARG_reference_1_2_0.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
}
]
},
Expand Down Expand Up @@ -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",
Expand Down
20 changes: 10 additions & 10 deletions vkconfig_core/test/test_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<const SettingDataFolderLoad*>(FindSetting(layer.presets[index].settings, "load_folder_required_only"));
Expand All @@ -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<const SettingDataFileSave*>(FindSetting(layer.presets[index].settings, "save_file_required_only"));
Expand All @@ -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<const SettingDataFolderSave*>(FindSetting(layer.presets[index].settings, "save_folder_required_only"));
Expand All @@ -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<const SettingDataInt*>(FindSetting(layer.presets[index].settings, "int_required_only"));
Expand All @@ -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());
Expand All @@ -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<const SettingDataList*>(FindSetting(layer.presets[index].settings, "list_required_only"));
Expand Down

0 comments on commit b5e438d

Please sign in to comment.