Skip to content

Commit

Permalink
Merge pull request #57 from pharo-graphics/56-Make-AeCanvasTestrender…
Browse files Browse the repository at this point in the history
…Form-independent-of-Pharos-big-icon

Make tests independent of Pharo icons
  • Loading branch information
tinchodias committed May 2, 2024
2 parents 847d26a + adddc18 commit 4d7d79b
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 8 deletions.
9 changes: 4 additions & 5 deletions src/Alexandrie-Cairo-Tests/AeCairoExamplesRenderTest.class.st
Expand Up @@ -93,7 +93,7 @@ AeCairoExamplesRenderTest >> surfaceWithAllOperators [
AeCairoExamplesRenderTest >> surfaceWithColoredIcons [

| inputForm inputSurface outputColors outputSurface outputContext |
inputForm := self iconNamed: #windowClose.
inputForm := Form fromFileNamed: AeFilesystemResources removeIconPNG.
inputSurface := AeCairoImageSurface fromForm: inputForm.

outputColors := Color wheel: 7.
Expand Down Expand Up @@ -352,7 +352,7 @@ AeCairoExamplesRenderTest >> surfaceWithGouraudBasedTriangle [
AeCairoExamplesRenderTest >> surfaceWithPixelatedIcon [

| iconForm iconSurface iconPattern scale aSurface aContext |
iconForm := Smalltalk ui icons iconNamed: #removeIcon.
iconForm := Form fromFileNamed: AeFilesystemResources removeIconPNG.
iconSurface := AeCairoImageSurface fromForm: iconForm.
iconPattern := AeCairoSurfacePattern surface: iconSurface.
scale := 5.0.
Expand Down Expand Up @@ -604,10 +604,9 @@ AeCairoExamplesRenderTest >> surfaceWithStraightEdgesCurve [
AeCairoExamplesRenderTest >> surfaceWithStretchedIcon [

| aSurface aContext iconForm iconSurface iconPattern horizontalScale verticalScale |
iconForm := Smalltalk ui icons iconNamed: #classIcon.
self assert: iconForm extent = (16@16).
iconForm := Form fromFileNamed: AeFilesystemResources removeIconPNG.
horizontalScale := 0.5.
verticalScale := 4.0.
verticalScale := 2.0.

iconSurface := AeCairoImageSurface fromForm: iconForm.
iconPattern := AeCairoSurfacePattern surface: iconSurface.
Expand Down
Expand Up @@ -41,7 +41,7 @@ AeCairoImageSurfaceTest >> testExtentFormat [
AeCairoImageSurfaceTest >> testFromForm [

| aForm |
aForm := Smalltalk ui icons iconNamed: #classIcon.
aForm := Form fromFileNamed: AeFilesystemResources removeIconPNG.
surface := AeCairoImageSurface fromForm: aForm.

self assert: surface extent equals: aForm extent
Expand Down
12 changes: 12 additions & 0 deletions src/Alexandrie-Cairo-Tests/AeFilesystemResources.extension.st
Expand Up @@ -5,3 +5,15 @@ AeFilesystemResources class >> cairoDirectory [

^ self testsDirectory / 'cairo'
]

{ #category : #'*Alexandrie-Cairo-Tests' }
AeFilesystemResources class >> imagesDirectory [

^ self testsDirectory / 'images'
]

{ #category : #'*Alexandrie-Cairo-Tests' }
AeFilesystemResources class >> removeIconPNG [

^ self imagesDirectory / 'removeIcon.png'
]
4 changes: 2 additions & 2 deletions src/Alexandrie-Canvas-Tests/AeCanvasTest.class.st
Expand Up @@ -328,10 +328,10 @@ AeCanvasTest >> renderEmoji [
AeCanvasTest >> renderForm [

| aeCanvas aForm |
aeCanvas := AeCanvas extent: 50@75.
aeCanvas := AeCanvas extent: 60@20.
aeCanvas clear: Color paleGreen.

aForm := Smalltalk ui icons iconNamed: #pharoBig.
aForm := Form fromFileNamed: AeFilesystemResources removeIconPNG.

aeCanvas pathScale: (aeCanvas extent / aForm extent) asFloatPoint.
aeCanvas pathFactory: [ :cairoContext |
Expand Down
Binary file modified tests/cairo/surfaceWithColoredIcons.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/cairo/surfaceWithStretchedIcon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/canvas/renderForm.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/images/removeIcon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4d7d79b

Please sign in to comment.