Clean up MeasureFunc and PrintFunc
Summary: - Remove unneeded instance variables - Simplify MeasureFunc call - Add unittest Reviewed By: emilsjolander Differential Revision: D4013176 fbshipit-source-id: 4cdfa3ac3ad60a6bac5cda10644376ee9c46300b
This commit is contained in:
committed by
Facebook Github Bot
parent
722bfb9032
commit
7548164edb
@@ -241,6 +241,19 @@ namespace Facebook.CSSLayout
|
||||
Assert.AreEqual(0, parent.IndexOf(child1));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestMeasureFunc()
|
||||
{
|
||||
CSSNode node = new CSSNode();
|
||||
node.SetMeasureFunction((_, width, widthMode, height, heightMode, measureResult) => {
|
||||
measureResult.Width = 100;
|
||||
measureResult.Height = 150;
|
||||
});
|
||||
node.CalculateLayout();
|
||||
Assert.AreEqual(100, (int)node.LayoutWidth);
|
||||
Assert.AreEqual(150, (int)node.LayoutHeight);
|
||||
}
|
||||
|
||||
private void ForceGC()
|
||||
{
|
||||
GC.Collect(GC.MaxGeneration);
|
||||
|
Reference in New Issue
Block a user