Пример #1
0
        public void NotifyVisualChangedDoesNotTriggerVisualPropertyChangedUnnecessarily()
        {
            var layout             = ExplicitMaterialLayout();
            var layout2            = ImplicitDefaultLayout();
            IVisualController view = new PropertyWatchingView();

            AddImplicitToMaterial(layout, layout2);

            AddImplicitToMaterial(layout2, (View)view);

            layout2.Visual = Maui.Controls.VisualMarker.Material;
            Assume.That(view.EffectiveVisual.IsMaterial(), "Implicit Visual not set on view");

            layout.Visual = Maui.Controls.VisualMarker.Default;
            Assume.That(layout2.Visual == Maui.Controls.VisualMarker.Material, "Explicit Visual not respected on inner layout");
            Assume.That(view.EffectiveVisual.IsMaterial(), "Implicit Visual not set on view");

            var target = ((PropertyWatchingView)view).VisualPropertyChangedCount;

            Assert.AreEqual(1, target);
        }
Пример #2
0
        public void NotifyFlowDirectionChangedDoesNotTriggerFlowDirectionPropertyChangedUnnecessarily()
        {
            var             layout  = ExplicitRightToLeftLayout();
            var             layout2 = ImplicitLeftToRightLayout();
            IViewController view    = new PropertyWatchingView();

            AddImplicitToRTL(layout, layout2);

            AddImplicitToRTL(layout2, (View)view);

            layout2.FlowDirection = FlowDirection.RightToLeft;
            Assume.That(((IViewController)layout2).EffectiveFlowDirection.IsExplicit(), "Explicit EffectiveFlowDirection not set on inner layout");
            Assume.That(view.EffectiveFlowDirection.IsRightToLeft(), "Implicit FlowDirection not set on view");

            layout.FlowDirection = FlowDirection.LeftToRight;
            Assume.That(layout2.FlowDirection == FlowDirection.RightToLeft, "Explicit FlowDirection not respected on inner layout");
            Assume.That(view.EffectiveFlowDirection.IsRightToLeft(), "Implicit FlowDirection not set on view");

            var target = ((PropertyWatchingView)view).FlowDirectionPropertyChangedCount;

            Assert.AreEqual(1, target);
        }