Hi Eric,<br>
<br>
> Note that in this version, the tests are currently failing because -- apparently -- drawing Color black to a FormCanvas actually results in a slightly different color being put at the corresponding pixels of the Form. Therefore the expected values (Color black) are something else.<br>
>   <br>
> I suspect this is an issue with Form/FormCanvas?<br>
<br>
Here is a small bit of additional information on this issue (I don't understand the issue myself, but I have already searched for this on the list recently for another student's question, so maybe this is helpful for anyone): See also GraphicsTests-pre.49.<br>
It looks as if 32-bit forms in Squeak basically do not support black pixels for what ever reason. You could check whether issue persists when you choose a lower bit depth.<br>
<br>
Sorry, that is the only dim light I can shed on this issue ...<br>
<br>
Best,<br>
Christoph<br>
<br>
<font color="#808080">---<br>
</font><font color="#808080"><i>Sent from </i></font><font color="#808080"><i><a href="https://github.com/hpi-swa-lab/squeak-inbox-talk"><u><font color="#808080">Squeak Inbox Talk</font></u></a></i></font><br>
<br>
On 2022-05-04T11:08:41+00:00, commits@source.squeak.org wrote:<br>
<br>
> Marcel Taeumel uploaded a new version of GraphicsTests to project The Trunk:<br>
> http://source.squeak.org/trunk/GraphicsTests-EG.58.mcz<br>
> <br>
> ==================== Summary ====================<br>
> <br>
> Name: GraphicsTests-EG.58<br>
> Author: EG<br>
> Time: 21 December 2021, 7:06:22.53722 pm<br>
> UUID: 32f0cb4a-a10f-4263-85da-6d934e567b0d<br>
> Ancestors: GraphicsTests-mt.57<br>
> <br>
> Adding actual tests for GIF reading and writing (and reading back in).<br>
>   <br>
> Note that in this version, the tests are currently failing because -- apparently -- drawing Color black to a FormCanvas actually results in a slightly different color being put at the corresponding pixels of the Form. Therefore the expected values (Color black) are something else.<br>
>   <br>
> I suspect this is an issue with Form/FormCanvas?<br>
> <br>
> =============== Diff against GraphicsTests-mt.57 ===============<br>
> <br>
> Item was added:<br>
> + TestCase subclass: #GIFReadWriterTest<br>
> +     instanceVariableNames: ''<br>
> +     classVariableNames: ''<br>
> +     poolDictionaries: ''<br>
> +     category: 'GraphicsTests-Files'!<br>
> <br>
> Item was added:<br>
> + ----- Method: GIFReadWriterTest>>animatedColorFrames (in category 'tests') -----<br>
> + animatedColorFrames<br>
> +     "Responds with a collection of AnimatedImageFrames<br>
> +     each containing equal-sized rectangles of green, red, <br>
> +     yellow. and black. When animated, these rectangles move<br>
> +     into each other's positions, then back"<br>
> +     | frames topLeft topRight bottomLeft bottomRight revFrames |<br>
> +     frames := OrderedCollection new.<br>
> +     topLeft := (0 at 0 extent: 200 at 200).<br>
> +     topRight := (200 at 0 extent: 400 at 200).<br>
> +     bottomLeft := (0 at 200 extent: 200 at 400).<br>
> +     bottomRight := (200 at 200 extent: 400 at 400).<br>
> +     <br>
> +     0 to: 200 by: 20 do: [ :num |<br>
> +         | newTopLeft newTopRight newBottomLeft newBottomRight canvas |<br>
> +         newTopLeft := topLeft translateBy: (num at 0).<br>
> +         newTopRight := topRight translateBy: (0 at num).<br>
> +         newBottomLeft := (bottomLeft origin - (0 at num)) corner: (bottomLeft extent - (0 at num)).<br>
> +         newBottomRight := (bottomRight origin - (num at 0)) extent: (bottomLeft extent - (0 at 0)).<br>
> +         canvas := FormCanvas extent: 400 at 400 depth: 32.<br>
> +         canvas<br>
> +             fillRectangle: newTopLeft color: Color green;<br>
> +             fillRectangle: newTopRight color: Color red;<br>
> +             fillRectangle: newBottomLeft color: Color yellow;<br>
> +             fillRectangle: newBottomRight color: Color black.<br>
> +         frames add: (AnimatedImageFrame new<br>
> +             form: canvas form;<br>
> +             disposal: #restoreBackground;<br>
> +             delay: 60) ].<br>
> + <br>
> +     revFrames := frames reversed.<br>
> +     revFrames do: [ :f | frames add: f ].<br>
> +     ^ frames!<br>
> <br>
> Item was added:<br>
> + ----- Method: GIFReadWriterTest>>testAnimatedColorsOutIn (in category 'tests') -----<br>
> + testAnimatedColorsOutIn<br>
> +     "Ensure that the colored rectangles in the created<br>
> +     animated gif are correct at different frames"<br>
> +     | frames outBytes writer reader inBytes activeFrame |<br>
> +     frames := self animatedColorFrames.<br>
> +     <br>
> +     "Write out the GIF bytes to the byte stream"<br>
> +     outBytes := WriteStream on: (ByteArray new).<br>
> +     writer := GIFReadWriter on: outBytes.<br>
> +     frames do: [ :f | writer nextPutFrame: f ].<br>
> +     writer close.<br>
> +     <br>
> +     "Read the GIF byte stream back into a GIF"<br>
> +     inBytes := ReadStream on: (outBytes contents).<br>
> +     reader := GIFReadWriter on: inBytes.<br>
> +     reader<br>
> +         readHeader;<br>
> +         readBody.<br>
> +     <br>
> +     self assert: reader isAnimated equals: true.<br>
> +     activeFrame := reader frames at: 1.<br>
> +     self assert: (activeFrame form colorAt: 100 at 100) equals: Color green.<br>
> +     self assert: (activeFrame form colorAt: 300 at 100) equals: Color red.<br>
> +     self assert: (activeFrame form colorAt: 100 at 300) equals: Color yellow.<br>
> +     self assert: (activeFrame form colorAt: 300 at 300) equals: Color black.<br>
> +     activeFrame := reader frames at: 11.<br>
> +     self assert: (activeFrame form colorAt: 100 at 100) equals: Color yellow.<br>
> +     self assert: (activeFrame form colorAt: 300 at 100) equals: Color green.<br>
> +     self assert: (activeFrame form colorAt: 100 at 300) equals: Color black.<br>
> +     self assert: (activeFrame form colorAt: 300 at 300) equals: Color red.<br>
> +     !<br>
> <br>
> Item was added:<br>
> + ----- Method: GIFReadWriterTest>>testColorsFileOutIn (in category 'tests') -----<br>
> + testColorsFileOutIn<br>
> +     "Ensure that the colors that are written match up<br>
> +     to the colors that are read in again"<br>
> +     | canvas form outBytes inBytes writer reader |<br>
> +     canvas := FormCanvas extent: 400 at 400.<br>
> +     canvas<br>
> +         fillRectangle: (0 at 0 extent: 200 at 200) color: Color green;<br>
> +         fillRectangle: (200 at 0 extent: 400 at 200) color: Color red;<br>
> +         fillRectangle: (0 at 200 extent: 200 at 400) color: Color yellow;<br>
> +         fillRectangle: (200 at 200 extent: 400 at 400) color: Color black.<br>
> +     form := canvas form.<br>
> +     outBytes := FileStream fileNamed: 'testColorsFileOutIn.gif'.<br>
> +     writer := GIFReadWriter on: outBytes.<br>
> +     writer<br>
> +         nextPutImage: form;<br>
> +         close.<br>
> +     inBytes := 'testColorsFileOutIn.gif' asDirectoryEntry readStream binary.<br>
> +     reader := GIFReadWriter on: inBytes.<br>
> +     reader<br>
> +         readHeader;<br>
> +         readBody.<br>
> +     inBytes close.<br>
> +     'testColorsFileOutIn.gif' asDirectoryEntry delete.<br>
> +     self assert: reader isAnimated equals: false.<br>
> +     self assert: (reader form colorAt: 50 at 50) equals: Color green.<br>
> +     self assert: (reader form colorAt: 250 at 50) equals: Color red.<br>
> +     self assert: (reader form colorAt: 50 at 250) equals: Color yellow.<br>
> +     self assert: (reader form colorAt: 250 at 250) equals: Color black.!<br>
> <br>
> Item was added:<br>
> + ----- Method: GIFReadWriterTest>>testColorsOutIn (in category 'tests') -----<br>
> + testColorsOutIn<br>
> +     "Ensure that the colors that are written match up<br>
> +     to the colors that are read in again"<br>
> +     | canvas form outBytes inBytes writer reader |<br>
> +     canvas := FormCanvas extent: 400 at 400.<br>
> +     canvas<br>
> +         fillRectangle: (0 at 0 extent: 200 at 200) color: Color green;<br>
> +         fillRectangle: (200 at 0 extent: 400 at 200) color: Color red;<br>
> +         fillRectangle: (0 at 200 extent: 200 at 400) color: Color yellow;<br>
> +         fillRectangle: (200 at 200 extent: 400 at 400) color: Color black.<br>
> +     form := canvas form.<br>
> +     outBytes := WriteStream on: (ByteArray new).<br>
> +     writer := GIFReadWriter on: outBytes.<br>
> +     writer<br>
> +         nextPutImage: form;<br>
> +         close.<br>
> +     outBytes := outBytes contents.<br>
> +     inBytes := ReadStream on: outBytes.<br>
> +     reader := GIFReadWriter on: inBytes.<br>
> +     reader<br>
> +         readHeader;<br>
> +         readBody.<br>
> +     self assert: reader isAnimated equals: false.<br>
> +     self assert: (reader form colorAt: 50 at 50) equals: Color green.<br>
> +     self assert: (reader form colorAt: 250 at 50) equals: Color red.<br>
> +     self assert: (reader form colorAt: 50 at 250) equals: Color yellow.<br>
> +     self assert: (reader form colorAt: 250 at 250) equals: Color black.!<br>
> <br>
> <br>
["21f76fee-ee89-4520-af8d-14db0e6e812f.jfif"]