--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Cairo__Examples1.st Thu Feb 25 20:55:41 2016 +0000
@@ -0,0 +1,100 @@
+"{ Package: 'stx:goodies/libcairo' }"
+
+"{ NameSpace: Cairo }"
+
+TestCase subclass:#Examples1
+ instanceVariableNames:'view surface'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Cairo-Examples'
+!
+
+!Examples1 class methodsFor:'accessing'!
+
+isTestSelector:aSelector
+ | method |
+
+ aSelector isNil ifTrue:[ ^ false ].
+ method := self lookupMethodFor: aSelector.
+ ^ method notNil
+ and:[(method hasAnnotation: #example:) or:[ method hasAnnotation: #example:category: ] ]
+
+ "
+ Cairo::Examples1 isTestSelector: #example01:
+ "
+
+ "Created: / 26-02-2016 / 21:57:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!Examples1 class methodsFor:'private'!
+
+testSelectors
+ "The API method is allTestSelectors which now includes #shouldInheritSelectors and so handles all cases. Unlike that method, this does not guarantee to return a sorted ordered collection."
+
+ ^self sunitSelectors select: [:each | self isTestSelector: each ]
+
+ "Created: / 26-02-2016 / 22:40:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!Examples1 methodsFor:'examples'!
+
+example01: cr <example: '01 - arc'>
+| xc yc radius angle1 angle2 |
+
+xc := 128.
+yc := 128.
+radius := 100.
+angle1 := 45 * (Float pi / 180).
+angle2 := 180 * (Float pi / 180).
+
+cr sourceR: 1.0 G: 1.0 B: 1.0.
+cr lineWidth: 10.
+cr arcX: xc y: yc radius: radius from: angle1 to: angle2.
+cr stroke.
+
+ "Created: / 26-02-2016 / 21:53:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!Examples1 methodsFor:'private'!
+
+performTest
+ | cr |
+
+ cr := Cairo::GraphicsContext onSurface: surface.
+ [
+ self perform: testSelector sunitAsSymbol with: cr.
+ ] ensure:[
+ cr release
+ ].
+
+ "Created: / 26-02-2016 / 22:01:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!Examples1 methodsFor:'running'!
+
+setUp
+ Display notNil ifTrue:[
+ | top |
+
+ top := StandardSystemView new.
+ top origin: 10@10 extent: 200@100.
+ view := SimpleView origin: 0.0 @ 0.0 corner: 1.0 @ 1.0 in: top.
+ top openAndWait.
+ surface := view cairoSurface.
+
+ ].
+
+ "Created: / 26-02-2016 / 22:15:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+tearDown
+ view notNil ifTrue:[
+ view topView close.
+ ].
+ surface notNil ifTrue:[
+ surface release.
+ ].
+
+ "Created: / 26-02-2016 / 22:18:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+