mirror of
https://github.com/Redot-Engine/redot-engine.git
synced 2025-12-06 07:17:42 -05:00
Merge pull request #104664 from tomfull123/missing-typed-dictionary-initializer-list
Add missing `initializer_list` constructor to TypedDictionary
This commit is contained in:
@@ -606,4 +606,28 @@ TEST_CASE("[Dictionary] Iteration") {
|
||||
a2.clear();
|
||||
}
|
||||
|
||||
TEST_CASE("[Dictionary] Object value init") {
|
||||
Object *a = memnew(Object);
|
||||
Object *b = memnew(Object);
|
||||
TypedDictionary<double, Object *> tdict = {
|
||||
{ 0.0, a },
|
||||
{ 5.0, b },
|
||||
};
|
||||
CHECK_EQ(tdict[0.0], Variant(a));
|
||||
CHECK_EQ(tdict[5.0], Variant(b));
|
||||
memdelete(a);
|
||||
memdelete(b);
|
||||
}
|
||||
|
||||
TEST_CASE("[Dictionary] RefCounted value init") {
|
||||
Ref<RefCounted> a = memnew(RefCounted);
|
||||
Ref<RefCounted> b = memnew(RefCounted);
|
||||
TypedDictionary<double, Ref<RefCounted>> tdict = {
|
||||
{ 0.0, a },
|
||||
{ 5.0, b },
|
||||
};
|
||||
CHECK_EQ(tdict[0.0], Variant(a));
|
||||
CHECK_EQ(tdict[5.0], Variant(b));
|
||||
}
|
||||
|
||||
} // namespace TestDictionary
|
||||
|
||||
Reference in New Issue
Block a user