From 27a861e2ee1bd7497f17788f16b64253a5cc47c3 Mon Sep 17 00:00:00 2001 From: adriancampo Date: Fri, 5 Apr 2024 11:46:58 +0200 Subject: [PATCH] Refs #20160: Fixed tests. Signed-off-by: adriancampo --- .../rtps/monitor_service/connections_fwd.hpp | 2 +- .../type_representation/TypeObjectRegistry.cpp | 13 ++++++++++--- .../rtps/builtin/BuiltinDataSerializationTests.cpp | 5 +++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/include/fastdds/statistics/rtps/monitor_service/connections_fwd.hpp b/include/fastdds/statistics/rtps/monitor_service/connections_fwd.hpp index 0f6ee4ef79..abea1e4cf1 100644 --- a/include/fastdds/statistics/rtps/monitor_service/connections_fwd.hpp +++ b/include/fastdds/statistics/rtps/monitor_service/connections_fwd.hpp @@ -13,7 +13,7 @@ // limitations under the License. /** - * @file connection_fwd.hpp + * @file connections_fwd.hpp * */ diff --git a/src/cpp/fastdds/xtypes/type_representation/TypeObjectRegistry.cpp b/src/cpp/fastdds/xtypes/type_representation/TypeObjectRegistry.cpp index 77449f34bd..7329161c7b 100644 --- a/src/cpp/fastdds/xtypes/type_representation/TypeObjectRegistry.cpp +++ b/src/cpp/fastdds/xtypes/type_representation/TypeObjectRegistry.cpp @@ -693,11 +693,18 @@ const TypeIdentifier TypeObjectRegistry::get_complementary_type_identifier( std::lock_guard data_guard(type_object_registry_mutex_); for (const auto& it : local_type_identifiers_) { - if (it.second.type_identifier1() == type_id && TK_NONE != it.second.type_identifier2()._d()) + if (it.second.type_identifier1() == type_id) { - return it.second.type_identifier2(); + if (TK_NONE != it.second.type_identifier2()._d()) + { + return it.second.type_identifier2(); + } + else + { + return it.second.type_identifier1(); + } } - else if (it.second.type_identifier2() == type_id || TK_NONE == it.second.type_identifier2()._d()) + else if (it.second.type_identifier2() == type_id) { return it.second.type_identifier1(); } diff --git a/test/unittest/rtps/builtin/BuiltinDataSerializationTests.cpp b/test/unittest/rtps/builtin/BuiltinDataSerializationTests.cpp index b35f180aad..fcbce6a037 100644 --- a/test/unittest/rtps/builtin/BuiltinDataSerializationTests.cpp +++ b/test/unittest/rtps/builtin/BuiltinDataSerializationTests.cpp @@ -141,6 +141,7 @@ TEST(BuiltinDataSerializationTests, ok_with_defaults) } // Regression test for redmine issue #10547 +// After XTypes1.3 readFromCDRMessage is expected to return false when reading fails TEST(BuiltinDataSerializationTests, ignore_unsupported_type_info) { // DATA(w) @@ -189,7 +190,7 @@ TEST(BuiltinDataSerializationTests, ignore_unsupported_type_info) msg.length = msg.max_size; WriterProxyData out(max_unicast_locators, max_multicast_locators); - EXPECT_NO_THROW(EXPECT_TRUE(out.readFromCDRMessage(&msg, network, false, true))); + EXPECT_NO_THROW(EXPECT_FALSE(out.readFromCDRMessage(&msg, network, false, true))); } // DATA(r) @@ -241,7 +242,7 @@ TEST(BuiltinDataSerializationTests, ignore_unsupported_type_info) msg.length = msg.max_size; ReaderProxyData out(max_unicast_locators, max_multicast_locators); - EXPECT_NO_THROW(EXPECT_TRUE(out.readFromCDRMessage(&msg, network, false, true))); + EXPECT_NO_THROW(EXPECT_FALSE(out.readFromCDRMessage(&msg, network, false, true))); } }