Index: modules/simpletest/tests/form.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/form.test,v
retrieving revision 1.7
diff -u -r1.7 form.test
--- modules/simpletest/tests/form.test	31 Mar 2009 01:49:53 -0000	1.7
+++ modules/simpletest/tests/form.test	7 Apr 2009 07:45:06 -0000
@@ -383,3 +383,33 @@
   }
 
 }
+
+/**
+ * Test of Form API behavor of disabled fields.
+ */
+class FormDisabledFieldTestCase extends DrupalWebTestCase {
+
+  public static function getInfo() {
+    return array(
+      'name' => t('Disabled field'),
+      'description' => t('Test of Form API behavor of disabled fields.'),
+      'group' => t('Form API'),
+    );
+  }
+
+  function setUp() {
+    parent::setUp('form_test');
+  }
+
+  /**
+   * Test of Form API behavor of disabled fields.
+   */
+  function testDisabledField() {
+    $edit = array(
+      'form_test_disabled_field' => $this->randomName(),
+    );
+    $this->drupalPost('form_test/disabled_field', array(), t('Save configuration'), array('additional_post' => $edit));
+    $this->assertText(t('The configuration options have been saved.'));
+    $this->assertFieldByName('form_test_disabled_field', $edit['form_test_disabled_field']);
+  }
+}
Index: modules/simpletest/tests/form_test.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/form_test.module,v
retrieving revision 1.3
diff -u -r1.3 form_test.module
--- modules/simpletest/tests/form_test.module	28 Mar 2009 18:09:11 -0000	1.3
+++ modules/simpletest/tests/form_test.module	7 Apr 2009 07:45:06 -0000
@@ -58,6 +58,14 @@
     'type' => MENU_CALLBACK,
   );
 
+  $items['form_test/disabled_field'] = array(
+    'title' => 'Disabled field',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('form_test_disabled_field_form'),
+    'access arguments' => array('access content'),
+    'type' => MENU_CALLBACK,
+  );
+
   return $items;
 }
 
@@ -225,7 +233,7 @@
  * drupal_execute using the values specified in this function.
  *
  * The form's field test_value begins at 'initial_value', and is changed
- * to 'form_submitted' when the form is submitted successfully. On 
+ * to 'form_submitted' when the form is submitted successfully. On
  * completion this function is passed 'done' to complete the process.
  */
 function form_test_drupal_execute_batch_api($arg = '') {
@@ -279,3 +287,18 @@
 function form_test_mock_form_submit($form, &$form_state) {
   variable_set('form_test_mock_submit', $form_state['values']['test_value']);
 }
+
+/**
+ * A settings form with a disabled field on it.
+ */
+function form_test_disabled_field_form($form_state) {
+  $form = array();
+
+  $form['form_test_disabled_field'] = array(
+    '#type' => 'textfield',
+    '#default_value' => variable_get('form_test_disabled_field', ''),
+    '#disabled' => TRUE,
+  );
+
+  return system_settings_form($form);
+}
Index: modules/node/node.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.test,v
retrieving revision 1.19
diff -u -r1.19 node.test
--- modules/node/node.test	31 Mar 2009 01:49:52 -0000	1.19
+++ modules/node/node.test	7 Apr 2009 07:45:05 -0000
@@ -350,7 +350,7 @@
     // Check that the title and body fields are displayed with the correct values.
     $this->assertLink(t('Edit'), 0, t('Edit tab found.'));
     $this->assertFieldByName('title', $edit['title'], t('Title field displayed.'));
-    $this->assertFieldByName('body', '<!--break-->' . $edit['body'], t('Body field displayed.'));
+    $this->assertFieldByName('body', $edit['body'], t('Body field displayed.'));
 
     // Edit the content of the node.
     $edit = array();
@@ -398,7 +398,7 @@
 
     // Check that the title and body fields are displayed with the correct values.
     $this->assertFieldByName('title', $edit['title'], t('Title field displayed.'));
-    $this->assertFieldByName('body', '<!--break-->' . $edit['body'], t('Body field displayed.'));
+    $this->assertFieldByName('body', $edit['body'], t('Body field displayed.'));
   }
 }
 
Index: modules/translation/translation.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/translation/translation.test,v
retrieving revision 1.11
diff -u -r1.11 translation.test
--- modules/translation/translation.test	2 Apr 2009 20:39:45 -0000	1.11
+++ modules/translation/translation.test	7 Apr 2009 07:45:06 -0000
@@ -111,10 +111,13 @@
     }
     else {
       // Ensure that it is enabled.
-      $this->assertTrue(true, 'Language [' . $language_code . '] already installed.');
-      $this->drupalPost(NULL, array('enabled[' . $language_code . ']' => TRUE), t('Save configuration'));
-
-      $this->assertRaw(t('Configuration saved.'), t('Language successfully enabled.'));
+      $this->assertTrue(TRUE, 'Language [' . $language_code . '] already installed.');
+      if (!$this->xpath("//input[@id='edit-enabled-" . $language_code . "' and @checked='checked']")) {
+        $this->drupalPost(NULL, array('enabled[' . $language_code . ']' => TRUE), t('Save configuration'));
+        $this->assertRaw(t('Configuration saved.'), t('Language [' . $language_code . '] successfully enabled.'));
+      } else {
+        $this->assertTrue(TRUE, t('Language [' . $language_code . '] already enabled.'));
+      }
     }
   }
 
Index: modules/simpletest/drupal_web_test_case.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/drupal_web_test_case.php,v
retrieving revision 1.92
diff -u -r1.92 drupal_web_test_case.php
--- modules/simpletest/drupal_web_test_case.php	30 Mar 2009 05:35:35 -0000	1.92
+++ modules/simpletest/drupal_web_test_case.php	7 Apr 2009 07:45:06 -0000
@@ -1114,15 +1114,28 @@
    * @param $submit
    *   Value of the submit button.
    * @param $options
-   *   Options to be forwarded to url().
-   * @param $headers
-   *   An array containing additional HTTP request headers, each formatted as
-   *   "name: value".
-   */
-  protected function drupalPost($path, $edit, $submit, array $options = array(), array $headers = array()) {
+   *   Array with additional options. The following keys can be used:
+   *
+   *   url_options: Array with options for url().
+   *   headers: Array with HTTP headers, each formatted as "name: value".
+   *   additional_post: Array with additional POST data in the format
+   *                    array('key' => 'value').
+   *
+   *   additional_post can be used to send values for disabled form fields.
+   *   Example:
+   *   $options = array('additional_post' => array('disabled_field' => value));
+   */
+  protected function drupalPost($path, $edit, $submit, array $options = array()) {
+
+    $options += array(
+      'url_options' => array(),
+      'headers' => array(),
+      'additional_post' => array(),
+    );
+
     $submit_matches = FALSE;
     if (isset($path)) {
-      $html = $this->drupalGet($path, $options);
+      $html = $this->drupalGet($path, $options['url_options']);
     }
     if ($this->parse()) {
       $edit_save = $edit;
@@ -1139,6 +1152,7 @@
         // We post only if we managed to handle every field in edit and the
         // submit button matches.
         if (!$edit && $submit_matches) {
+          $post += $options['additional_post'];
           if ($upload) {
             // TODO: cURL handles file uploads for us, but the implementation
             // is broken. This is a less than elegant workaround. Alternatives
@@ -1159,7 +1173,7 @@
             }
             $post = implode('&', $post);
           }
-          $out = $this->curlExec(array(CURLOPT_URL => $action, CURLOPT_POST => TRUE, CURLOPT_POSTFIELDS => $post, CURLOPT_HTTPHEADER => $headers));
+          $out = $this->curlExec(array(CURLOPT_URL => $action, CURLOPT_POST => TRUE, CURLOPT_POSTFIELDS => $post, CURLOPT_HTTPHEADER => $options['headers']));
           // Ensure that any changes to variables in the other thread are picked up.
           $this->refreshVariables();
 
@@ -1244,6 +1258,18 @@
     foreach ($elements as $element) {
       // SimpleXML objects need string casting all the time.
       $name = (string) $element['name'];
+
+      // Generate a failue when disabled elements are set, as those cannot be 'successful' (ie. be part
+      // of form submissions), according to:
+      // http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.12
+      if (!empty($element['disabled'])) {
+        if (isset($edit[$name])) {
+          $this->fail(t('Field @name is disabled, sending of disabled fields is not allowed.', array('@name' => $name)));
+        }
+        unset($edit[$name]);
+        continue;
+      }
+
       // This can either be the type of <input> or the name of the tag itself
       // for <select> or <textarea>.
       $type = isset($element['type']) ? (string)$element['type'] : $element->getName();
@@ -1264,7 +1290,7 @@
             }
             break;
           case 'checkbox':
-            // To prevent checkbox from being checked.pass in a FALSE,
+            // To prevent checkbox from being checked, pass in a FALSE,
             // otherwise the checkbox will be set to its value regardless
             // of $edit.
             if ($edit[$name] === FALSE) {
