Index: modules/user/user.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.test,v
retrieving revision 1.27
diff -u -r1.27 user.test
--- modules/user/user.test	31 Jan 2009 16:50:57 -0000	1.27
+++ modules/user/user.test	9 Feb 2009 05:54:31 -0000
@@ -499,7 +499,7 @@
     // Enable user pictures.
     variable_set('user_pictures', 1);
 
-    $this->user = $this->drupalCreateUser();
+    $this->user = $this->drupalCreateUser(array('access user profiles'));
 
     // Test if directories specified in settings exist in filesystem.
     $file_dir = file_directory_path();
@@ -548,7 +548,8 @@
         $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' => $this->user->name));
-        $this->assertRaw(theme('image', $pic_path, $alt, $alt, '', FALSE), t("Image is displayed in user's profile page"));
+        $this->drupalGet('user');
+        $this->assertRaw($this->themeUserPicture($this->user), t("Image is displayed in user's profile page."));
 
         // Check if file is located in proper directory.
         $this->assertTrue(is_file($pic_path), t("File is located in proper directory"));
@@ -678,10 +679,11 @@
 
       $pic_path = $this->saveUserPicture($image);
 
-      // check if image is displayed in user's profile page
-      $this->assertRaw($pic_path, t("Image is displayed in user's profile page"));
+      // Check if image is displayed in user's profile page.
+      $this->drupalGet('user');
+      $this->assertRaw($this->themeUserPicture($this->user), t("Image is displayed in user's profile page."));
 
-      // check if file is located in proper directory
+      // Check if file is located in proper directory.
       $this->assertTrue(is_file($pic_path), t('File is located in proper directory'));
     }
   }
@@ -696,6 +698,21 @@
 
     return $pic_path;
   }
+
+  /**
+   * Theme a user picture as if we were on the user page.
+   *
+   * Because theme('user_picture') adds an "active" class while on the profile
+   * page, we have to to fake the $_GET['q'] variable while theming.
+   */
+  private function themeUserPicture($account) {
+    $account = user_load($account->uid);
+    $q = $_GET['q'];
+    $_GET['q'] = 'user/' . $account->uid;
+    $output = theme('user_picture', $account);
+    $_GET['q'] = $q;
+    return $output;
+  }
 }
 
 
Index: modules/user/user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.module,v
retrieving revision 1.962
diff -u -r1.962 user.module
--- modules/user/user.module	3 Feb 2009 18:55:32 -0000	1.962
+++ modules/user/user.module	9 Feb 2009 05:54:30 -0000
@@ -767,7 +767,7 @@
  */
 function user_user_view(&$edit, &$account, $category = NULL) {
   $account->content['user_picture'] = array(
-    '#value' => theme('user_picture', $account),
+    '#markup' => theme('user_picture', $account),
     '#weight' => -10,
   );
   if (!isset($account->content['summary'])) {
