@@ -272,12 +272,15 @@ func TestCreateAmeshImage(t *testing.T) {
272272 return
273273 }
274274
275- if tt .checkCenterColor {
276- centerColor := result .RGBAAt (bounds .Dx ()/ 2 , bounds .Dy ()/ 2 )
277- if centerColor .R != 255 || centerColor .G != 255 || centerColor .B != 255 || centerColor .A != 255 {
278- t .Errorf ("Expected white center pixel but got R=%d, G=%d, B=%d, A=%d" ,
279- centerColor .R , centerColor .G , centerColor .B , centerColor .A )
280- }
275+ if ! tt .checkCenterColor {
276+ return
277+ }
278+
279+ centerColor := result .RGBAAt (bounds .Dx ()/ 2 , bounds .Dy ()/ 2 )
280+
281+ if centerColor .R != 255 || centerColor .G != 255 || centerColor .B != 255 || centerColor .A != 255 {
282+ t .Errorf ("Expected white center pixel but got R=%d, G=%d, B=%d, A=%d" ,
283+ centerColor .R , centerColor .G , centerColor .B , centerColor .A )
281284 }
282285 })
283286 }
@@ -363,23 +366,25 @@ func TestCreateImageReaderWithClient(t *testing.T) {
363366 return
364367 }
365368
366- if tt .expectError == nil {
367- if result == nil {
368- t .Error ("CreateImageReaderWithClient() returned nil reader" )
369- return
370- }
369+ if tt .expectError != nil {
370+ return
371+ }
371372
372- // io.Readerからデータを読み取って、有効なPNGデータかチェック
373- data , err := io .ReadAll (result )
374- if err != nil {
375- t .Error (err )
376- return
377- }
373+ if result == nil {
374+ t .Error ("CreateImageReaderWithClient() returned nil reader" )
375+ return
376+ }
378377
379- // PNGデータのデコードを試行
380- if _ , _ , err = image .Decode (bytes .NewReader (data )); err != nil {
381- t .Error (err )
382- }
378+ // io.Readerからデータを読み取って、有効なPNGデータかチェック
379+ data , err := io .ReadAll (result )
380+ if err != nil {
381+ t .Error (err )
382+ return
383+ }
384+
385+ // PNGデータのデコードを試行
386+ if _ , _ , err = image .Decode (bytes .NewReader (data )); err != nil {
387+ t .Error (err )
383388 }
384389 })
385390 }
0 commit comments