Index: modules/user/user.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.test,v
retrieving revision 1.83
diff -u -r1.83 user.test
--- modules/user/user.test	11 Feb 2010 03:19:21 -0000	1.83
+++ modules/user/user.test	24 Feb 2010 21:42:42 -0000
@@ -762,30 +762,29 @@
    * results: The image should be uploaded because ImageGDToolkit resizes the picture
    */
   function testWithGDinvalidDimension() {
-    if ($this->_directory_test)
-      if (image_get_toolkit()) {
-        $this->drupalLogin($this->user);
-
-        $image = current($this->drupalGetTestFiles('image'));
-        $info = image_get_info($image->uri);
-
-        // Set new variables: invalid dimensions, valid filesize (0 = no limit).
-        $test_dim = ($info['width'] - 10) . 'x' . ($info['height'] - 10);
-        variable_set('user_picture_dimensions', $test_dim);
-        variable_set('user_picture_file_size', 0);
-
-        $pic_path = $this->saveUserPicture($image);
-        // Check that the image was resized and is being displayed on the
-        // user's profile page.
-        $text = t('The image was resized to fit within the maximum allowed dimensions of %dimensions pixels.', array('%dimensions' => $test_dim));
-        $this->assertRaw($text, t('Image was resized.'));
-        $alt = t("@user's picture", array('@user' => format_username($this->user)));
-        $style = variable_get('user_picture_style', '');
-        $this->assertRaw(image_style_url($style, $pic_path), t("Image is displayed in user's edit page"));
+    if ($this->_directory_test && image_get_toolkit()) {
+      $this->drupalLogin($this->user);
 
-        // Check if file is located in proper directory.
-        $this->assertTrue(is_file($pic_path), t("File is located in proper directory"));
-      }
+      $image = current($this->drupalGetTestFiles('image'));
+      $info = image_get_info($image->uri);
+
+      // Set new variables: invalid dimensions, valid filesize (0 = no limit).
+      $test_dim = ($info['width'] - 10) . 'x' . ($info['height'] - 10);
+      variable_set('user_picture_dimensions', $test_dim);
+      variable_set('user_picture_file_size', 0);
+
+      $pic_path = $this->saveUserPicture($image);
+      // Check that the image was resized and is being displayed on the
+      // user's profile page.
+      $text = t('The image was resized to fit within the maximum allowed dimensions of %dimensions pixels.', array('%dimensions' => $test_dim));
+      $this->assertRaw($text, t('Image was resized.'));
+      $alt = t("@user's picture", array('@user' => format_username($this->user)));
+      $style = variable_get('user_picture_style', '');
+      $this->assertRaw(image_style_url($style, $pic_path), t("Image is displayed in user's edit page"));
+
+      // Check if file is located in proper directory.
+      $this->assertTrue(is_file($pic_path), t("File is located in proper directory"));
+    }
   }
 
   /**
@@ -796,34 +795,32 @@
    * results: The image should be uploaded because ImageGDToolkit resizes the picture
    */
   function testWithGDinvalidSize() {
-    if ($this->_directory_test)
-      if (image_get_toolkit()) {
+    if ($this->_directory_test && image_get_toolkit()) {
+      $this->drupalLogin($this->user);
+
+      // Images are sorted first by size then by name. We need an image
+      // bigger than 1 KB so we'll grab the last one.
+      $files = $this->drupalGetTestFiles('image');
+      $image = end($files);
+      $info = image_get_info($image->uri);
+
+      // Set new variables: valid dimensions, invalid filesize.
+      $test_dim = ($info['width'] + 10) . 'x' . ($info['height'] + 10);
+      $test_size = 1;
+      variable_set('user_picture_dimensions', $test_dim);
+      variable_set('user_picture_file_size', $test_size);
 
-        $this->drupalLogin($this->user);
+      $pic_path = $this->saveUserPicture($image);
 
-        // Images are sorted first by size then by name. We need an image
-        // bigger than 1 KB so we'll grab the last one.
-        $files = $this->drupalGetTestFiles('image');
-        $image = end($files);
-        $info = image_get_info($image->uri);
-
-        // Set new variables: valid dimensions, invalid filesize.
-        $test_dim = ($info['width'] + 10) . 'x' . ($info['height'] + 10);
-        $test_size = 1;
-        variable_set('user_picture_dimensions', $test_dim);
-        variable_set('user_picture_file_size', $test_size);
-
-        $pic_path = $this->saveUserPicture($image);
-
-        // Test that the upload failed and that the correct reason was cited.
-        $text = t('The specified file %filename could not be uploaded.', array('%filename' => $image->filename));
-        $this->assertRaw($text, t('Upload failed.'));
-        $text = t('The file is %filesize exceeding the maximum file size of %maxsize.', array('%filesize' => format_size(filesize($image->uri)), '%maxsize' => format_size($test_size * 1024)));
-        $this->assertRaw($text, t('File size cited as reason for failure.'));
+      // Test that the upload failed and that the correct reason was cited.
+      $text = t('The specified file %filename could not be uploaded.', array('%filename' => $image->filename));
+      $this->assertRaw($text, t('Upload failed.'));
+      $text = t('The file is %filesize exceeding the maximum file size of %maxsize.', array('%filesize' => format_size(filesize($image->uri)), '%maxsize' => format_size($test_size * 1024)));
+      $this->assertRaw($text, t('File size cited as reason for failure.'));
 
-        // Check if file is not uploaded.
-        $this->assertFalse(is_file($pic_path), t('File was not uploaded.'));
-      }
+      // Check if file is not uploaded.
+      $this->assertFalse(is_file($pic_path), t('File was not uploaded.'));
+    }
   }
 
   /**
@@ -834,30 +831,28 @@
    * results: The image shouldn't be uploaded
    */
   function testWithoutGDinvalidDimension() {
-    if ($this->_directory_test)
-      if (!image_get_toolkit()) {
-
-        $this->drupalLogin($this->user);
+    if ($this->_directory_test && !image_get_toolkit()) {
+      $this->drupalLogin($this->user);
 
-        $image = current($this->drupalGetTestFiles('image'));
-        $info = image_get_info($image->uri);
+      $image = current($this->drupalGetTestFiles('image'));
+      $info = image_get_info($image->uri);
 
-        // Set new variables: invalid dimensions, valid filesize (0 = no limit).
-        $test_dim = ($info['width'] - 10) . 'x' . ($info['height'] - 10);
-        variable_set('user_picture_dimensions', $test_dim);
-        variable_set('user_picture_file_size', 0);
+      // Set new variables: invalid dimensions, valid filesize (0 = no limit).
+      $test_dim = ($info['width'] - 10) . 'x' . ($info['height'] - 10);
+      variable_set('user_picture_dimensions', $test_dim);
+      variable_set('user_picture_file_size', 0);
 
-        $pic_path = $this->saveUserPicture($image);
+      $pic_path = $this->saveUserPicture($image);
 
-        // Test that the upload failed and that the correct reason was cited.
-        $text = t('The specified file %filename could not be uploaded.', array('%filename' => $image->filename));
-        $this->assertRaw($text, t('Upload failed.'));
-        $text = t('The image is too large; the maximum dimensions are %dimensions pixels.', array('%dimensions' => $test_dim));
-        $this->assertRaw($text, t('Checking response on invalid image (dimensions).'));
+      // Test that the upload failed and that the correct reason was cited.
+      $text = t('The specified file %filename could not be uploaded.', array('%filename' => $image->filename));
+      $this->assertRaw($text, t('Upload failed.'));
+      $text = t('The image is too large; the maximum dimensions are %dimensions pixels.', array('%dimensions' => $test_dim));
+      $this->assertRaw($text, t('Checking response on invalid image (dimensions).'));
 
-        // Check if file is not uploaded.
-        $this->assertFalse(is_file($pic_path), t('File was not uploaded.'));
-      }
+      // Check if file is not uploaded.
+      $this->assertFalse(is_file($pic_path), t('File was not uploaded.'));
+    }
   }
 
   /**
@@ -868,30 +863,29 @@
    * results: The image shouldn't be uploaded
    */
   function testWithoutGDinvalidSize() {
-    if ($this->_directory_test)
-      if (!image_get_toolkit()) {
-        $this->drupalLogin($this->user);
-
-        $image = current($this->drupalGetTestFiles('image'));
-        $info = image_get_info($image->uri);
-
-        // Set new variables: valid dimensions, invalid filesize.
-        $test_dim = ($info['width'] + 10) . 'x' . ($info['height'] + 10);
-        $test_size = 1;
-        variable_set('user_picture_dimensions', $test_dim);
-        variable_set('user_picture_file_size', $test_size);
-
-        $pic_path = $this->saveUserPicture($image);
-
-        // Test that the upload failed and that the correct reason was cited.
-        $text = t('The specified file %filename could not be uploaded.', array('%filename' => $image->filename));
-        $this->assertRaw($text, t('Upload failed.'));
-        $text = t('The file is %filesize exceeding the maximum file size of %maxsize.', array('%filesize' => format_size(filesize($image->uri)), '%maxsize' => format_size($test_size * 1024)));
-        $this->assertRaw($text, t('File size cited as reason for failure.'));
+    if ($this->_directory_test && !image_get_toolkit()) {
+      $this->drupalLogin($this->user);
 
-        // Check if file is not uploaded.
-        $this->assertFalse(is_file($pic_path), t('File was not uploaded.'));
-      }
+      $image = current($this->drupalGetTestFiles('image'));
+      $info = image_get_info($image->uri);
+
+      // Set new variables: valid dimensions, invalid filesize.
+      $test_dim = ($info['width'] + 10) . 'x' . ($info['height'] + 10);
+      $test_size = 1;
+      variable_set('user_picture_dimensions', $test_dim);
+      variable_set('user_picture_file_size', $test_size);
+
+      $pic_path = $this->saveUserPicture($image);
+
+      // Test that the upload failed and that the correct reason was cited.
+      $text = t('The specified file %filename could not be uploaded.', array('%filename' => $image->filename));
+      $this->assertRaw($text, t('Upload failed.'));
+      $text = t('The file is %filesize exceeding the maximum file size of %maxsize.', array('%filesize' => format_size(filesize($image->uri)), '%maxsize' => format_size($test_size * 1024)));
+      $this->assertRaw($text, t('File size cited as reason for failure.'));
+
+      // Check if file is not uploaded.
+      $this->assertFalse(is_file($pic_path), t('File was not uploaded.'));
+    }
   }
 
   /**
