public void ScrollContentPresenterContentScrollTest() { ScrollContentPresenterTestElement content = new ScrollContentPresenterTestElement { MeasureSize = new Size(100, 50), ExtentSize = new Size(400, 200) }; ScrollContentPresenter scrollContentPresenter = new ScrollContentPresenter { Width = 200, Height = 100, IsRootElement = true }; content.ViewportSize = scrollContentPresenter.RenderSize; scrollContentPresenter.Measure(Size.Infinity); scrollContentPresenter.Arrange(new Rect(scrollContentPresenter.DesiredSize)); scrollContentPresenter.Content = content; Assert.AreEqual(new Size(100, 50), scrollContentPresenter.ExtentSize); scrollContentPresenter.CanContentScroll = true; Assert.AreEqual(new Size(400, 200), scrollContentPresenter.ExtentSize); Assert.AreEqual(new Size(200, 100), content.PreviousAvailableSize); Assert.IsFalse(content.CanHorizontallyScroll); Assert.IsFalse(content.CanVerticallyScroll); scrollContentPresenter.CanHorizontallyScroll = true; Assert.AreEqual(new Size(Double.PositiveInfinity, 100), content.PreviousAvailableSize); Assert.IsTrue(content.CanHorizontallyScroll); Assert.IsFalse(content.CanVerticallyScroll); scrollContentPresenter.CanVerticallyScroll = true; Assert.AreEqual(new Size(Double.PositiveInfinity, Double.PositiveInfinity), content.PreviousAvailableSize); Assert.IsTrue(content.CanHorizontallyScroll); Assert.IsTrue(content.CanVerticallyScroll); }
public void ScrollContentPresenterContentScrollTest() { ScrollContentPresenterTestElement content = new ScrollContentPresenterTestElement { MeasureSize = new Size(100, 50), ExtentSize = new Size(400, 200) }; ScrollContentPresenter scrollContentPresenter = new ScrollContentPresenter { Width = 200, Height = 100, IsRootElement = true }; content.ViewportSize = scrollContentPresenter.RenderSize; scrollContentPresenter.Content = content; Assert.AreEqual(new Size(100, 50), scrollContentPresenter.ExtentSize); scrollContentPresenter.CanContentScroll = true; Assert.AreEqual(new Size(400, 200), scrollContentPresenter.ExtentSize); Assert.AreEqual(new Size(200, 100), content.LastAvailableSize1); Assert.IsFalse(content.CanHorizontallyScroll); Assert.IsFalse(content.CanVerticallyScroll); scrollContentPresenter.CanHorizontallyScroll = true; Assert.AreEqual(new Size(Double.PositiveInfinity, 100), content.LastAvailableSize2); Assert.IsTrue(content.CanHorizontallyScroll); Assert.IsFalse(content.CanVerticallyScroll); scrollContentPresenter.CanVerticallyScroll = true; Assert.AreEqual(new Size(Double.PositiveInfinity, Double.PositiveInfinity), content.LastAvailableSize2); Assert.IsTrue(content.CanHorizontallyScroll); Assert.IsTrue(content.CanVerticallyScroll); }