David T. Lewis uploaded a new version of MorphicExtras to project The Trunk:
http://source.squeak.org/trunk/MorphicExtras-hjh.210.mcz ==================== Summary ==================== Name: MorphicExtras-hjh.210 Author: hjh Time: 30 September 2017, 11:55:17.310454 am UUID: 3a05acb5-0d83-424c-8471-b7b5af288d35 Ancestors: MorphicExtras-tpr.209 A smoke test for Postscript support. =============== Diff against MorphicExtras-tpr.209 =============== Item was added: + TestCase subclass: #EPSCanvasTest + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: 'MorphicExtras-Postscript Canvases'! Item was added: + ----- Method: EPSCanvasTest>>testSmokeTest (in category 'as yet unclassified') ----- + testSmokeTest + | epsCode | + epsCode := (RectangleMorph new asEPS). + + self assert: epsCode lines first = '%!!PS-Adobe-2.0 EPSF-2.0'. + + self assert: (epsCode lines detect: [:line | line beginsWith: '%start morph: a RectangleMorph'] ifNone: [nil]) notNil. + + self assert: epsCode lines last = '%%EOF' + ! |
Thank you for the commit, David.
This test now nicely shows what happens if you move FlattenEncoder subclass: #Canvas to Object subclass: Canvas thus separating the Canvas hierarchy from the NullEncoder - FlattenEncoder hierarchy. ------------------------- The fix just needs a class CanvasWithEncoder [1] with three methods inserted as a subclass of Canvas and as a superclass of PostscriptCanvas. Maybe there are more methods needed for other test cases. And I do not understand yet where #filterSelector comes into action. See thread 'NullEncoder'. --Hannes --------------------------- [1] Class CanvasWithEncoder inserted between under Canvas and above PostScriptCanvas 'From Squeak6.0alpha of 28 September 2017 [latest update: #17405] on 30 September 2017 at 6:17:59 pm'! Canvas subclass: #CanvasWithEncoder instanceVariableNames: 'target filterSelector' classVariableNames: '' poolDictionaries: '' category: 'Morphic-Support'! !CanvasWithEncoder commentStamp: 'hjh 9/30/2017 15:58' prior: 0! A CanvasWithEncoder maintains a target to keep an Encoder which is used by subclasses to execute drawing commands. Instance Variables filterSelector: <Object> target: <Object> filterSelector - xxxxx target - xxxxx ! !CanvasWithEncoder methodsFor: 'as yet unclassified' stamp: 'hjh 9/30/2017 15:02'! contents ^target contents.! ! !CanvasWithEncoder methodsFor: 'as yet unclassified' stamp: 'hjh 9/30/2017 15:00'! initWithTarget:aTarget target := aTarget. filterSelector := self class filterSelector. ^self.! ! !CanvasWithEncoder methodsFor: 'as yet unclassified' stamp: 'hjh 9/30/2017 14:59'! reset "Reset the canvas." self initWithTarget: self class defaultTarget.! ! On Sat, 30 Sep 2017 16:11:48 0000, [hidden email] <[hidden email]> wrote: > David T. Lewis uploaded a new version of MorphicExtras to project The Trunk: > http://source.squeak.org/trunk/MorphicExtras-hjh.210.mcz > > ==================== Summary ==================== > > Name: MorphicExtras-hjh.210 > Author: hjh > Time: 30 September 2017, 11:55:17.310454 am > UUID: 3a05acb5-0d83-424c-8471-b7b5af288d35 > Ancestors: MorphicExtras-tpr.209 > > A smoke test for Postscript support. > > =============== Diff against MorphicExtras-tpr.209 =============== > > Item was added: > + TestCase subclass: #EPSCanvasTest > + instanceVariableNames: '' > + classVariableNames: '' > + poolDictionaries: '' > + category: 'MorphicExtras-Postscript Canvases'! > > Item was added: > + ----- Method: EPSCanvasTest>>testSmokeTest (in category 'as yet > unclassified') ----- > + testSmokeTest > + | epsCode | > + epsCode := (RectangleMorph new asEPS). > + > + self assert: epsCode lines first = '%!!PS-Adobe-2.0 EPSF-2.0'. > + > + self assert: (epsCode lines detect: [:line | line beginsWith: '%start > morph: a RectangleMorph'] ifNone: [nil]) notNil. > + > + self assert: epsCode lines last = '%%EOF' > + ! > > > |
Clarification:
The previous mail is about a way to find out how the NullEncoder and subclasses hierarchy works. The discussion in the thread 'What is the task of NullEncoder?' has shown in the meantime that it is NOT a good idea to move Canvas from FlattenEncoder subclass: #Canvas to Object subclass: Canvas It should be kept as is. To have the Postscript support smoke test is still a good thing though. There should be actually more Postscript tests .... --Hannes On 9/30/17, H. Hirzel <[hidden email]> wrote: > Thank you for the commit, David. > > This test now nicely shows what happens if you move > > FlattenEncoder subclass: #Canvas > > to > > Object subclass: Canvas > > thus separating the Canvas hierarchy from the NullEncoder - > FlattenEncoder hierarchy. > > > ------------------------- > The fix just needs a class CanvasWithEncoder [1] with three methods > inserted as a subclass of Canvas and as a superclass of > PostscriptCanvas. > > Maybe there are more methods needed for other test cases. > > And I do not understand yet where #filterSelector comes into action. > See thread 'NullEncoder'. > > --Hannes > --------------------------- > > [1] Class CanvasWithEncoder inserted between under Canvas and above > PostScriptCanvas > > > 'From Squeak6.0alpha of 28 September 2017 [latest update: #17405] on > 30 September 2017 at 6:17:59 pm'! > Canvas subclass: #CanvasWithEncoder > instanceVariableNames: 'target filterSelector' > classVariableNames: '' > poolDictionaries: '' > category: 'Morphic-Support'! > !CanvasWithEncoder commentStamp: 'hjh 9/30/2017 15:58' prior: 0! > A CanvasWithEncoder maintains a target to keep an Encoder which is > used by subclasses to execute drawing commands. > > Instance Variables > filterSelector: <Object> > target: <Object> > > filterSelector > - xxxxx > > target > - xxxxx > ! > > > !CanvasWithEncoder methodsFor: 'as yet unclassified' stamp: 'hjh > 9/30/2017 15:02'! > contents > ^target contents.! ! > > !CanvasWithEncoder methodsFor: 'as yet unclassified' stamp: 'hjh > 9/30/2017 15:00'! > initWithTarget:aTarget > target := aTarget. > filterSelector := self class filterSelector. > ^self.! ! > > !CanvasWithEncoder methodsFor: 'as yet unclassified' stamp: 'hjh > 9/30/2017 14:59'! > reset > "Reset the canvas." > > self initWithTarget: self class defaultTarget.! ! > > > On Sat, 30 Sep 2017 16:11:48 0000, [hidden email] > <[hidden email]> wrote: >> David T. Lewis uploaded a new version of MorphicExtras to project The >> Trunk: >> http://source.squeak.org/trunk/MorphicExtras-hjh.210.mcz >> >> ==================== Summary ==================== >> >> Name: MorphicExtras-hjh.210 >> Author: hjh >> Time: 30 September 2017, 11:55:17.310454 am >> UUID: 3a05acb5-0d83-424c-8471-b7b5af288d35 >> Ancestors: MorphicExtras-tpr.209 >> >> A smoke test for Postscript support. >> >> =============== Diff against MorphicExtras-tpr.209 =============== >> >> Item was added: >> + TestCase subclass: #EPSCanvasTest >> + instanceVariableNames: '' >> + classVariableNames: '' >> + poolDictionaries: '' >> + category: 'MorphicExtras-Postscript Canvases'! >> >> Item was added: >> + ----- Method: EPSCanvasTest>>testSmokeTest (in category 'as yet >> unclassified') ----- >> + testSmokeTest >> + | epsCode | >> + epsCode := (RectangleMorph new asEPS). >> + >> + self assert: epsCode lines first = '%!!PS-Adobe-2.0 EPSF-2.0'. >> + >> + self assert: (epsCode lines detect: [:line | line beginsWith: '%start >> morph: a RectangleMorph'] ifNone: [nil]) notNil. >> + >> + self assert: epsCode lines last = '%%EOF' >> + ! >> >> >> > |
Free forum by Nabble | Edit this page |