Merge branch 'development' into LYN-4195
This commit is contained in:
@@ -274,7 +274,7 @@ namespace AZ
|
||||
{
|
||||
using Callable = AZStd::conditional_t<AZStd::function_traits<Invocable>::value, AZStd::function<typename AZStd::function_traits<Invocable>::function_type>, Invocable>;
|
||||
public:
|
||||
AZ_RTTI((AttributeInvocable<Invocable>, "{60D5804F-9AF4-4EB1-8F5A-62AFB4883F9D}"), AZ::Attribute);
|
||||
AZ_RTTI((AttributeInvocable<Invocable>, "{60D5804F-9AF4-4EB1-8F5A-62AFB4883F9D}", Invocable), AZ::Attribute);
|
||||
AZ_CLASS_ALLOCATOR(AttributeInvocable<Invocable>, SystemAllocator, 0);
|
||||
template<typename CallableType>
|
||||
explicit AttributeInvocable(CallableType&& invocable)
|
||||
|
||||
@@ -2010,6 +2010,28 @@ TEST_F(SerializeBasicTest, BasicTypeTest_Succeed)
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
This test will dynamic cast (azrtti_cast) between incompatible types, which should always result in nullptr.
|
||||
If this test fails, the RTTI declaration for the relevant type is incorrect.
|
||||
*/
|
||||
TEST_F(Serialization, AttributeRTTI)
|
||||
{
|
||||
{
|
||||
AttributeInvocable<AZStd::function<AZStd::string(AZStd::string)>> fn([](AZStd::string x) { return x + x; });
|
||||
Attribute* fnDownCast = &fn;
|
||||
auto fnUpCast = azrtti_cast<AttributeInvocable<AZStd::function<int(int)>>*>(fnDownCast);
|
||||
EXPECT_EQ(fnUpCast, nullptr);
|
||||
}
|
||||
|
||||
{
|
||||
AttributeFunction<AZStd::string(AZStd::string)> fn([](AZStd::string x) { return x + x; });
|
||||
Attribute* fnDownCast = &fn;
|
||||
auto fnUpCast = azrtti_cast<AttributeFunction<int(int)>*>(fnDownCast);
|
||||
EXPECT_EQ(fnUpCast, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Deprecation
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user