Skip to content

Commit cbe149e

Browse files
committed
Tests: tests for scroller view port mask position
1 parent f189cfb commit cbe149e

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

test/source/feathers/tests/ScrollerTests.as

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,32 @@ package feathers.tests
310310
}, 25);
311311
}
312312

313+
[Test]
314+
public function testNewMaskXPositionOnHorizontalScroll():void
315+
{
316+
this._scroller.width = BACKGROUND_WIDTH;
317+
this._scroller.height = BACKGROUND_HEIGHT;
318+
this._viewPort.width = LARGE_VIEW_PORT_WIDTH;
319+
this._scroller.validate();
320+
this._scroller.horizontalScrollPosition = this._scroller.maxHorizontalScrollPosition / 2;
321+
this._scroller.validate();
322+
Assert.assertStrictlyEquals("The mask x position of the scroller's view port was not calculated correctly with horizontalScrollPosition > 0.",
323+
this._scroller.maxHorizontalScrollPosition / 2, this._viewPort.mask.x);
324+
}
325+
326+
[Test]
327+
public function testNewMaskYPositionOnVerticalScroll():void
328+
{
329+
this._scroller.width = BACKGROUND_WIDTH;
330+
this._scroller.height = BACKGROUND_HEIGHT;
331+
this._viewPort.height = LARGE_VIEW_PORT_HEIGHT;
332+
this._scroller.validate();
333+
this._scroller.verticalScrollPosition = this._scroller.maxVerticalScrollPosition / 2;
334+
this._scroller.validate();
335+
Assert.assertStrictlyEquals("The mask y position of the scroller's view port was not calculated correctly with verticalScrollPosition > 0.",
336+
this._scroller.maxVerticalScrollPosition / 2, this._viewPort.mask.y);
337+
}
338+
313339
[Test]
314340
public function testAutoHideBackgroundWithoutScrolling():void
315341
{

0 commit comments

Comments
 (0)