Skip to content

Commit

Permalink
Fix Windows only failing unittests
Browse files Browse the repository at this point in the history
  • Loading branch information
GsLogiMaker committed Nov 22, 2024
1 parent 0e4e992 commit 6c2bd97
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@

# Visual Studio
*/.vs

# Compiled binaries
bin/

Expand All @@ -8,3 +11,6 @@ cpp/.sconsign.dblite
cpp/compile_commands.json
cpp/src/doc_data.gen.h
*.os
# Windows
*.obj
*.obj.import
2 changes: 1 addition & 1 deletion cpp/SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def main():
env.Tool('compilation_db')
cdb = env.CompilationDatabase()
x = env.Alias('cdb', cdb)
if "cdb" in COMMAND_LINE_TARGETS:
if "cdb" in COMMAND_LINE_TARGETS and "-fno-gnu-unique" in env._dict["CXXFLAGS"]:
env._dict["CXXFLAGS"].remove("-fno-gnu-unique")

platform:str = env["platform"]
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/world.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,7 @@ void GFWorld::init_gd_type_ptr(
switch (vari_type) {
case(Variant::Type::NIL): if (ecs_has(_raw, type, EcsStruct)) {init_component_ptr(ptr, type, Variant());}; break;
case(Variant::Type::BOOL): *static_cast<bool*>(ptr) = false; break;
case(Variant::Type::INT): *static_cast<int*>(ptr) = 0; break;
case(Variant::Type::INT): *static_cast<int64_t*>(ptr) = 0; break;
case(Variant::Type::FLOAT): *static_cast<float*>(ptr) = 0.0; break;
case(Variant::Type::STRING): new(ptr) String(); break;
case(Variant::Type::VECTOR2): new(ptr) Vector2(); break;
Expand Down
8 changes: 1 addition & 7 deletions unittests/test_events.gd
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ func test_on_add_event_with_objects():
.set_name("WithInts")
assert_eq(data.i, 1)
assert_eq(e.get_component(Textures).a, null)
assert_eq(e.get_component(Textures).b, null)

e.delete()

Expand All @@ -90,10 +89,9 @@ func test_on_add_event_with_objects():
data.i = 0
var e2:= GFEntity.spawn(world) \
.set_name("WithTextures")
e2.add_component(Textures, [load("res://icon.png"), load("res://icon.svg")])
e2.add_component(Textures, [load("res://icon.png")])
assert_eq(data.i, 1)
assert_eq(e2.get_component(Textures).a, load("res://icon.png"))
assert_eq(e2.get_component(Textures).b, load("res://icon.svg"))

e2.delete()

Expand All @@ -115,12 +113,8 @@ class Ints extends GFComponent:
class Textures extends GFComponent:
func _build(b:GFComponentBuilder) -> void:
b.add_member("a", TYPE_OBJECT)
b.add_member("b", TYPE_OBJECT)
var a:Texture2D:
get: return getm(&"a")
set(v): setm(&"a", v)
var b:Texture2D:
get: return getm(&"b")
set(v): setm(&"b", v)

#endregion

0 comments on commit 6c2bd97

Please sign in to comment.