Merge pull request #56337 from cdemirer/fix-array-dictionary-id

This commit is contained in:
Rémi Verschelde 2022-01-23 00:46:53 +01:00 committed by GitHub
commit 668d6a1c5c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View file

@ -631,7 +631,7 @@ Variant Array::max() const {
}
const void *Array::id() const {
return _p->array.ptr();
return _p;
}
Array::Array(const Array &p_from, uint32_t p_type, const StringName &p_class_name, const Variant &p_script) {

View file

@ -350,7 +350,7 @@ void Dictionary::operator=(const Dictionary &p_dictionary) {
}
const void *Dictionary::id() const {
return _p->variant_map.id();
return _p;
}
Dictionary::Dictionary(const Dictionary &p_from) {

View file

@ -196,7 +196,7 @@ TEST_CASE("[Dictionary] Duplicate dictionary") {
Dictionary shallow_d = d.duplicate(false);
CHECK_MESSAGE(shallow_d.id() != d.id(), "Should create a new array");
CHECK_MESSAGE(Dictionary(shallow_d[1]).id() == Dictionary(d[1]).id(), "Should keep nested dictionary");
CHECK_MESSAGE(Array(shallow_d[2]).id() == Array(d[2]).id(), "Should keep nested array");
CHECK_MESSAGE(Array(shallow_d[k2]).id() == Array(d[k2]).id(), "Should keep nested array");
CHECK_EQ(shallow_d, d);
shallow_d[0] = 0;
CHECK_NE(shallow_d, d);