コード例 #1
0
        [Test] public void dirtied()
        {
            YGNode root = YGNodeNew();

            YGNodeStyleSetAlignItems(root, YGAlign.FlexStart);
            YGNodeStyleSetWidth(root, 100);
            YGNodeStyleSetHeight(root, 100);

            YGNodeCalculateLayout(root, YGValue.YGUndefined, YGValue.YGUndefined, YGDirection.LTR);

            //int dirtiedCount = 0;
            root.setContext(0);
            root.setDirtiedFunc(_dirtied);

            Assert.AreEqual(0, (int)root.getContext());

            // `_dirtied` MUST be called in case of explicit dirtying.
            root.setDirty(true);
            Assert.AreEqual(1, (int)root.getContext());

            // `_dirtied` MUST be called ONCE.
            root.setDirty(true);
            Assert.AreEqual(1, (int)root.getContext());
        }