@@ -34,6 +34,7 @@ TTestRecord = record
3434 end ;
3535
3636 TFruitDynArray = TArray<TFruit>;
37+ TStaticArray = array [0 ..999 ] of Int64;
3738 TTestRttiAccess = class
3839 private
3940 FFruit: TFruit;
@@ -49,6 +50,8 @@ TTestRttiAccess = class
4950 procedure BuyFruits (AFruits: TFruits);
5051 procedure SellFruits (const AFruits: TFruitDynArray);
5152 procedure SellFruitsInt (const AFruits:TIntegerDynArray);
53+ function GetDynArray : TInt64DynArray;
54+ function GetStaticArray : TStaticArray;
5255 property Fruit: TFruit read FFruit write FFruit;
5356 property Fruits: TFruits read FFruits write FFruits;
5457
@@ -106,6 +109,10 @@ TTestWrapDelphi = class(TObject)
106109 procedure TestInterfaceField ;
107110 [Test]
108111 procedure TestDynArrayParameters ;
112+ [Test]
113+ procedure TestGetDynArray ;
114+ [Test]
115+ procedure TestGetStaticArray ;
109116 end ;
110117
111118implementation
@@ -217,6 +224,26 @@ procedure TTestWrapDelphi.TestEnumProperty;
217224 Assert.IsTrue(TestRttiAccess.Fruit = Banana);
218225end ;
219226
227+ procedure TTestWrapDelphi.TestGetDynArray ;
228+ var
229+ List: Variant;
230+ begin
231+ List := Rtti_Var.GetDynArray();
232+ Assert.IsTrue(VarIsPythonList(List));
233+ Assert.AreEqual(1000000 , Integer(len(List)));
234+ Assert.AreEqual(Int64(999999 ), Int64(PythonEngine.PyObjectAsVariant(PythonEngine.PyList_GetItem(ExtractPythonObjectFrom(List), 999999 ))));
235+ end ;
236+ 237+ procedure TTestWrapDelphi.TestGetStaticArray ;
238+ var
239+ List: Variant;
240+ begin
241+ List := Rtti_Var.GetStaticArray();
242+ Assert.IsTrue(VarIsPythonList(List));
243+ Assert.AreEqual(1000 , Integer(len(List)));
244+ Assert.AreEqual(Int64(999 ), Int64(PythonEngine.PyObjectAsVariant(PythonEngine.PyList_GetItem(ExtractPythonObjectFrom(List), 999 ))));
245+ end ;
246+ 220247procedure TTestWrapDelphi.TestInterface ;
221248begin
222249 Rtti_Interface.SetString(' Test' );
@@ -369,6 +396,23 @@ procedure TTestWrapDelphi.TestDynArrayParameters;
369396 Assert.IsTrue(TestRttiAccess.Fruits = [Orange]);
370397end ;
371398
399+ function TTestRttiAccess.GetDynArray : TInt64DynArray;
400+ var
401+ I: Integer;
402+ begin
403+ SetLength(Result, 1000000 );
404+ for I := 0 to Length(Result) - 1 do
405+ Result[I] := I;
406+ end ;
407+ 408+ function TTestRttiAccess.GetStaticArray : TStaticArray;
409+ var
410+ I: Integer;
411+ begin
412+ for I := 0 to Length(Result) - 1 do
413+ Result[I] := I;
414+ end ;
415+ 372416procedure TTestRttiAccess.SellFruits (const AFruits: TFruitDynArray);
373417var
374418 Fruit: TFruit;
0 commit comments