Dear List,
I am extending the current set of Mondrian tests. I would like to force some system window to appear on the screen in order to properly test the size of its composing morphs. However, I do not know how to effectively make the morph show up on the screen in a test. For example, consider the following test with a contrived situation: testDummy | morph c | morph := Morph new openInWorld. c := Display colorAt: 0@0. morph delete. self assert: c = morph color. If I run the test from a test runner, it will fail. However, if I open a debugger and do a step by step, c = morph color is true. I guess the problem is that the morph is not actually displayed, since the UI thread does not have the hand. Any idea how to force this? Cheers, Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
Den 25.02.2010 15:05, skrev Alexandre Bergel: > Dear List, > > I am extending the current set of Mondrian tests. I would like to > force some system window to appear on the screen in order to properly > test the size of its composing morphs. However, I do not know how to > effectively make the morph show up on the screen in a test. > > For example, consider the following test with a contrived situation: > > testDummy > | morph c | > morph := Morph new openInWorld. > c := Display colorAt: 0@0. > morph delete. > self assert: c = morph color. > > If I run the test from a test runner, it will fail. However, if I open > a debugger and do a step by step, c = morph color is true. > > I guess the problem is that the morph is not actually displayed, since > the UI thread does not have the hand. Any idea how to force this? > > Cheers, > Alexandre > > between the lines morph := and c := From a test-clarity (and robustness) POV though, you'd be much much better by instead asserting properties of the morphs layout/colors than sampling of display colors... | morph | morph := Morph new. morph doLayoutIn: someBounds. self assert: whatIExpectedWithAboveBounds equals: morph someLayoutVariable Cheers, Henry _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
> From a test-clarity (and robustness) POV though, you'd be much much
> better by instead asserting properties of the morphs layout/colors than > sampling of display colors... > | morph | > > morph := Morph new. > morph doLayoutIn: someBounds. > self assert: whatIExpectedWithAboveBounds equals: morph someLayoutVariable Also have a look the OB and Glamour morphic tests. They mostly does not display the actual morph to test it. Lukas -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
In reply to this post by Henrik Sperre Johansen
> morph := Morph new.
> morph doLayoutIn: someBounds. > self assert: whatIExpectedWithAboveBounds equals: morph > someLayoutVariable Woaaa... Thanks Henrik! This is really cool! Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
In reply to this post by Lukas Renggli
> Also have a look the OB and Glamour morphic tests. They mostly does
> not display the actual morph to test it. I also do some extensive test on Mondrian without displaying the thing. I wanted to test whether a scrollbar appears in a ScrollPanel under certain condition. Thanks for all your replies. Cheers, Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
Free forum by Nabble | Edit this page |