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 23:27:59 -0000
@@ -560,22 +560,29 @@ 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 maximum filesize for the test.
+        $test_size = 1;
+        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 * 1024)) {
+              break;
+          }
+        }
 
-        // Set new variables: valid dimensions, invalid filesize.
+        // Set valid dimensions for the test.
         $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);
 
@@ -588,6 +595,7 @@ class UserPictureTestCase extends Drupal
         // Check if file is not uploaded.
         $this->assertFalse(is_file($pic_path), t('File was not uploaded.'));
       }
+    }
   }
 
   /**
