Index: modules/simpletest/tests/menu.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/menu.test,v
retrieving revision 1.26
diff -u -p -r1.26 menu.test
--- modules/simpletest/tests/menu.test	14 Dec 2009 20:23:01 -0000	1.26
+++ modules/simpletest/tests/menu.test	29 Dec 2009 21:11:43 -0000
@@ -354,6 +354,39 @@ class MenuRouterTestCase extends DrupalW
     $this->assertRaw('title="Test title attribute"', t('Title attribute of a menu link renders.'));
     $this->assertRaw('testparam=testvalue', t('Query parameter added to menu link.'));
   }
+  
+  /**
+  * Tests the possible ways to set the title for menu items.
+  * Also tests that menu item titles work with string overrides.
+  */
+  function testMenuItemTitlesCases() {
+
+    // Build array with string overrides.
+    $test_data = array(
+      1 => array('Example title - Case 1' => 'Alternative example title - Case 1'),
+      2 => array('Example @sub1 - Case @op2' => 'Alternative example @sub1 - Case @op2'),
+      3 => array('Example title' => 'Alternative example title'),
+      4 => array('Example title' => 'Alternative example title'),
+    );
+
+    foreach ($test_data as $case_no => $override) {
+      $this->menuItemTitlesCasesHelper($case_no);
+      variable_set('locale_custom_strings_en', array('' => $override));
+      $this->menuItemTitlesCasesHelper($case_no, TRUE);
+      variable_set('locale_custom_strings_en', array());
+    }
+  }
+
+  /**
+  * Get a url and assert the title given a case number. If override is true,
+  * the title is asserted to begin with "Alternative".
+  */
+  private function menuItemTitlesCasesHelper($case_no, $override = FALSE) {
+    $this->drupalGet('menu-title-test/case' . $case_no);
+    $this->assertResponse(200);
+    $asserted_title = $override ? 'Alternative example title - Case ' . $case_no : 'Example title - Case ' . $case_no;
+    $this->assertTitle($asserted_title . ' | Drupal', t('Menu title is') . ': ' . $asserted_title, 'Menu');
+  }
 }
 
 /**
Index: modules/simpletest/tests/menu_test.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/menu_test.module,v
retrieving revision 1.11
diff -u -p -r1.11 menu_test.module
--- modules/simpletest/tests/menu_test.module	14 Dec 2009 20:23:01 -0000	1.11
+++ modules/simpletest/tests/menu_test.module	29 Dec 2009 21:11:44 -0000
@@ -24,6 +24,34 @@ function menu_test_menu() {
     'page callback' => 'menu_test_callback',
     'access arguments' => array('access content'),
   );
+  
+  $items['menu-title-test/case1'] = array(
+   'title' => 'Example title - Case 1',
+   'access callback' => TRUE,
+   'page callback' => 'menu_test_callback',
+  );
+  $items['menu-title-test/case2'] = array(
+   'title' => 'Example @sub1 - Case @op2',
+   // If '2' is not in quotes, the argument becomes arg(2).
+   'title arguments' => array('@sub1' => 'title', '@op2' => '2'),
+   'access callback' => TRUE,
+   'page callback' => 'menu_test_callback',
+  );
+  $items['menu-title-test/case3'] = array(
+   'title' => 'Example title',
+   'title callback' => 'menu_test_title_callback',
+   'access callback' => TRUE,
+   'page callback' => 'menu_test_callback',
+  );
+  $items['menu-title-test/case4'] = array(
+   // Title gets completely ignored. Good thing, too.
+   'title' => 'Bike sheds full of blue smurfs',
+   'title callback' => 'menu_test_title_callback',
+   // If '4' is not in quotes, the argument becomes arg(4).
+   'title arguments' => array('Example title', '4'),
+   'access callback' => TRUE,
+   'page callback' => 'menu_test_callback',
+  );
 
   // Hidden link for menu_link_maintain tests
   $items['menu_test_maintain/%'] = array(
@@ -174,7 +202,19 @@ function menu_test_menu() {
  *  A random string.
  */
 function menu_test_callback() {
-  return $this->randomName();
+  return t('Menu test page');
+}
+
+/**
+ * Concatenates a string, by using the t() function and a case number.
+ *
+ * @param $title
+ *   Title string.
+ * @param $case_number
+ *   The current case number which is tests (defaults to 3).
+ */
+function menu_test_title_callback($title, $case_no = 3) {
+  return t($title) . ' - Case ' . $case_no;
 }
 
 /**
