|
| 1 | +// Tencent is pleased to support the open source community by making UnLua available. |
| 2 | +// |
| 3 | +// Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. |
| 4 | +// |
| 5 | +// Licensed under the MIT License (the "License"); |
| 6 | +// you may not use this file except in compliance with the License. You may obtain a copy of the License at |
| 7 | +// |
| 8 | +// http://opensource.org/licenses/MIT |
| 9 | +// |
| 10 | +// Unless required by applicable law or agreed to in writing, |
| 11 | +// software distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +// See the License for the specific language governing permissions and limitations under the License. |
| 14 | + |
| 15 | +#include "UnLuaTestCommon.h" |
| 16 | +#include "Misc/AutomationTest.h" |
| 17 | + |
| 18 | +#if WITH_DEV_AUTOMATION_TESTS |
| 19 | + |
| 20 | +struct FUnLuaTest_Issue668 : FUnLuaTestBase |
| 21 | +{ |
| 22 | + virtual bool InstantTest() override |
| 23 | + { |
| 24 | + return true; |
| 25 | + } |
| 26 | + |
| 27 | + virtual bool SetUp() override |
| 28 | + { |
| 29 | + FUnLuaTestBase::SetUp(); |
| 30 | + |
| 31 | + const auto Chunk = R"( |
| 32 | + local StructType = UE.UObject.Load("/UnLuaTestSuite/Tests/Regression/Issue668/Struct_Issue668.Struct_Issue668") |
| 33 | + local Array = UE.TArray(StructType) |
| 34 | + local Struct1 = StructType() |
| 35 | + local Struct2 = StructType() |
| 36 | + Array:Add(Struct1) |
| 37 | + Array:Add(Struct2) |
| 38 | + )"; |
| 39 | + UnLua::RunChunk(L, Chunk); |
| 40 | + |
| 41 | + return true; |
| 42 | + } |
| 43 | +}; |
| 44 | + |
| 45 | +IMPLEMENT_UNLUA_INSTANT_TEST(FUnLuaTest_Issue668, TEXT("UnLua.Regression.Issue668 在Lua中调用TArray的Add接口时内存对齐引起的问题")) |
| 46 | + |
| 47 | +#endif |
0 commit comments