Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A test that checks whether the elements stay within the window's dimensions after resizing. #1688

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions src/Spec2-Tests/SpHorizontalBoxLayoutTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,59 @@ SpHorizontalBoxLayoutTest >> testReplaceWithFixedWidthComposed [

self assert: layout children second children first equals: replacement
]

{ #category : 'tests' }
SpHorizontalBoxLayoutTest >> testSpSearchInputFieldPresenterResizeCorrectlyWhenWindowHeightDecrease [

| searchPresenter buttonPresenter windowWidget buttonWidget searchWidget |
searchPresenter := SpSearchInputFieldPresenter new.
buttonPresenter := SpButtonPresenter new label: 'click me'.
presenter := SpPresenter new
layout: (SpBoxLayout newLeftToRight
add: searchPresenter;
add: buttonPresenter;
yourself);
yourself.
window := presenter open.

windowWidget := window adapter widget.
buttonWidget := buttonPresenter adapter widget.
searchWidget := searchPresenter adapter widget.

self assert: (windowWidget bounds containsRect: buttonWidget bounds).
self assert: (windowWidget bounds containsRect: searchWidget bounds).

windowWidget extent: windowWidget extent - (0 @ 100).
self currentWorld doOneCycle.

self assert: (windowWidget bounds containsRect: buttonWidget bounds).
self assert: (windowWidget bounds containsRect: searchWidget bounds)
]

{ #category : 'tests' }
SpHorizontalBoxLayoutTest >> testSpSearchInputFieldPresenterResizeCorrectlyWhenWindowWidthDecrease [

| searchPresenter buttonPresenter windowWidget buttonWidget searchWidget |
searchPresenter := SpSearchInputFieldPresenter new.
buttonPresenter := SpButtonPresenter new label: 'click me'.
presenter := SpPresenter new
layout: (SpBoxLayout newLeftToRight
add: searchPresenter;
add: buttonPresenter;
yourself);
yourself.
window := presenter open.

windowWidget := window adapter widget.
buttonWidget := buttonPresenter adapter widget.
searchWidget := searchPresenter adapter widget.

self assert: (windowWidget bounds containsRect: buttonWidget bounds).
self assert: (windowWidget bounds containsRect: searchWidget bounds).

windowWidget extent: windowWidget extent - (100 @ 0).
self currentWorld doOneCycle.

self assert: (windowWidget bounds containsRect: buttonWidget bounds).
self assert: (windowWidget bounds containsRect: searchWidget bounds)
]
Loading