public void Updates() { MockApplication app = MockApplication.Setup <LayoutTestThing>(); app.SetViewportRect(new Rect(0, 0, 1000f, 1000f)); LayoutTestThing root = (LayoutTestThing)app.RootElement; app.Update(); Assert.AreEqual(Vector2.zero, root.child0.layoutResult.localPosition); Assert.AreEqual(new Vector2(0, 100), root.child1.layoutResult.localPosition); Assert.AreEqual(100, root.child1.layoutResult.actualSize.width); Assert.AreEqual(100, root.child1.layoutResult.actualSize.height); Assert.AreEqual(new Vector2(0, 200), root.child2.layoutResult.localPosition); Assert.AreEqual(100, root.child2.layoutResult.actualSize.width); Assert.AreEqual(100, root.child2.layoutResult.actualSize.height); root.child2.style.SetPreferredWidth(200, StyleState.Normal); app.Update(); Assert.AreEqual(Vector2.zero, root.child0.layoutResult.localPosition); Assert.AreEqual(new Vector2(0, 100), root.child1.layoutResult.localPosition); Assert.AreEqual(100, root.child1.layoutResult.actualSize.width); Assert.AreEqual(100, root.child1.layoutResult.actualSize.height); Assert.AreEqual(new Vector2(0, 200), root.child2.layoutResult.localPosition); Assert.AreEqual(200, root.child2.layoutResult.actualSize.width); Assert.AreEqual(100, root.child2.layoutResult.actualSize.height); }
public void MouseDown_StopPropagationInBubble() { MockApplication testView = MockApplication.Setup <InputSystemTestThing2>(); testView.Update(); testView.SetViewportRect(new Rect(0, 0, 1000, 1000)); InputSystemTestThing2 root = (InputSystemTestThing2)testView.RootElement; testView.InputSystem.MouseDown(new Vector2(120, 10)); root.shouldStopPropagation = true; testView.Update(); Assert.AreEqual(-1, root.clickedChildIndex); Assert.IsTrue(root.wasMouseDown); testView.InputSystem.ClearClickState(); testView.Update(); root.wasMouseDown = false; root.shouldStopPropagation = false; testView.InputSystem.MouseDown(new Vector2(120, 10)); testView.Update(); Assert.AreEqual(1, root.clickedChildIndex); Assert.IsTrue(root.wasMouseDown); }
public void RunWidthLayout() { MockApplication app = MockApplication.Setup <BasicLayoutTest_GathersDirtyData>(); BasicLayoutTest_GathersDirtyData root = app.RootElement as BasicLayoutTest_GathersDirtyData; app.Update(); UIElement one = root[0]; UIElement two = root[1]; UIElement three = root[2]; Assert.AreEqual(3, root.layoutBox.childCount); Assert.AreEqual(100, one.layoutBox.finalWidth); Assert.AreEqual(100, two.layoutBox.finalWidth); Assert.AreEqual(100, three.layoutBox.finalWidth); Assert.AreEqual(0, one.layoutResult.localPosition.x); Assert.AreEqual(100, two.layoutResult.localPosition.x); Assert.AreEqual(200, three.layoutResult.localPosition.x); root.FindById("one").SetEnabled(false); app.Update(); Assert.AreEqual(2, root.layoutBox.childCount); Assert.AreEqual(100, two.layoutBox.finalWidth); Assert.AreEqual(100, three.layoutBox.finalWidth); Assert.AreEqual(0, two.layoutResult.localPosition.x); Assert.AreEqual(100, three.layoutResult.localPosition.x); }
public void MouseEnter_FiresForReEnteringElement() { MockApplication testView = MockApplication.Setup <InputSystemTestThing2>(); testView.Update(); testView.SetViewportRect(new Rect(0, 0, 1000, 1000)); InputSystemTestThing2 root = (InputSystemTestThing2)testView.RootElement; root.ignoreEnter = false; MouseState mouseState = new MouseState(); mouseState.mousePosition = new Vector2(20, 10); testView.InputSystem.SetMouseState(mouseState); testView.Update(); mouseState.mousePosition = new Vector2(240, 10); testView.InputSystem.SetMouseState(mouseState); testView.Update(); mouseState.mousePosition = new Vector2(20, 10); testView.InputSystem.SetMouseState(mouseState); testView.Update(); Assert.AreEqual(new[] { "enter:child0", "enter:root", "enter:child2", "enter:child0" }, root.clickList.ToArray()); }
public void ModifySlot_TypedWithField() { MockApplication app = MockApplication.Setup <TestTemplateStructure_ModifySlot_TypedWithFieldMain>(); TestTemplateStructure_ModifySlot_TypedWithFieldMain root = (TestTemplateStructure_ModifySlot_TypedWithFieldMain)app.RootElement; TestTemplateStructure_ModifySlot_TypedWithFieldInner inner = (TestTemplateStructure_ModifySlot_TypedWithFieldInner)root[0]; TestTemplateStructure_ModifySlot_TypedWithFieldInnerThing c0 = inner[0][0] as TestTemplateStructure_ModifySlot_TypedWithFieldInnerThing; TestTemplateStructure_ModifySlot_TypedWithFieldInnerThing c1 = inner[0][1] as TestTemplateStructure_ModifySlot_TypedWithFieldInnerThing; TestTemplateStructure_ModifySlot_TypedWithFieldInnerThing c2 = inner[0][2] as TestTemplateStructure_ModifySlot_TypedWithFieldInnerThing; inner.value = 10; app.Update(); Assert.AreEqual(c0.typedField, 0 * inner.value); Assert.AreEqual(c1.typedField, 1 * inner.value); Assert.AreEqual(c2.typedField, 2 * inner.value); inner.value = 20; app.Update(); Assert.AreEqual(c0.typedField, 0 * inner.value); Assert.AreEqual(c1.typedField, 1 * inner.value); Assert.AreEqual(c2.typedField, 2 * inner.value); }
public void DragEnter_FiresForReEnteringElement() { MockApplication testView = MockApplication.Setup <DragHandlerTestThing>(); testView.Update(); testView.SetViewportRect(new Rect(0, 0, 1000, 1000)); DragHandlerTestThing root = (DragHandlerTestThing)testView.RootElement; Assert.AreEqual(0, root.dragList.Count); root.ignoreExit = true; testView.InputSystem.MouseDown(new Vector2(10, 10)); testView.Update(); testView.InputSystem.MouseDragMove(new Vector2(30, 30)); testView.Update(); testView.InputSystem.MouseDragMove(new Vector2(130, 30)); testView.Update(); testView.InputSystem.MouseDragMove(new Vector2(30, 30)); testView.Update(); Assert.AreEqual(3, root.dragList.Count); Assert.AreEqual(new[] { "enter:child0", "enter:child1", "enter:child0" }, root.dragList.ToArray()); }
public void MouseHover_DoesNotFireAfterMove() { MockApplication testView = MockApplication.Setup <InputSystemTestThing2>(); testView.Update(); testView.SetViewportRect(new Rect(0, 0, 1000, 1000)); InputSystemTestThing2 root = (InputSystemTestThing2)testView.RootElement; root.ignoreHover = false; testView.InputSystem.SetMousePosition(new Vector2(20, 10)); testView.Update(); Assert.AreEqual(new string[0], root.clickList.ToArray()); testView.InputSystem.SetMousePosition(new Vector2(20, 10)); testView.Update(); Assert.AreEqual(new[] { "hover:child0", "hover:root" }, root.clickList.ToArray()); testView.InputSystem.SetMousePosition(new Vector2(21, 10)); testView.Update(); Assert.AreEqual(new[] { "hover:child0", "hover:root" }, root.clickList.ToArray()); }
public void MouseExit_FireAgainWhenReenteredElement() { MockApplication testView = MockApplication.Setup <InputSystemTestThing2>(); testView.Update(); testView.SetViewportRect(new Rect(0, 0, 1000, 1000)); InputSystemTestThing2 root = (InputSystemTestThing2)testView.RootElement; root.ignoreExit = false; testView.InputSystem.SetMousePosition(new Vector2(20, 10)); testView.Update(); Assert.AreEqual(new string[0], root.clickList.ToArray()); testView.InputSystem.SetMousePosition(new Vector2(120, 10)); testView.Update(); testView.InputSystem.SetMousePosition(new Vector2(20, 10)); testView.Update(); testView.InputSystem.SetMousePosition(new Vector2(120, 10)); testView.Update(); Assert.AreEqual(new[] { "exit:child0", "exit:child0" }, root.clickList.ToArray()); }
public void HandleEnableDisableElementWithContentAncestor() { MockApplication app = MockApplication.Setup <BasicLayoutTest_ContentAncestor>(); BasicLayoutTest_ContentAncestor root = app.RootElement as BasicLayoutTest_ContentAncestor; app.Update(); UIElement toggle = root["disable-me"]; UIElement wrapper = root[0]; Assert.AreEqual(200, root.layoutBox.finalWidth); Assert.AreEqual(200, wrapper.layoutBox.finalWidth); Assert.AreEqual(100, toggle.layoutBox.finalWidth); toggle.SetEnabled(false); app.Update(); Assert.AreEqual(100, root.layoutBox.finalWidth); Assert.AreEqual(100, wrapper.layoutBox.finalWidth); toggle.SetEnabled(true); app.Update(); Assert.AreEqual(200, root.layoutBox.finalWidth); Assert.AreEqual(200, wrapper.layoutBox.finalWidth); Assert.AreEqual(100, toggle.layoutBox.finalWidth); }
public void Align() { MockApplication mockView = MockApplication.Setup <GridLayout_Align>(); GridLayout_Align root = (GridLayout_Align)mockView.RootElement; mockView.Update(); Assert.AreEqual(new Vector2(0, 0), root[0].layoutResult.alignedPosition); Assert.AreEqual(new Vector2(100, 0), root[1].layoutResult.alignedPosition); Assert.AreEqual(new Vector2(200, 0), root[2].layoutResult.alignedPosition); root.style.SetAlignItemsHorizontal(0.5f, StyleState.Normal); root.style.SetAlignItemsVertical(0.5f, StyleState.Normal); mockView.Update(); Assert.AreEqual(new Vector2(25, 25), root[0].layoutResult.alignedPosition); Assert.AreEqual(new Vector2(125, 25), root[1].layoutResult.alignedPosition); Assert.AreEqual(new Vector2(225, 25), root[2].layoutResult.alignedPosition); root.style.SetAlignItemsHorizontal(1f, StyleState.Normal); root.style.SetAlignItemsVertical(1f, StyleState.Normal); mockView.Update(); Assert.AreEqual(new Vector2(50, 50), root[0].layoutResult.alignedPosition); Assert.AreEqual(new Vector2(150, 50), root[1].layoutResult.alignedPosition); Assert.AreEqual(new Vector2(250, 50), root[2].layoutResult.alignedPosition); }
public void DistributeSpaceInTrackWithGap() { MockApplication app = MockApplication.Setup <FlexHorizontalWrap_DistributeSpaceInTrack>(); FlexHorizontalWrap_DistributeSpaceInTrack root = (FlexHorizontalWrap_DistributeSpaceInTrack)app.RootElement; root.style.SetFlexLayoutGapHorizontal(10, StyleState.Normal); root.style.SetFlexLayoutGapVertical(10, StyleState.Normal); root.style.SetDistributeExtraSpaceHorizontal(SpaceDistribution.AfterContent, StyleState.Normal); app.Update(); Assert.AreEqual(new Rect(0, 0, 200, 100), root[0].layoutResult.AllocatedRect); Assert.AreEqual(new Rect(210, 0, 200, 100), root[1].layoutResult.AllocatedRect); Assert.AreEqual(new Rect(0, 110, 390, 100), root[2].layoutResult.AllocatedRect); Assert.AreEqual(new Rect(400, 110, 200, 100), root[3].layoutResult.AllocatedRect); Assert.AreEqual(new Rect(0, 220, 200, 100), root[4].layoutResult.AllocatedRect); root.style.SetDistributeExtraSpaceHorizontal(SpaceDistribution.BeforeContent, StyleState.Normal); app.Update(); Assert.AreEqual(new Rect(190, 0, 200, 100), root[0].layoutResult.AllocatedRect); Assert.AreEqual(new Rect(400, 0, 200, 100), root[1].layoutResult.AllocatedRect); Assert.AreEqual(new Rect(0, 110, 390, 100), root[2].layoutResult.AllocatedRect); Assert.AreEqual(new Rect(400, 110, 200, 100), root[3].layoutResult.AllocatedRect); Assert.AreEqual(new Rect(400, 220, 200, 100), root[4].layoutResult.AllocatedRect); root.style.SetDistributeExtraSpaceHorizontal(SpaceDistribution.BetweenContent, StyleState.Normal); app.Update(); Assert.AreEqual(new Rect(0, 0, 200, 100), root[0].layoutResult.AllocatedRect); Assert.AreEqual(new Rect(400, 0, 200, 100), root[1].layoutResult.AllocatedRect); Assert.AreEqual(new Rect(0, 110, 390, 100), root[2].layoutResult.AllocatedRect); Assert.AreEqual(new Rect(400, 110, 200, 100), root[3].layoutResult.AllocatedRect); Assert.AreEqual(new Rect(200, 220, 200, 100), root[4].layoutResult.AllocatedRect); // gap is not applied when AroundContent distribution is used. root.style.SetDistributeExtraSpaceHorizontal(SpaceDistribution.AroundContent, StyleState.Normal); app.Update(); Assert.AreEqual(new Rect(50, 0, 200, 100), root[0].layoutResult.AllocatedRect); Assert.AreEqual(new Rect(350, 0, 200, 100), root[1].layoutResult.AllocatedRect); Assert.AreEqual(new Rect(0, 110, 400, 100), root[2].layoutResult.AllocatedRect); Assert.AreEqual(new Rect(400, 110, 200, 100), root[3].layoutResult.AllocatedRect); Assert.AreEqual(new Rect(200, 220, 200, 100), root[4].layoutResult.AllocatedRect); root.style.SetDistributeExtraSpaceHorizontal(SpaceDistribution.CenterContent, StyleState.Normal); app.Update(); Assert.AreEqual(new Rect(95, 0, 200, 100), root[0].layoutResult.AllocatedRect); Assert.AreEqual(new Rect(305, 0, 200, 100), root[1].layoutResult.AllocatedRect); Assert.AreEqual(new Rect(0, 110, 390, 100), root[2].layoutResult.AllocatedRect); Assert.AreEqual(new Rect(400, 110, 200, 100), root[3].layoutResult.AllocatedRect); Assert.AreEqual(new Rect(200, 220, 200, 100), root[4].layoutResult.AllocatedRect); }
public void MaxSizeChanges() { MockApplication app = MockApplication.Setup <LayoutSystemTest_MaxSizeChanges>(); LayoutSystemTest_MaxSizeChanges root = (LayoutSystemTest_MaxSizeChanges)app.RootElement; app.Update(); Assert.AreEqual(new Rect(0, 100, 300, 50), root[1].layoutResult.AllocatedRect); root[1].style.SetMaxWidth(150f, StyleState.Normal); app.Update(); Assert.AreEqual(new Rect(0, 100, 150, 50), root[1].layoutResult.AllocatedRect); }
public void HeightSizeConstraintChangesToMinContent() { MockApplication app = MockApplication.Setup <LayoutSystemTest_HeightChangesToMinContent>(); LayoutSystemTest_HeightChangesToMinContent root = (LayoutSystemTest_HeightChangesToMinContent)app.RootElement; app.Update(); Assert.AreEqual(new Rect(0, 100, 400, 300), root[1].layoutResult.AllocatedRect); root[1].style.SetMinHeight(UIMeasurement.Content100, StyleState.Normal); app.Update(); Assert.AreEqual(new Rect(0, 100, 400, 500), root[1].layoutResult.AllocatedRect); }
public void DistributeSpaceBetweenTracks() { MockApplication app = MockApplication.Setup <FlexHorizontalWap_DistributeSpaceBetweenTracks>(); FlexHorizontalWap_DistributeSpaceBetweenTracks root = (FlexHorizontalWap_DistributeSpaceBetweenTracks)app.RootElement; root.style.SetDistributeExtraSpaceVertical(SpaceDistribution.AfterContent, StyleState.Normal); app.Update(); Assert.AreEqual(new Rect(0, 0, 200, 100), root[0].layoutResult.AllocatedRect); Assert.AreEqual(new Rect(200, 0, 200, 100), root[1].layoutResult.AllocatedRect); Assert.AreEqual(new Rect(0, 100, 400, 100), root[2].layoutResult.AllocatedRect); Assert.AreEqual(new Rect(400, 100, 200, 100), root[3].layoutResult.AllocatedRect); Assert.AreEqual(new Rect(0, 200, 200, 100), root[4].layoutResult.AllocatedRect); root.style.SetDistributeExtraSpaceVertical(SpaceDistribution.BeforeContent, StyleState.Normal); app.Update(); Assert.AreEqual(new Rect(0, 300, 200, 100), root[0].layoutResult.AllocatedRect); Assert.AreEqual(new Rect(200, 300, 200, 100), root[1].layoutResult.AllocatedRect); Assert.AreEqual(new Rect(0, 400, 400, 100), root[2].layoutResult.AllocatedRect); Assert.AreEqual(new Rect(400, 400, 200, 100), root[3].layoutResult.AllocatedRect); Assert.AreEqual(new Rect(0, 500, 200, 100), root[4].layoutResult.AllocatedRect); root.style.SetDistributeExtraSpaceVertical(SpaceDistribution.BetweenContent, StyleState.Normal); app.Update(); Assert.AreEqual(new Rect(0, 0, 200, 100), root[0].layoutResult.AllocatedRect); Assert.AreEqual(new Rect(200, 0, 200, 100), root[1].layoutResult.AllocatedRect); Assert.AreEqual(new Rect(0, 250, 400, 100), root[2].layoutResult.AllocatedRect); Assert.AreEqual(new Rect(400, 250, 200, 100), root[3].layoutResult.AllocatedRect); Assert.AreEqual(new Rect(0, 500, 200, 100), root[4].layoutResult.AllocatedRect); root.style.SetDistributeExtraSpaceVertical(SpaceDistribution.AroundContent, StyleState.Normal); app.Update(); Assert.AreEqual(new Rect(0, 50, 200, 100), root[0].layoutResult.AllocatedRect); Assert.AreEqual(new Rect(200, 50, 200, 100), root[1].layoutResult.AllocatedRect); Assert.AreEqual(new Rect(0, 250, 400, 100), root[2].layoutResult.AllocatedRect); Assert.AreEqual(new Rect(400, 250, 200, 100), root[3].layoutResult.AllocatedRect); Assert.AreEqual(new Rect(0, 450, 200, 100), root[4].layoutResult.AllocatedRect); root.style.SetDistributeExtraSpaceVertical(SpaceDistribution.CenterContent, StyleState.Normal); app.Update(); Assert.AreEqual(new Rect(0, 150, 200, 100), root[0].layoutResult.AllocatedRect); Assert.AreEqual(new Rect(200, 150, 200, 100), root[1].layoutResult.AllocatedRect); Assert.AreEqual(new Rect(0, 250, 400, 100), root[2].layoutResult.AllocatedRect); Assert.AreEqual(new Rect(400, 250, 200, 100), root[3].layoutResult.AllocatedRect); Assert.AreEqual(new Rect(0, 350, 200, 100), root[4].layoutResult.AllocatedRect); }
public void WidthSizeConstraintChangesToContent() { MockApplication app = MockApplication.Setup <LayoutSystemTest_WidthChangesToContent>(); LayoutSystemTest_WidthChangesToContent root = (LayoutSystemTest_WidthChangesToContent)app.RootElement; app.Update(); Assert.AreEqual(new Rect(0, 100, 400, 50), root[1].layoutResult.AllocatedRect); root[1].style.SetMaxWidth(UIMeasurement.Content100, StyleState.Normal); app.Update(); Assert.AreEqual(new Rect(0, 100, 300, 50), root[1].layoutResult.AllocatedRect); root[1][0].style.SetPreferredWidth(150f, StyleState.Normal); app.Update(); Assert.AreEqual(new Rect(0, 100, 150, 50), root[1].layoutResult.AllocatedRect); }
public void MouseMove_FiresAndPropagates() { MockApplication testView = MockApplication.Setup <InputSystemTestThing2>(); testView.Update(); testView.SetViewportRect(new Rect(0, 0, 1000, 1000)); InputSystemTestThing2 root = (InputSystemTestThing2)testView.RootElement; root.ignoreMove = false; testView.InputSystem.SetMousePosition(new Vector2(20, 10)); testView.Update(); Assert.AreEqual(new[] { "move:child0", "move:root" }, root.clickList.ToArray()); }
public void ChildEnabled() { MockApplication app = MockApplication.Setup <LayoutSystemTest_ChildEnabled>(); app.Update(); LayoutSystemTest_ChildEnabled root = (LayoutSystemTest_ChildEnabled)app.RootElement; Assert.IsFalse(root[1][0].isEnabled); Assert.AreEqual(new Rect(0, 100, 200, 50), root[1].layoutResult.AllocatedRect); root[1][0].SetEnabled(true); Assert.IsTrue(root[1][0].isEnabled); app.Update(); Assert.IsTrue(root[1][0].isEnabled); Assert.AreEqual(new Rect(0, 100, 300, 100), root[1].layoutResult.AllocatedRect); }
public void TestDefaultPathElementWithExplicitPath() { MockApplication app = MockApplication.Setup <DefaultPathElementWithExplicitPath>(); app.Update(); Assert.IsInstanceOf <DefaultPathElementWithExplicitPath>(app.RootElement); }
public void ContentSized() { MockApplication app = MockApplication.Setup <LayoutSystemTest_Content>(); LayoutSystemTest_Content root = (LayoutSystemTest_Content)app.RootElement; app.Update(); Assert.AreEqual(new Rect(0, 100, 300, 50), root[1].layoutResult.AllocatedRect); }
public void ApplyHeadingStyles() { MockApplication app = MockApplication.Setup <HeadingStyleElement>(); HeadingStyleElement root = (HeadingStyleElement)app.RootElement; app.Update(); Assert.AreEqual(new UIFixedLength(100), root.FindById("myHeading").style.TextFontSize); }
public void MouseUp_FiresAndPropagates() { MockApplication testView = MockApplication.Setup <InputSystemTestThing2>(); testView.Update(); testView.SetViewportRect(new Rect(0, 0, 1000, 1000)); InputSystemTestThing2 root = (InputSystemTestThing2)testView.RootElement; MouseState mouseState = new MouseState(); mouseState.leftMouseButtonState.isUpThisFrame = true; mouseState.mousePosition = new Vector2(220, 10); testView.InputSystem.SetMouseState(mouseState); testView.Update(); Assert.AreEqual(new[] { "up:child2", "up:root" }, root.clickList.ToArray()); }
public void ApplyDynamicStyleBinding() { MockApplication app = MockApplication.Setup <StyleSetTestThing>(); StyleSetTestThing root = (StyleSetTestThing)app.RootElement; app.Update(); Assert.AreEqual(100, root.FindById("dynamic").style.MarginTop.value); }
public void MouseDown_WithPropagation() { MockApplication application = MockApplication.Setup <InputSystemTestThing>(); application.Update(); application.SetViewportRect(new Rect(0, 0, 1000, 1000)); InputSystemTestThing root = (InputSystemTestThing)application.RootElement; application.Update(); application.InputSystem.MouseDown(new Vector2(20, 10)); application.Update(); Assert.AreEqual(0, root.clickedChildIndex); Assert.IsTrue(root.wasMouseDown); application.InputSystem.ClearClickState(); application.Update(); application.InputSystem.MouseDown(new Vector2(120, 10)); application.Update(); Assert.AreEqual(1, root.clickedChildIndex); application.InputSystem.ClearClickState(); application.Update(); application.InputSystem.MouseDown(new Vector2(220, 10)); application.Update(); Assert.AreEqual(2, root.clickedChildIndex); }
public void GapContentSize() { MockApplication app = MockApplication.Setup <FlexHorizontal_GapContentSize>(); FlexHorizontal_GapContentSize root = (FlexHorizontal_GapContentSize)app.RootElement; app.Update(); Assert.AreEqual(new Rect(0, 0, 320, 100), root.layoutResult.AllocatedRect); }
public void DragCreate_FromChildTemplate_LambdaArg() { MockApplication testView = MockApplication.Setup <DragTestThing_CreateLambdaArg>(); testView.Update(); testView.SetViewportRect(new Rect(0, 0, 1000, 1000)); testView.InputSystem.MouseDown(new Vector2(20, 20)); testView.Update(); Assert.IsNull(testView.InputSystem.CurrentDragEvent); testView.InputSystem.MouseDragMove(new Vector2(25, 20)); testView.Update(); Assert.IsInstanceOf <TestDragEvent>(testView.InputSystem.CurrentDragEvent); Assert.AreEqual("child3", As <TestDragEvent>(testView.InputSystem.CurrentDragEvent).sourceName); }
public void NoWrapWithGap() { MockApplication app = MockApplication.Setup <FlexHorizontalWrap_NoWrapWithGap>(); FlexHorizontalWrap_NoWrapWithGap root = (FlexHorizontalWrap_NoWrapWithGap)app.RootElement; app.Update(); Assert.AreEqual(new Rect(0, 0, 100, 100), root[0].layoutResult.AllocatedRect); }
public void ParseDynamicElement() { MockApplication app = MockApplication.Setup <XMLTemplateParsing_UseDynamicElement>(); XMLTemplateParsing_UseDynamicElement e = (XMLTemplateParsing_UseDynamicElement)app.RootElement; app.Update(); Assert.AreEqual("Hello Matt!", GetText(e[0][0])); }
public void OverrideSlotContent() { MockApplication app = MockApplication.Setup <TestTemplateStructure_UseDefaultSlotContent_OuterOverride>(); TestTemplateStructure_UseDefaultSlotContent_OuterOverride root = (TestTemplateStructure_UseDefaultSlotContent_OuterOverride)app.RootElement; app.Update(); Assert.AreEqual("from override slot", GetText(root[0][0][0])); }
public void ResolveMaxContentTrackSize_WithColGap() { MockApplication mockView = MockApplication.Setup <GridLayout_ResolveMaxContentTrackSize>(); GridLayout_ResolveMaxContentTrackSize root = (GridLayout_ResolveMaxContentTrackSize)mockView.RootElement; root.style.SetGridLayoutColGap(10, StyleState.Normal); mockView.Update(); Assert.AreEqual(320, root.layoutResult.actualSize.width); }
public void UseDefaultChildren() { MockApplication app = MockApplication.Setup <UseDefaultChildrenOuter>(); UseDefaultChildrenOuter root = (UseDefaultChildrenOuter)app.RootElement; app.Update(); Assert.AreEqual("default children", GetText(root[0][0][0])); }