More director const std::string& testing and C# leak fix

Issue #998
This commit is contained in:
William S Fulton 2022-02-13 22:55:27 +00:00
commit 8e4868af75
5 changed files with 60 additions and 4 deletions

View file

@ -23,3 +23,34 @@ if foo.a != "BIBI":
raise RuntimeError
if foo.getA() != "BIBI":
raise RuntimeError
class MyFoo(director_property.Foo):
def setA(self, a):
director_property.Foo.setA(self, a + " set from MyFoo")
def setAByRef(self, a):
director_property.Foo.setA(self, a + " setAByRef from MyFoo")
a = MyFoo()
if (a.getA() != ""):
raise RuntimeError("Test failed")
a.setA("Hello")
if (a.getA() != "Hello set from MyFoo"):
raise RuntimeError("Test failed")
a.setAByRef("Hello")
if (a.getA() != "Hello setAByRef from MyFoo"):
raise RuntimeError("Test failed")
del a
a_original = MyFoo()
a = director_property.Foo.get_self(a_original)
if (a.getA() != ""):
raise RuntimeError("Test failed")
a.setA("Hello")
if (a.getA() != "Hello set from MyFoo"):
raise RuntimeError("Test failed")
a.setAByRef("Hello")
if (a.getA() != "Hello setAByRef from MyFoo"):
raise RuntimeError("Test failed")
del a