diff --git a/src/Spec2-Backend-Tests/SpAbstractBackendForTest.class.st b/src/Spec2-Backend-Tests/SpAbstractBackendForTest.class.st index 48e134c7..a8ec6d7e 100644 --- a/src/Spec2-Backend-Tests/SpAbstractBackendForTest.class.st +++ b/src/Spec2-Backend-Tests/SpAbstractBackendForTest.class.st @@ -20,6 +20,13 @@ SpAbstractBackendForTest >> emulateClick: mouseButtonCode onTest: anAdapterTest self waitUntilUIRedrawed ] +{ #category : 'testing' } +SpAbstractBackendForTest >> layOutWindowOf: aTest [ + "Hook. I lay out the window of aTest, as the UI would, so that its widgets have their final bounds." + + self waitUntilUIRedrawed +] + { #category : 'testing' } SpAbstractBackendForTest >> waitUntilUIRedrawed [ "Hook. I wait until the UI has been redrawn and events have been handled." diff --git a/src/Spec2-Backend-Tests/SpMorphicBackendForTest.class.st b/src/Spec2-Backend-Tests/SpMorphicBackendForTest.class.st index 8fd23d57..439f8803 100644 --- a/src/Spec2-Backend-Tests/SpMorphicBackendForTest.class.st +++ b/src/Spec2-Backend-Tests/SpMorphicBackendForTest.class.st @@ -121,6 +121,15 @@ SpMorphicBackendForTest >> initialize [ self initializeSemaphore ] +{ #category : 'testing' } +SpMorphicBackendForTest >> layOutWindowOf: aTest [ + "Twice: when the width of a wrapping label changes, its height may change too, and it asks its owner to lay out again in the next UI cycle." + + aTest window adapter widget fullBounds. + self waitUntilUIRedrawed. + aTest window adapter widget fullBounds +] + { #category : 'opening' } SpMorphicBackendForTest >> openInstanceOf: aTest [ diff --git a/src/Spec2-Backend-Tests/SpVerticalBoxLayoutAdapterTest.class.st b/src/Spec2-Backend-Tests/SpVerticalBoxLayoutAdapterTest.class.st index 1fc8c3c7..0261c055 100644 --- a/src/Spec2-Backend-Tests/SpVerticalBoxLayoutAdapterTest.class.st +++ b/src/Spec2-Backend-Tests/SpVerticalBoxLayoutAdapterTest.class.st @@ -8,12 +8,8 @@ Class { { #category : 'helpers' } SpVerticalBoxLayoutAdapterTest >> layOutWindow [ - "We need to lay out twice. As this is a wrapping morph, when the width changes, the height may change too (because of the wrapping, narrowing it can make it larger). We need to lay out twice to apply the changes to the height, too." - self window adapter widget fullBounds. - "a wrapping label whose height changed asks its owner to lay out again, in the next UI cycle" - self adapter. - self window adapter widget fullBounds + backendForTest layOutWindowOf: self ] { #category : 'accessing' }