Skip to content

Commit f1a3294

Browse files
committed
Fix tests for SS6
1 parent 8cb326b commit f1a3294

File tree

2 files changed

+37
-37
lines changed

2 files changed

+37
-37
lines changed

tests/ImageManipulationTest.php

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function setUp(): void
2525
/** @var File $image */
2626
$files = File::get()->exclude('ClassName', Folder::class);
2727
foreach ($files as $image) {
28-
$sourcePath = __DIR__ . '/images/' . $image->Name;
28+
$sourcePath = __DIR__ . '/images/pngTestImage.png';
2929
$image->setFromLocalFile($sourcePath, $image->Filename);
3030
}
3131

@@ -50,28 +50,28 @@ public function tearDown(): void
5050
private function Images()
5151
{
5252
$pngLeftTop = $this->objFromFixture(Image::class, 'pngLeftTop');
53-
$pngLeftTop->VerticalSliceTopLeftColor = '#ff0000';
54-
$pngLeftTop->VerticalSliceBottomRightColor = '#00ff00';
55-
$pngLeftTop->HorizontalSliceTopLeftColor = '#ff0000';
56-
$pngLeftTop->HorizontalSliceBottomRightColor = '#ffff00';
53+
$pngLeftTop->VerticalSliceTopLeftColor = 'ff0000';
54+
$pngLeftTop->VerticalSliceBottomRightColor = '00ff00';
55+
$pngLeftTop->HorizontalSliceTopLeftColor = 'ff0000';
56+
$pngLeftTop->HorizontalSliceBottomRightColor = 'ffff00';
5757

5858
$pngRightTop = $this->objFromFixture(Image::class, 'pngRightTop');
59-
$pngRightTop->VerticalSliceTopLeftColor = '#ffff00';
60-
$pngRightTop->VerticalSliceBottomRightColor = '#0000ff';
61-
$pngRightTop->HorizontalSliceTopLeftColor = '#ff0000';
62-
$pngRightTop->HorizontalSliceBottomRightColor = '#ffff00';
59+
$pngRightTop->VerticalSliceTopLeftColor = 'ffff00';
60+
$pngRightTop->VerticalSliceBottomRightColor = '0000ff';
61+
$pngRightTop->HorizontalSliceTopLeftColor = 'ff0000';
62+
$pngRightTop->HorizontalSliceBottomRightColor = 'ffff00';
6363

6464
$pngRightBottom = $this->objFromFixture(Image::class, 'pngRightBottom');
65-
$pngRightBottom->VerticalSliceTopLeftColor = '#ffff00';
66-
$pngRightBottom->VerticalSliceBottomRightColor = '#0000ff';
67-
$pngRightBottom->HorizontalSliceTopLeftColor = '#00ff00';
68-
$pngRightBottom->HorizontalSliceBottomRightColor = '#0000ff';
65+
$pngRightBottom->VerticalSliceTopLeftColor = 'ffff00';
66+
$pngRightBottom->VerticalSliceBottomRightColor = '0000ff';
67+
$pngRightBottom->HorizontalSliceTopLeftColor = '00ff00';
68+
$pngRightBottom->HorizontalSliceBottomRightColor = '0000ff';
6969

7070
$pngLeftBottom = $this->objFromFixture(Image::class, 'pngLeftBottom');
71-
$pngLeftBottom->VerticalSliceTopLeftColor = '#ff0000';
72-
$pngLeftBottom->VerticalSliceBottomRightColor = '#00ff00';
73-
$pngLeftBottom->HorizontalSliceTopLeftColor = '#00ff00';
74-
$pngLeftBottom->HorizontalSliceBottomRightColor = '#0000ff';
71+
$pngLeftBottom->VerticalSliceTopLeftColor = 'ff0000';
72+
$pngLeftBottom->VerticalSliceBottomRightColor = '00ff00';
73+
$pngLeftBottom->HorizontalSliceTopLeftColor = '00ff00';
74+
$pngLeftBottom->HorizontalSliceBottomRightColor = '0000ff';
7575

7676
return array($pngLeftTop, $pngRightTop, $pngRightBottom, $pngLeftBottom);
7777
}
@@ -86,17 +86,17 @@ public function testFocusFill(): void
8686
$croppedVert = $img->FocusFill(1, 50);
8787
$this->assertTrue($croppedVert->isSize(1, 50));
8888
$im = $croppedVert->getImageBackend()->getImageResource();
89-
$leftTopColor = $im->pickColor(0, 0, 'hex');
90-
$bottomRightColor = $im->pickColor(0, 49, 'hex');
89+
$leftTopColor = $im->pickColor(0, 0)->toHex();
90+
$bottomRightColor = $im->pickColor(0, 49)->toHex();
9191
$this->assertEquals($img->VerticalSliceTopLeftColor, $leftTopColor);
9292
$this->assertEquals($img->VerticalSliceBottomRightColor, $bottomRightColor);
9393

9494
// Crop a horizontal slice
9595
$croppedHorz = $img->FocusFill(50, 1);
9696
$this->assertTrue($croppedHorz->isSize(50, 1));
9797
$im = $croppedHorz->getImageBackend()->getImageResource();
98-
$leftTopColor = $im->pickColor(0, 0, 'hex');
99-
$bottomRightColor = $im->pickColor(49, 0, 'hex');
98+
$leftTopColor = $im->pickColor(0, 0)->toHex();
99+
$bottomRightColor = $im->pickColor(49, 0)->toHex();
100100
$this->assertEquals($img->HorizontalSliceTopLeftColor, $leftTopColor);
101101
$this->assertEquals($img->HorizontalSliceBottomRightColor, $bottomRightColor);
102102
}
@@ -113,17 +113,17 @@ public function testFocusFillMax(): void
113113
$croppedVert = $img->FocusFillMax(1, 50);
114114
$this->assertTrue($croppedVert->isSize(1, 50));
115115
$im = $croppedVert->getImageBackend()->getImageResource();
116-
$leftTopColor = $im->pickColor(0, 0, 'hex');
117-
$bottomRightColor = $im->pickColor(0, 49, 'hex');
116+
$leftTopColor = $im->pickColor(0, 0)->toHex();
117+
$bottomRightColor = $im->pickColor(0, 49)->toHex();
118118
$this->assertEquals($img->VerticalSliceTopLeftColor, $leftTopColor);
119119
$this->assertEquals($img->VerticalSliceBottomRightColor, $bottomRightColor);
120120

121121
// Crop a horizontal slice
122122
$croppedHorz = $img->FocusFillMax(50, 1);
123123
$this->assertTrue($croppedHorz->isSize(50, 1));
124124
$im = $croppedHorz->getImageBackend()->getImageResource();
125-
$leftTopColor = $im->pickColor(0, 0, 'hex');
126-
$bottomRightColor = $im->pickColor(49, 0, 'hex');
125+
$leftTopColor = $im->pickColor(0, 0)->toHex();
126+
$bottomRightColor = $im->pickColor(49, 0)->toHex();
127127
$this->assertEquals($img->HorizontalSliceTopLeftColor, $leftTopColor);
128128
$this->assertEquals($img->HorizontalSliceBottomRightColor, $bottomRightColor);
129129

@@ -133,17 +133,17 @@ public function testFocusFillMax(): void
133133
$croppedVert = $img->FocusFillMax(1, 200);
134134
$this->assertTrue($croppedVert->isSize(1, 100));
135135
$im = $croppedVert->getImageBackend()->getImageResource();
136-
$leftTopColor = $im->pickColor(0, 0, 'hex');
137-
$bottomRightColor = $im->pickColor(0, 99, 'hex');
136+
$leftTopColor = $im->pickColor(0, 0)->toHex();
137+
$bottomRightColor = $im->pickColor(0, 99)->toHex();
138138
$this->assertEquals($img->VerticalSliceTopLeftColor, $leftTopColor);
139139
$this->assertEquals($img->VerticalSliceBottomRightColor, $bottomRightColor);
140140

141141
// Crop a horizontal slice
142142
$croppedHorz = $img->FocusFillMax(200, 1);
143143
$this->assertTrue($croppedHorz->isSize(100, 1));
144144
$im = $croppedHorz->getImageBackend()->getImageResource();
145-
$leftTopColor = $im->pickColor(0, 0, 'hex');
146-
$bottomRightColor = $im->pickColor(99, 0, 'hex');
145+
$leftTopColor = $im->pickColor(0, 0)->toHex();
146+
$bottomRightColor = $im->pickColor(99, 0)->toHex();
147147
$this->assertEquals($img->HorizontalSliceTopLeftColor, $leftTopColor);
148148
$this->assertEquals($img->HorizontalSliceBottomRightColor, $bottomRightColor);
149149
}

tests/ImageManipulationTest.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,32 @@ SilverStripe\Assets\Folder:
44
SilverStripe\Assets\Image:
55
pngLeftTop:
66
Title: PNG w left/top focus point
7-
Name: pngTestImage.png
8-
FileFilename: folder/pngTestImage.png
7+
Name: pngTestImageLeftTop.png
8+
FileFilename: folder/pngTestImageLeftTop.png
99
FileHash: 9c2e4494af6f4b01a590d82dbaa44f6be8b63f05
1010
Parent: =>SilverStripe\Assets\Folder.folder1
1111
FocusPointX: -.25
1212
FocusPointY: -.25
1313
pngRightTop:
1414
Title: PNG w right/top focus point
15-
Name: pngTestImage.png
16-
FileFilename: folder/pngTestImage.png
15+
Name: pngTestImageRightTop.png
16+
FileFilename: folder/pngTestImageRightTop.png
1717
FileHash: 9c2e4494af6f4b01a590d82dbaa44f6be8b63f05
1818
Parent: =>SilverStripe\Assets\Folder.folder1
1919
FocusPointX: .25
2020
FocusPointY: -.25
2121
pngRightBottom:
2222
Title: PNG w right/bottom focus point
23-
Name: pngTestImage.png
24-
FileFilename: folder/pngTestImage.png
23+
Name: pngTestImageRightBottom.png
24+
FileFilename: folder/pngTestImageRightBottom.png
2525
FileHash: 9c2e4494af6f4b01a590d82dbaa44f6be8b63f05
2626
Parent: =>SilverStripe\Assets\Folder.folder1
2727
FocusPointX: .25
2828
FocusPointY: .25
2929
pngLeftBottom:
3030
Title: PNG w left/bottom focus point
31-
Name: pngTestImage.png
32-
FileFilename: folder/pngTestImage.png
31+
Name: pngTestImageLeftBottom.png
32+
FileFilename: folder/pngTestImageLeftBottom.png
3333
FileHash: 9c2e4494af6f4b01a590d82dbaa44f6be8b63f05
3434
Parent: =>SilverStripe\Assets\Folder.folder1
3535
FocusPointX: -.25

0 commit comments

Comments
 (0)