From eb176b135a94158a14c31171d6e3765a2789ed81 Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Sat, 6 Aug 2022 13:47:56 +0800 Subject: [PATCH] Make theme tests compile in Visual Studio 2017 --- main/tests/test_theme.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/main/tests/test_theme.cpp b/main/tests/test_theme.cpp index 48ac60939d3..652aa6a2660 100644 --- a/main/tests/test_theme.cpp +++ b/main/tests/test_theme.cpp @@ -49,16 +49,24 @@ public: struct DataEntry { Theme::DataType type; Variant value; - } const valid_data[Theme::DATA_TYPE_MAX] = { + } valid_data[Theme::DATA_TYPE_MAX] = { { Theme::DATA_TYPE_COLOR, Color() }, { Theme::DATA_TYPE_CONSTANT, 42 }, - { Theme::DATA_TYPE_FONT, Ref(memnew(BitmapFont)) }, - { Theme::DATA_TYPE_ICON, Ref(memnew(ImageTexture)) }, - { Theme::DATA_TYPE_STYLEBOX, Ref(memnew(StyleBoxFlat)) }, + { Theme::DATA_TYPE_FONT, Variant() }, + { Theme::DATA_TYPE_ICON, Variant() }, + { Theme::DATA_TYPE_STYLEBOX, Variant() }, }; const StringName valid_item_name = "valid_item_name"; const StringName valid_type_name = "ValidTypeName"; + + // Part of `valid_data` initialization is moved here so that it compiles in Visual Studio 2017. + // See issue #63975. + Fixture() { + valid_data[Theme::DATA_TYPE_FONT].value = Ref(memnew(BitmapFont)); + valid_data[Theme::DATA_TYPE_ICON].value = Ref(memnew(ImageTexture)); + valid_data[Theme::DATA_TYPE_STYLEBOX].value = Ref(memnew(StyleBoxFlat)); + } }; bool test_good_theme_type_names() {