? sites/all/modules/devel
? sites/default/files
? sites/default/private
? sites/default/settings.php
Index: modules/system/system.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.admin.inc,v
retrieving revision 1.262
diff -u -p -r1.262 system.admin.inc
--- modules/system/system.admin.inc	7 Mar 2010 07:36:27 -0000	1.262
+++ modules/system/system.admin.inc	15 Mar 2010 13:54:50 -0000
@@ -425,10 +425,12 @@ function system_theme_default() {
     if (!empty($themes[$theme])) {
       // Enable the theme if it is currently disabled.
       if (empty($themes[$theme]->status)) {
-       theme_enable(array($theme));
+        theme_enable(array($theme));
       }
       // Set the default theme.
       variable_set('theme_default', $theme);
+      // Rebuild the menu cache so that theme related menu items are refreshed.
+      menu_rebuild();
       // The status message depends on whether an admin theme is currently in use:
       // a value of 0 means the admin theme is set to be the default theme.
       $admin_theme = variable_get('admin_theme', 0);
Index: modules/system/system.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.test,v
retrieving revision 1.117
diff -u -p -r1.117 system.test
--- modules/system/system.test	12 Mar 2010 14:33:02 -0000	1.117
+++ modules/system/system.test	15 Mar 2010 13:54:51 -0000
@@ -1246,7 +1246,7 @@ class SystemThemeFunctionalTest extends 
   function setUp() {
     parent::setUp();
 
-    $this->admin_user = $this->drupalCreateUser(array('access administration pages', 'administer themes', 'bypass node access'));
+    $this->admin_user = $this->drupalCreateUser(array('access administration pages', 'administer themes', 'bypass node access', 'administer blocks'));
     $this->drupalLogin($this->admin_user);
     $this->node = $this->drupalCreateNode();
   }
@@ -1329,6 +1329,26 @@ class SystemThemeFunctionalTest extends 
     $this->drupalGet('node/add');
     $this->assertRaw('themes/garland', t('Site default theme used on the add content page.'));
   }
+
+  /**
+   * Test switching the deafult theme.
+   */
+  function testSwitchDefaultTheme() {
+    // Enable "stark" and set it as the default theme.
+    theme_enable(array('stark'));
+    $this->drupalGet('admin/appearance');
+    $this->clickLink(t('Set default'), 1);
+    $this->assertTrue(variable_get('theme_default', '') == 'stark', t('Site default theme switched successfully.'));
+
+    // Test the default theme on the secondary links (blocks admin page).
+    $this->drupalGet('admin/structure/block');
+    $this->assertText('Stark (' . t('active tab') . ')', t('Active menu item on blocks admin page is the default theme.'));
+    // Switch back to Garland and test again to test that the menu cache is cleared.
+    $this->drupalGet('admin/appearance');
+    $this->clickLink(t('Set default'), 0);
+    $this->drupalGet('admin/structure/block');
+    $this->assertText('Garland (' . t('active tab') . ')', t('Active menu item on blocks admin page has changed.'));
+  }
 }
 
 
