Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make tests independent of Pharo icons #57

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/Alexandrie-Cairo-Tests/AeCairoExamplesRenderTest.class.st
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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.