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
--- 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 <jan.vrany@fit.cvut.cz>"
+ "Modified: / 03-01-2018 / 21:27:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!FormTests methodsFor:'tests - regression'!
--- /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 <jan.vrany@fit.cvut.cz>"
+ "Modified: / 03-01-2018 / 21:27:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!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 <jan.vrany@fit.cvut.cz>"
+!
+
+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 <jan.vrany@fit.cvut.cz>"
+! !
+
+!ImageTests class methodsFor:'documentation'!
+
+version_HG
+
+ ^ '$Changeset: <not expanded> $'
+! !
+
--- 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)
--- 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) \
--- 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
--- 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)
--- 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);
--- 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 @@
"<className> or (<className> attributes...) in load order"
FcPatternTests
FormTests
+ ImageTests
ResourcePackTests
#'stx_libview_tests'
)