Index: modules/user/user.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.test,v
retrieving revision 1.29
diff -u -p -r1.29 user.test
--- modules/user/user.test	22 Feb 2009 17:55:30 -0000	1.29
+++ modules/user/user.test	2 Mar 2009 22:37:10 -0000
@@ -560,34 +560,40 @@ class UserPictureTestCase extends Drupal
    *  GD Toolkit is installed
    *  Picture has invalid size
    *
-   * results: The image should be uploaded because ImageGDToolkit resizes the picture
+   * results: The image should fail because the file is too big.
    */
   function testWithGDinvalidSize() {
-    if ($this->_directory_test)
+    if ($this->_directory_test) {
       if (image_get_toolkit()) {
 
         $this->drupalLogin($this->user);
 
-        $image = current($this->drupalGetTestFiles('image'));
-        $info = image_get_info($image->filepath);
-
         // Set new variables: valid dimensions, invalid filesize.
         $test_dim = ($info['width'] + 10) . 'x' . ($info['height'] + 10);
-        $test_size = 1;
+        $test_size = 1024;
         variable_set('user_picture_dimensions', $test_dim);
         variable_set('user_picture_file_size', $test_size);
+        
+        // Make sure the file is bigger than what we've set as the max.
+        foreach ($this->drupalGetTestFiles('image') as $image) {
+          $info = image_get_info($image->filepath);
+          if ($info['file_size'] > $test_size) {
+              break;
+          }
+        }
 
         $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->filepath)), '%maxsize' => format_size($test_size * 1024)));
+        $text = t('The file is %filesize exceeding the maximum file size of %maxsize.', array('%filesize' => format_size(filesize($image->filepath)), '%maxsize' => format_size($test_size)));
         $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.'));
       }
+    }
   }
 
   /**
