Same name and namespace in other branches
  1. 8.x-1.x tests/exif_orientation.test \ExifOrientationTest::testUserPicture() 1 comment

Test auto rotation of uploaded user profile pictures.

File

tests/exif_orientation.test, line 46

Class

ExifOrientationTest
@file Tests for <a href="/en/work/drupal-api/exif_orientation/exif_orientation.module/7.x-1.x" title="Module file for EXIF Orientation" class="local">exif_orientation.module</a>.

Code

public function testUserPicture() {
    // No user picture style or dimensions.
    variable_set('user_picture_style', '');
    variable_set('user_picture_dimensions', '');
    $user1 = $this->drupalCreateUser();
    $this->saveUserPicture($user1);
    $this->assertImageIsRotated($user1->picture->uri);
    // Applied user picture style.
    variable_set('user_picture_style', 'medium');
    variable_set('user_picture_dimensions', '');
    $user2 = $this->drupalCreateUser();
    $this->saveUserPicture($user2);
    $this->assertImageIsRotated($user2->picture->uri);
    // Defined picture dimensions.
    variable_set('user_picture_style', '');
    variable_set('user_picture_dimensions', '50x50');
    $user3 = $this->drupalCreateUser();
    $this->saveUserPicture($user3);
    $this->assertImageIsRotated($user3->picture->uri);
    // Defined picture style and dimensions.
    variable_set('user_picture_style', 'medium');
    variable_set('user_picture_dimensions', '50x50');
    $user4 = $this->drupalCreateUser();
    $this->saveUserPicture($user4);
    $this->assertImageIsRotated($user4->picture->uri);
}