diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index 6b54c49612f85fc58f2af596ccd64ea856741538..06f13dea1d99042a516b2abf3f14f67330db6511 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -1882,10 +1882,10 @@ function comment_preview($comment) {
     $comment->format = $comment->comment_format;
 
     // Attach the user and time information.
-    if (!empty($edit['author'])) {
-      $account = user_load_by_name($edit['author']);
+    if (!empty($comment->author)) {
+      $account = user_load_by_name($comment->author);
     }
-    elseif ($user->uid && !isset($edit['is_anonymous'])) {
+    elseif ($user->uid && !isset($comment->is_anonymous)) {
       $account = $user;
     }
 
@@ -1897,7 +1897,7 @@ function comment_preview($comment) {
       $comment->name = variable_get('anonymous', t('Anonymous'));
     }
 
-    $comment->timestamp = !empty($edit['timestamp']) ? $edit['timestamp'] : REQUEST_TIME;
+    $comment->timestamp = !empty($comment->timestamp) ? $comment->timestamp : REQUEST_TIME;
     $comment->in_preview = TRUE;
     $comment_build = comment_build($comment);
     $comment_build += array(
diff --git a/modules/comment/comment.test b/modules/comment/comment.test
index 588d7ae82fd752940534a973e3a1325c8ac19ea5..039dbfe6f17f0ee9ae26935c6ddb7ed3d0f009a6 100644
--- a/modules/comment/comment.test
+++ b/modules/comment/comment.test
@@ -361,6 +361,83 @@ class CommentInterfaceTest extends CommentHelperCase {
   }
 }
 
+/**
+ * Test previewing comments.
+ */
+class CommentPreviewTest extends CommentHelperCase {
+  public static function getInfo() {
+    return array(
+      'name' => 'Comment preview',
+      'description' => 'Test comment preview.',
+      'group' => 'Comment',
+    );
+  }
+
+  /**
+   * Test comment preview.
+   */
+  function testCommentPreview() {
+    // As admin user, configure comment settings.
+    $this->drupalLogin($this->admin_user);
+    $this->setCommentPreview(TRUE);
+    $this->setCommentForm(TRUE);
+    $this->setCommentSubject(TRUE);
+    $this->setCommentSettings('comment_default_mode', COMMENT_MODE_THREADED, t('Comment paging changed.'));
+    $this->drupalLogout();
+
+    // As web user, fill in node creation form and preview node.
+    $this->drupalLogin($this->web_user);
+    $edit = array();
+    $edit['subject'] = $this->randomName(8);
+    $edit['comment'] = $this->randomName(16);
+    $this->drupalPost('node/' . $this->node->nid, $edit, t('Preview'));
+
+    // Check that the preview is displaying the title and body.
+    $this->assertTitle(t('Preview comment | Drupal'), t('Page title is "Preview comment".'));
+    $this->assertText($edit['subject'], t('Subject displayed.'));
+    $this->assertText($edit['comment'], t('Comment displayed.'));
+
+    // Check that the title and body fields are displayed with the correct values.
+    $this->assertFieldByName('subject', $edit['subject'], t('Subject field displayed.'));
+    $this->assertFieldByName('comment', $edit['comment'], t('Comment field displayed.'));
+  }
+  
+  /**
+   * Test comment edit and preview.
+   */
+  function testCommentEditPreview() {
+    $web_user = $this->drupalCreateUser(array('access comments', 'post comments', 'post comments without approval'));
+    $this->drupalLogin($this->admin_user);
+    $this->setCommentPreview(TRUE);
+    $this->setCommentForm(TRUE);
+    $this->setCommentSubject(TRUE);
+    $this->setCommentSettings('comment_default_mode', COMMENT_MODE_THREADED, t('Comment paging changed.'));
+    
+    $edit = array();
+    $edit['subject'] = $this->randomName(8);
+    $edit['comment'] = $this->randomName(16);
+    $edit['author'] = $web_user->name;
+    $edit['date'] = '2008-03-02 17:23 +0300';
+    $expected_date = format_date(strtotime($edit['date']));
+    $comment = $this->postComment($this->node, $edit['subject'], $edit['comment'], TRUE);
+    $this->drupalPost('comment/edit/' . $comment->id, $edit, t('Preview'));
+    
+    // Check that the preview is displaying the subject, comment, author and date correctly.
+    $this->assertTitle(t('Preview comment | Drupal'), t('Page title is "Preview comment".'));
+    $this->assertText($edit['subject'], t('Subject displayed.'));
+    $this->assertText($edit['comment'], t('Comment displayed.'));
+    $this->assertText($edit['author'], t('Author displayed.'));
+    $this->assertText($expected_date, t('Date displayed.'));
+
+    // Check that the title and body fields are displayed with the correct values.
+    $this->assertFieldByName('subject', $edit['subject'], t('Subject field displayed.'));
+    $this->assertFieldByName('comment', $edit['comment'], t('Comment field displayed.'));
+    $this->assertFieldByName('author', $edit['author'], t('Author field displayed.'));
+    $this->assertFieldByName('date', $edit['date'], t('Date field displayed.'));
+  }
+
+}
+
 class CommentAnonymous extends CommentHelperCase {
   public static function getInfo() {
     return array(