From 8a7183f465858d3696f2db47d637456462c16b13 Mon Sep 17 00:00:00 2001 From: Kazuki Sakamoto Date: Wed, 9 Nov 2016 13:17:44 -0800 Subject: [PATCH] Add tests for SetMeasureFunction Summary: Add tests for checking C side asserts in managed Reviewed By: emilsjolander Differential Revision: D4154869 fbshipit-source-id: 5203db27eff963d46f188de448f607a24ed63fab --- .../tests/Facebook.CSSLayout/CSSNodeTest.cs | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/csharp/tests/Facebook.CSSLayout/CSSNodeTest.cs b/csharp/tests/Facebook.CSSLayout/CSSNodeTest.cs index f46ef24d..badf4639 100644 --- a/csharp/tests/Facebook.CSSLayout/CSSNodeTest.cs +++ b/csharp/tests/Facebook.CSSLayout/CSSNodeTest.cs @@ -161,6 +161,30 @@ namespace Facebook.CSSLayout Assert.AreEqual(150, (int)node.LayoutHeight); } + [Test] + [ExpectedException("System.InvalidOperationException")] + public void TestChildWithMeasureFunc() + { + CSSNode node = new CSSNode(); + node.SetMeasureFunction((_, width, widthMode, height, heightMode) => { + return MeasureOutput.Make(100, 150); + }); + CSSNode child = new CSSNode(); + node.Insert(0, child); + } + + [Test] + [ExpectedException("System.InvalidOperationException")] + public void TestMeasureFuncWithChild() + { + CSSNode node = new CSSNode(); + CSSNode child = new CSSNode(); + node.Insert(0, child); + node.SetMeasureFunction((_, width, widthMode, height, heightMode) => { + return MeasureOutput.Make(100, 150); + }); + } + [Test] public void TestPrint() {