public void Arrange_Should_Offset_ILogicalScrollable_Bounds_When_Logical_Scroll_Disabled() { var scrollable = new TestScrollable { IsLogicalScrollEnabled = false, }; var target = new ScrollContentPresenter { CanHorizontallyScroll = true, CanVerticallyScroll = true, Content = scrollable, }; target.UpdateChild(); target.Measure(new Size(100, 100)); target.Arrange(new Rect(0, 0, 100, 100)); target.Offset = new Vector(25, 25); target.Measure(new Size(100, 100)); target.Arrange(new Rect(0, 0, 100, 100)); Assert.Equal(new Rect(-25, -25, 150, 150), scrollable.Bounds); }
public void Extent_Offset_And_Viewport_Should_Be_Read_From_ILogicalScrollable() { var scrollable = new TestScrollable { Extent = new Size(100, 100), Offset = new Vector(50, 50), Viewport = new Size(25, 25), }; var target = new ScrollContentPresenter { Content = scrollable }; target.UpdateChild(); Assert.Equal(scrollable.Extent, target.Extent); Assert.Equal(scrollable.Offset, target.Offset); Assert.Equal(scrollable.Viewport, target.Viewport); scrollable.Extent = new Size(200, 200); scrollable.Offset = new Vector(100, 100); scrollable.Viewport = new Size(50, 50); Assert.Equal(scrollable.Extent, target.Extent); Assert.Equal(scrollable.Offset, target.Offset); Assert.Equal(scrollable.Viewport, target.Viewport); }
public void Extent_Offset_And_Viewport_Should_Be_Read_From_IScrollable() { var scrollable = new TestScrollable { Extent = new Size(100, 100), Offset = new Vector(50, 50), Viewport = new Size(25, 25), }; var target = new ScrollContentPresenter { Content = scrollable }; target.UpdateChild(); Assert.Equal(scrollable.Extent, target.Extent); Assert.Equal(scrollable.Offset, target.Offset); Assert.Equal(scrollable.Viewport, target.Viewport); scrollable.Extent = new Size(200, 200); scrollable.Offset = new Vector(100, 100); scrollable.Viewport = new Size(50, 50); Assert.Equal(scrollable.Extent, target.Extent); Assert.Equal(scrollable.Offset, target.Offset); Assert.Equal(scrollable.Viewport, target.Viewport); }
public void InvalidateScroll_Should_Be_Set_When_Set_As_Content() { var scrollable = new TestScrollable(); var target = new ScrollContentPresenter { Content = scrollable }; target.UpdateChild(); Assert.True(scrollable.HasScrollInvalidatedSubscriber); }
public void Measure_Should_Pass_Unchanged_Bounds_To_IScrollable() { var scrollable = new TestScrollable(); var target = new ScrollContentPresenter { Content = scrollable, }; target.Measure(new Size(100, 100)); Assert.Equal(new Size(100, 100), scrollable.AvailableSize); }
public void InvalidateScroll_Should_Be_Set_When_Set_As_Content() { var scrollable = new TestScrollable(); var target = new ScrollContentPresenter { Content = scrollable }; target.UpdateChild(); Assert.NotNull(scrollable.InvalidateScroll); }
public void Should_Set_ILogicalScrolable_CanVerticallyScroll() { var logicalScrollable = new TestScrollable(); var target = new ScrollContentPresenter { Content = logicalScrollable }; target.UpdateChild(); Assert.False(logicalScrollable.CanVerticallyScroll); target.CanVerticallyScroll = true; Assert.True(logicalScrollable.CanVerticallyScroll); }
public void InvalidateScroll_Should_Be_Set_When_Set_As_Content() { var scrollable = new TestScrollable(); var target = new ScrollContentPresenter { Content = scrollable }; target.ApplyTemplate(); Assert.NotNull(scrollable.InvalidateScroll); }
public void InvalidateScroll_Should_Be_Cleared_When_Removed_From_Content() { var scrollable = new TestScrollable(); var target = new ScrollContentPresenter { Content = scrollable }; target.ApplyTemplate(); target.Content = null; target.ApplyTemplate(); Assert.Null(scrollable.InvalidateScroll); }
public void InvalidateScroll_Should_Be_Cleared_When_Removed_From_Content() { var scrollable = new TestScrollable(); var target = new ScrollContentPresenter { Content = scrollable }; target.UpdateChild(); target.Content = null; target.UpdateChild(); Assert.False(scrollable.HasScrollInvalidatedSubscriber); }
public void Changing_Content_Should_Update_State() { var logicalScrollable = new TestScrollable { Extent = new Size(100, 100), Offset = new Vector(50, 50), Viewport = new Size(25, 25), }; var nonLogicalScrollable = new TestScrollable { IsLogicalScrollEnabled = false, }; var target = new ScrollContentPresenter { CanHorizontallyScroll = true, CanVerticallyScroll = true, Content = logicalScrollable, }; target.UpdateChild(); target.Measure(new Size(100, 100)); target.Arrange(new Rect(0, 0, 100, 100)); Assert.Equal(logicalScrollable.Extent, target.Extent); Assert.Equal(logicalScrollable.Offset, target.Offset); Assert.Equal(logicalScrollable.Viewport, target.Viewport); Assert.Equal(new Rect(0, 0, 100, 100), logicalScrollable.Bounds); target.Content = nonLogicalScrollable; target.UpdateChild(); target.Measure(new Size(100, 100)); target.Arrange(new Rect(0, 0, 100, 100)); Assert.Equal(new Size(150, 150), target.Extent); Assert.Equal(new Vector(0, 0), target.Offset); Assert.Equal(new Size(100, 100), target.Viewport); Assert.Equal(new Rect(0, 0, 150, 150), nonLogicalScrollable.Bounds); target.Content = logicalScrollable; target.UpdateChild(); target.Measure(new Size(100, 100)); target.Arrange(new Rect(0, 0, 100, 100)); Assert.Equal(logicalScrollable.Extent, target.Extent); Assert.Equal(logicalScrollable.Offset, target.Offset); Assert.Equal(logicalScrollable.Viewport, target.Viewport); Assert.Equal(new Rect(0, 0, 100, 100), logicalScrollable.Bounds); }
public void Toggling_IsLogicalScrollEnabled_Should_Update_State() { var scrollable = new TestScrollable { Extent = new Size(100, 100), Offset = new Vector(50, 50), Viewport = new Size(25, 25), }; var target = new ScrollContentPresenter { CanHorizontallyScroll = true, CanVerticallyScroll = true, Content = scrollable, }; target.UpdateChild(); target.Measure(new Size(100, 100)); target.Arrange(new Rect(0, 0, 100, 100)); Assert.Equal(scrollable.Extent, target.Extent); Assert.Equal(scrollable.Offset, target.Offset); Assert.Equal(scrollable.Viewport, target.Viewport); Assert.Equal(new Rect(0, 0, 100, 100), scrollable.Bounds); scrollable.IsLogicalScrollEnabled = false; scrollable.RaiseScrollInvalidated(EventArgs.Empty); target.Measure(new Size(100, 100)); target.Arrange(new Rect(0, 0, 100, 100)); Assert.Equal(new Size(150, 150), target.Extent); Assert.Equal(new Vector(0, 0), target.Offset); Assert.Equal(new Size(100, 100), target.Viewport); Assert.Equal(new Rect(0, 0, 150, 150), scrollable.Bounds); scrollable.IsLogicalScrollEnabled = true; scrollable.RaiseScrollInvalidated(EventArgs.Empty); target.Measure(new Size(100, 100)); target.Arrange(new Rect(0, 0, 100, 100)); Assert.Equal(scrollable.Extent, target.Extent); Assert.Equal(scrollable.Offset, target.Offset); Assert.Equal(scrollable.Viewport, target.Viewport); Assert.Equal(new Rect(0, 0, 100, 100), scrollable.Bounds); }
public void Offset_Should_Not_Be_Written_To_ILogicalScrollable_After_Removal() { var scrollable = new TestScrollable { Extent = new Size(100, 100), Offset = new Vector(50, 50), }; var target = new ScrollContentPresenter { Content = scrollable }; target.Content = null; target.Offset = new Vector(25, 25); Assert.Equal(new Vector(50, 50), scrollable.Offset); }
public void Offset_Should_Be_Written_To_ILogicalScrollable() { var scrollable = new TestScrollable { Extent = new Size(100, 100), Offset = new Vector(50, 50), }; var target = new ScrollContentPresenter { Content = scrollable }; target.UpdateChild(); target.Offset = new Vector(25, 25); Assert.Equal(target.Offset, scrollable.Offset); }
public void Arrange_Should_Offset_IScrollable_Bounds_When_Logical_Scroll_Disabled() { var scrollable = new TestScrollable { IsLogicalScrollEnabled = false, }; var target = new ScrollContentPresenter { Content = scrollable, Offset = new Vector(25, 25), }; target.UpdateChild(); target.Measure(new Size(100, 100)); target.Arrange(new Rect(0, 0, 100, 100)); Assert.Equal(new Rect(-25, -25, 150, 150), scrollable.Bounds); }
public void Arrange_Should_Not_Offset_IScrollable_Bounds() { var scrollable = new TestScrollable { Extent = new Size(100, 100), Offset = new Vector(50, 50), Viewport = new Size(25, 25), }; var target = new ScrollContentPresenter { Content = scrollable, }; target.Measure(new Size(100, 100)); target.Arrange(new Rect(0, 0, 100, 100)); Assert.Equal(new Rect(0, 0, 100, 100), scrollable.Bounds); }
public void Toggling_IsLogicalScrollEnabled_Should_Update_State() { var scrollable = new TestScrollable { Extent = new Size(100, 100), Offset = new Vector(50, 50), Viewport = new Size(25, 25), }; var target = new ScrollContentPresenter { Content = scrollable, }; target.UpdateChild(); target.Measure(new Size(100, 100)); target.Arrange(new Rect(0, 0, 100, 100)); Assert.Equal(scrollable.Extent, target.Extent); Assert.Equal(scrollable.Offset, target.Offset); Assert.Equal(scrollable.Viewport, target.Viewport); Assert.Equal(new Rect(0, 0, 100, 100), scrollable.Bounds); scrollable.IsLogicalScrollEnabled = false; scrollable.InvalidateScroll(); target.Measure(new Size(100, 100)); target.Arrange(new Rect(0, 0, 100, 100)); Assert.Equal(new Size(150, 150), target.Extent); Assert.Equal(new Vector(0, 0), target.Offset); Assert.Equal(new Size(100, 100), target.Viewport); Assert.Equal(new Rect(0, 0, 150, 150), scrollable.Bounds); scrollable.IsLogicalScrollEnabled = true; scrollable.InvalidateScroll(); target.Measure(new Size(100, 100)); target.Arrange(new Rect(0, 0, 100, 100)); Assert.Equal(scrollable.Extent, target.Extent); Assert.Equal(scrollable.Offset, target.Offset); Assert.Equal(scrollable.Viewport, target.Viewport); Assert.Equal(new Rect(0, 0, 100, 100), scrollable.Bounds); }
public void Offset_Should_Be_Written_To_IScrollable() { var scrollable = new TestScrollable { Extent = new Size(100, 100), Offset = new Vector(50, 50), }; var target = new ScrollContentPresenter { Content = scrollable }; target.ApplyTemplate(); target.Offset = new Vector(25, 25); Assert.Equal(target.Offset, scrollable.Offset); }
public void Changing_Content_Should_Update_State() { var logicalScrollable = new TestScrollable { Extent = new Size(100, 100), Offset = new Vector(50, 50), Viewport = new Size(25, 25), }; var nonLogicalScrollable = new TestScrollable { IsLogicalScrollEnabled = false, }; var target = new ScrollContentPresenter { Content = logicalScrollable, }; target.UpdateChild(); target.Measure(new Size(100, 100)); target.Arrange(new Rect(0, 0, 100, 100)); Assert.Equal(logicalScrollable.Extent, target.Extent); Assert.Equal(logicalScrollable.Offset, target.Offset); Assert.Equal(logicalScrollable.Viewport, target.Viewport); Assert.Equal(new Rect(0, 0, 100, 100), logicalScrollable.Bounds); target.Content = nonLogicalScrollable; target.UpdateChild(); target.Measure(new Size(100, 100)); target.Arrange(new Rect(0, 0, 100, 100)); Assert.Equal(new Size(150, 150), target.Extent); Assert.Equal(new Vector(0, 0), target.Offset); Assert.Equal(new Size(100, 100), target.Viewport); Assert.Equal(new Rect(0, 0, 150, 150), nonLogicalScrollable.Bounds); target.Content = logicalScrollable; target.UpdateChild(); target.Measure(new Size(100, 100)); target.Arrange(new Rect(0, 0, 100, 100)); Assert.Equal(logicalScrollable.Extent, target.Extent); Assert.Equal(logicalScrollable.Offset, target.Offset); Assert.Equal(logicalScrollable.Viewport, target.Viewport); Assert.Equal(new Rect(0, 0, 100, 100), logicalScrollable.Bounds); }
public void Offset_Should_Not_Be_Written_To_IScrollable_After_Removal() { var scrollable = new TestScrollable { Extent = new Size(100, 100), Offset = new Vector(50, 50), }; var target = new ScrollContentPresenter { Content = scrollable }; target.Content = null; target.Offset = new Vector(25, 25); Assert.Equal(new Vector(50, 50), scrollable.Offset); }