# HG changeset patch # User Jan Vrany # Date 1515017962 0 # Node ID 5382a417a503a795af5b2f6f8948577461327864 # Parent ddbaa22b935264d423ad8df8b9a42db97232515d Issue #190: added tests for `Image class >> fromView:` and `Image class >> fromScreen:' ...which broke under XWayland since XWayland does not support `XGetImage()` https://swing.fit.cvut.cz/projects/stx-jv/ticket/190 diff -r ddbaa22b9352 -r 5382a417a503 tests/FormTests.st --- a/tests/FormTests.st Fri Dec 08 09:10:33 2017 +0000 +++ b/tests/FormTests.st Wed Jan 03 22:19:22 2018 +0000 @@ -13,12 +13,13 @@ !FormTests methodsFor:'running'! setUp - Display isNil ifTrue:[ + Screen current isNil ifTrue:[ Smalltalk openDisplay ]. - self skipIf: Display isNil description: 'Display connection not available' + self skipIf: Screen current isNil description: 'Display connection not available' "Created: / 25-04-2016 / 20:30:18 / Jan Vrany " + "Modified: / 03-01-2018 / 21:27:47 / Jan Vrany " ! ! !FormTests methodsFor:'tests - regression'! diff -r ddbaa22b9352 -r 5382a417a503 tests/ImageTests.st --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/ImageTests.st Wed Jan 03 22:19:22 2018 +0000 @@ -0,0 +1,58 @@ +"{ Package: 'stx:libview/tests' }" + +"{ NameSpace: Smalltalk }" + +TestCase subclass:#ImageTests + instanceVariableNames:'' + classVariableNames:'' + poolDictionaries:'' + category:'Graphics-Images-Tests' +! + + +!ImageTests methodsFor:'running'! + +setUp + Screen current isNil ifTrue:[ + Smalltalk openDisplay + ]. + self skipIf: Screen current isNil description: 'Display connection not available' + + "Created: / 25-04-2016 / 20:30:18 / Jan Vrany " + "Modified: / 03-01-2018 / 21:27:47 / Jan Vrany " +! ! + +!ImageTests methodsFor:'tests - regression'! + +test_fromScreen_01 + | image | + + self skipIf: true description: 'Image fromScreen: is broken on XWayland'. + image := Image fromScreen. + + "Created: / 04-01-2018 / 09:22:53 / Jan Vrany " +! + +test_fromView_01 + | view image | + + [ + view := Button new. + view label: 'Hello world'. + view open. + image := Image fromView: view grab: false. + ] ensure:[ + view topView close. + ]. + self assert: image notNil. + + "Created: / 03-01-2018 / 21:28:05 / Jan Vrany " +! ! + +!ImageTests class methodsFor:'documentation'! + +version_HG + + ^ '$Changeset: $' +! ! + diff -r ddbaa22b9352 -r 5382a417a503 tests/Make.proto --- a/tests/Make.proto Fri Dec 08 09:10:33 2017 +0000 +++ b/tests/Make.proto Wed Jan 03 22:19:22 2018 +0000 @@ -34,7 +34,7 @@ # add the path(es) here:, # ********** OPTIONAL: MODIFY the next lines *** # LOCALINCLUDES=-Ifoo -Ibar -LOCALINCLUDES= -I$(INCLUDE_TOP)/stx/goodies/sunit -I$(INCLUDE_TOP)/stx/libbasic -I$(INCLUDE_TOP)/stx/libbasic3 -I$(INCLUDE_TOP)/stx/libview +LOCALINCLUDES= -I$(INCLUDE_TOP)/stx/goodies/sunit -I$(INCLUDE_TOP)/stx/libbasic -I$(INCLUDE_TOP)/stx/libbasic3 -I$(INCLUDE_TOP)/stx/libview -I$(INCLUDE_TOP)/stx/libwidg # if you need any additional defines for embedded C code, @@ -127,6 +127,7 @@ # BEGINMAKEDEPEND --- do not remove this line; make depend needs it $(OUTDIR)FcPatternTests.$(O) FcPatternTests.$(C) FcPatternTests.$(H): FcPatternTests.st $(INCLUDE_TOP)/stx/goodies/sunit/TestAsserter.$(H) $(INCLUDE_TOP)/stx/goodies/sunit/TestCase.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR) $(OUTDIR)FormTests.$(O) FormTests.$(C) FormTests.$(H): FormTests.st $(INCLUDE_TOP)/stx/goodies/sunit/TestAsserter.$(H) $(INCLUDE_TOP)/stx/goodies/sunit/TestCase.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR) +$(OUTDIR)ImageTests.$(O) ImageTests.$(C) ImageTests.$(H): ImageTests.st $(INCLUDE_TOP)/stx/goodies/sunit/TestAsserter.$(H) $(INCLUDE_TOP)/stx/goodies/sunit/TestCase.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR) $(OUTDIR)ResourcePackTests.$(O) ResourcePackTests.$(C) ResourcePackTests.$(H): ResourcePackTests.st $(INCLUDE_TOP)/stx/goodies/sunit/TestAsserter.$(H) $(INCLUDE_TOP)/stx/goodies/sunit/TestCase.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR) $(OUTDIR)stx_libview_tests.$(O) stx_libview_tests.$(C) stx_libview_tests.$(H): stx_libview_tests.st $(INCLUDE_TOP)/stx/libbasic/LibraryDefinition.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/ProjectDefinition.$(H) $(STCHDR) diff -r ddbaa22b9352 -r 5382a417a503 tests/Make.spec --- a/tests/Make.spec Fri Dec 08 09:10:33 2017 +0000 +++ b/tests/Make.spec Wed Jan 03 22:19:22 2018 +0000 @@ -53,6 +53,7 @@ COMMON_CLASSES= \ FcPatternTests \ FormTests \ + ImageTests \ ResourcePackTests \ stx_libview_tests \ @@ -62,6 +63,7 @@ COMMON_OBJS= \ $(OUTDIR)FcPatternTests.$(O) \ $(OUTDIR)FormTests.$(O) \ + $(OUTDIR)ImageTests.$(O) \ $(OUTDIR)ResourcePackTests.$(O) \ $(OUTDIR)stx_libview_tests.$(O) \ diff -r ddbaa22b9352 -r 5382a417a503 tests/abbrev.stc --- a/tests/abbrev.stc Fri Dec 08 09:10:33 2017 +0000 +++ b/tests/abbrev.stc Wed Jan 03 22:19:22 2018 +0000 @@ -3,5 +3,6 @@ # it provides information about a classes filename, category and especially namespace. FcPatternTests FcPatternTests stx:libview/tests 'Graphics-Support-FontConfig-Tests' 1 FormTests FormTests stx:libview/tests 'Compatibility-ST80-Graphics-Display Objects-Tests' 1 +ImageTests ImageTests stx:libview/tests 'Graphics-Images-Tests' 1 ResourcePackTests ResourcePackTests stx:libview/tests 'Interface-Internationalization-Tests' 1 stx_libview_tests stx_libview_tests stx:libview/tests '* Projects & Packages *' 3 diff -r ddbaa22b9352 -r 5382a417a503 tests/bc.mak --- a/tests/bc.mak Fri Dec 08 09:10:33 2017 +0000 +++ b/tests/bc.mak Wed Jan 03 22:19:22 2018 +0000 @@ -35,7 +35,7 @@ -LOCALINCLUDES= -I$(INCLUDE_TOP)\stx\goodies\sunit -I$(INCLUDE_TOP)\stx\libbasic -I$(INCLUDE_TOP)\stx\libbasic3 -I$(INCLUDE_TOP)\stx\libview +LOCALINCLUDES= -I$(INCLUDE_TOP)\stx\goodies\sunit -I$(INCLUDE_TOP)\stx\libbasic -I$(INCLUDE_TOP)\stx\libbasic3 -I$(INCLUDE_TOP)\stx\libview -I$(INCLUDE_TOP)\stx\libwidg LOCALDEFINES= STCLOCALOPT=-package=$(PACKAGE) -I. $(LOCALINCLUDES) -headerDir=. $(STCLOCALOPTIMIZATIONS) $(STCWARNINGS) $(LOCALDEFINES) -varPrefix=$(LIBNAME) @@ -74,6 +74,7 @@ # BEGINMAKEDEPEND --- do not remove this line; make depend needs it $(OUTDIR)FcPatternTests.$(O) FcPatternTests.$(C) FcPatternTests.$(H): FcPatternTests.st $(INCLUDE_TOP)\stx\goodies\sunit\TestAsserter.$(H) $(INCLUDE_TOP)\stx\goodies\sunit\TestCase.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR) $(OUTDIR)FormTests.$(O) FormTests.$(C) FormTests.$(H): FormTests.st $(INCLUDE_TOP)\stx\goodies\sunit\TestAsserter.$(H) $(INCLUDE_TOP)\stx\goodies\sunit\TestCase.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR) +$(OUTDIR)ImageTests.$(O) ImageTests.$(C) ImageTests.$(H): ImageTests.st $(INCLUDE_TOP)\stx\goodies\sunit\TestAsserter.$(H) $(INCLUDE_TOP)\stx\goodies\sunit\TestCase.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR) $(OUTDIR)ResourcePackTests.$(O) ResourcePackTests.$(C) ResourcePackTests.$(H): ResourcePackTests.st $(INCLUDE_TOP)\stx\goodies\sunit\TestAsserter.$(H) $(INCLUDE_TOP)\stx\goodies\sunit\TestCase.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR) $(OUTDIR)stx_libview_tests.$(O) stx_libview_tests.$(C) stx_libview_tests.$(H): stx_libview_tests.st $(INCLUDE_TOP)\stx\libbasic\LibraryDefinition.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\ProjectDefinition.$(H) $(STCHDR) diff -r ddbaa22b9352 -r 5382a417a503 tests/libInit.cc --- a/tests/libInit.cc Fri Dec 08 09:10:33 2017 +0000 +++ b/tests/libInit.cc Wed Jan 03 22:19:22 2018 +0000 @@ -18,6 +18,7 @@ extern void _FcPatternTests_Init(int pass, struct __vmData__ *__pRT__, OBJ snd); extern void _FormTests_Init(int pass, struct __vmData__ *__pRT__, OBJ snd); +extern void _ImageTests_Init(int pass, struct __vmData__ *__pRT__, OBJ snd); extern void _ResourcePackTests_Init(int pass, struct __vmData__ *__pRT__, OBJ snd); extern void _stx_137libview_137tests_Init(int pass, struct __vmData__ *__pRT__, OBJ snd); @@ -36,6 +37,7 @@ __BEGIN_PACKAGE2__("libstx_libview_tests", _libstx_libview_tests_Init, "stx:libview/tests"); _FcPatternTests_Init(pass,__pRT__,snd); _FormTests_Init(pass,__pRT__,snd); + _ImageTests_Init(pass,__pRT__,snd); _ResourcePackTests_Init(pass,__pRT__,snd); _stx_137libview_137tests_Init(pass,__pRT__,snd); diff -r ddbaa22b9352 -r 5382a417a503 tests/stx_libview_tests.st --- a/tests/stx_libview_tests.st Fri Dec 08 09:10:33 2017 +0000 +++ b/tests/stx_libview_tests.st Wed Jan 03 22:19:22 2018 +0000 @@ -50,6 +50,7 @@ ^ #( #'stx:libbasic3' "MessageTracer - referenced by ResourcePackTests>>tearDown" #'stx:libview' "Color - referenced by FormTests>>test_issue_25a" + #'stx:libwidg' "Button - referenced by ImageTests>>test_fromView_01" ) ! @@ -75,6 +76,7 @@ " or ( attributes...) in load order" FcPatternTests FormTests + ImageTests ResourcePackTests #'stx_libview_tests' )