Expose layout paddding in csharp api
Summary: Expose layout padding api from D4376572 Reviewed By: splhack Differential Revision: D4377070 fbshipit-source-id: 501628612675e3fdce9a8e77f929cb9c6eddc209
This commit is contained in:
committed by
Facebook Github Bot
parent
e539ecc9aa
commit
6d48307c8d
@@ -315,6 +315,9 @@ namespace Facebook.Yoga
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern float YGNodeLayoutGetHeight(YGNodeHandle node);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern float YGNodeLayoutGetPadding(YGNodeHandle node, YogaEdge edge);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern YogaDirection YGNodeLayoutGetDirection(YGNodeHandle node);
|
||||
|
||||
|
@@ -308,6 +308,11 @@ namespace Facebook.Yoga
|
||||
}
|
||||
}
|
||||
|
||||
public float GetLayoutPadding(YogaEdge edge)
|
||||
{
|
||||
return Native.YGNodeLayoutGetPadding(_ygNode, edge);
|
||||
}
|
||||
|
||||
public YogaValue Width
|
||||
{
|
||||
get
|
||||
|
@@ -355,5 +355,22 @@ namespace Facebook.Yoga
|
||||
return MeasureOutput.Make(120, 130);
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestLayoutPadding() {
|
||||
YogaNode node = new YogaNode();
|
||||
node.Width = 100;
|
||||
node.Height = 100;
|
||||
node.SetPadding(YogaEdge.Start, 1);
|
||||
node.SetPadding(YogaEdge.End, 2);
|
||||
node.SetPadding(YogaEdge.Top, 3);
|
||||
node.SetPadding(YogaEdge.Bottom, 4);
|
||||
node.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(1, node.GetLayoutPadding(YogaEdge.Left));
|
||||
Assert.AreEqual(2, node.GetLayoutPadding(YogaEdge.Right));
|
||||
Assert.AreEqual(3, node.GetLayoutPadding(YogaEdge.Top));
|
||||
Assert.AreEqual(4, node.GetLayoutPadding(YogaEdge.Bottom));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user