Project

General

Profile

Revision b0dc3a2e

Added by Julien Enselme over 7 years ago

Update to Drupal 7.52

View differences:

drupal7/modules/simpletest/tests/image.test
207 207
  protected $green       = array(0, 255, 0, 0);
208 208
  protected $blue        = array(0, 0, 255, 0);
209 209
  protected $yellow      = array(255, 255, 0, 0);
210
  protected $fuchsia     = array(255, 0, 255, 0); // Used as background colors.
211
  protected $transparent = array(0, 0, 0, 127);
212 210
  protected $white       = array(255, 255, 255, 0);
211
  protected $transparent = array(0, 0, 0, 127);
212
  // Used as rotate background colors.
213
  protected $fuchsia            = array(255, 0, 255, 0);
214
  protected $rotate_transparent = array(255, 255, 255, 127);
213 215

  
214 216
  protected $width = 40;
215 217
  protected $height = 20;
......
275 277
    $files = array(
276 278
      'image-test.png',
277 279
      'image-test.gif',
280
      'image-test-no-transparency.gif',
278 281
      'image-test.jpg',
279 282
    );
280 283

  
......
334 337
    // Systems using non-bundled GD2 don't have imagerotate. Test if available.
335 338
    if (function_exists('imagerotate')) {
336 339
      $operations += array(
337
        'rotate_5' => array(
338
          'function' => 'rotate',
339
          'arguments' => array(5, 0xFF00FF), // Fuchsia background.
340
          'width' => 42,
341
          'height' => 24,
342
          'corners' => array_fill(0, 4, $this->fuchsia),
343
        ),
344 340
        'rotate_90' => array(
345 341
          'function' => 'rotate',
346 342
          'arguments' => array(90, 0xFF00FF), // Fuchsia background.
......
348 344
          'height' => 40,
349 345
          'corners' => array($this->fuchsia, $this->red, $this->green, $this->blue),
350 346
        ),
351
        'rotate_transparent_5' => array(
352
          'function' => 'rotate',
353
          'arguments' => array(5),
354
          'width' => 42,
355
          'height' => 24,
356
          'corners' => array_fill(0, 4, $this->transparent),
357
        ),
358 347
        'rotate_transparent_90' => array(
359 348
          'function' => 'rotate',
360 349
          'arguments' => array(90),
......
363 352
          'corners' => array($this->transparent, $this->red, $this->green, $this->blue),
364 353
        ),
365 354
      );
355
      // As of PHP version 5.5, GD uses a different algorithm to rotate images
356
      // than version 5.4 and below, resulting in different dimensions.
357
      // See https://bugs.php.net/bug.php?id=65148.
358
      // For the 40x20 test images, the dimensions resulting from rotation will
359
      // be 1 pixel smaller in both width and height in PHP 5.5 and above.
360
      // @todo: If and when the PHP bug gets solved, add an upper limit
361
      //   version check.
362
      if (version_compare(PHP_VERSION, '5.5', '>=')) {
363
        $operations += array(
364
          'rotate_5' => array(
365
            'function' => 'rotate',
366
            'arguments' => array(5, 0xFF00FF), // Fuchsia background.
367
            'width' => 41,
368
            'height' => 23,
369
            'corners' => array_fill(0, 4, $this->fuchsia),
370
          ),
371
          'rotate_transparent_5' => array(
372
            'function' => 'rotate',
373
            'arguments' => array(5),
374
            'width' => 41,
375
            'height' => 23,
376
            'corners' => array_fill(0, 4, $this->rotate_transparent),
377
          ),
378
        );
379
      }
380
      else {
381
        $operations += array(
382
          'rotate_5' => array(
383
            'function' => 'rotate',
384
            'arguments' => array(5, 0xFF00FF), // Fuchsia background.
385
            'width' => 42,
386
            'height' => 24,
387
            'corners' => array_fill(0, 4, $this->fuchsia),
388
          ),
389
          'rotate_transparent_5' => array(
390
            'function' => 'rotate',
391
            'arguments' => array(5),
392
            'width' => 42,
393
            'height' => 24,
394
            'corners' => array_fill(0, 4, $this->rotate_transparent),
395
          ),
396
        );
397
      }
366 398
    }
367 399

  
368 400
    // Systems using non-bundled GD2 don't have imagefilter. Test if available.
......
430 462
        }
431 463
        // Now check each of the corners to ensure color correctness.
432 464
        foreach ($values['corners'] as $key => $corner) {
465
          // The test gif that does not have transparency has yellow where the
466
          // others have transparent.
467
          if ($file === 'image-test-no-transparency.gif' && $corner === $this->transparent) {
468
            $corner = $this->yellow;
469
          }
433 470
          // Get the location of the corner.
434 471
          switch ($key) {
435 472
            case 0:

Also available in: Unified diff