--- tests/block.test	2009-05-27 20:13:43.000000000 +0100
+++ tests/block.test	2014-11-25 21:42:08.000000000 +0000
@@ -8,6 +8,9 @@
  */
 
 class BlockTestCase extends DrupalWebTestCase {
+
+  protected $admin_user;
+
   /**
    * Implementation of getInfo().
    */
@@ -26,8 +29,8 @@ class BlockTestCase extends DrupalWebTes
     parent::setUp();
 
     // Create and login user
-    $admin_user = $this->drupalCreateUser(array('administer blocks'));
-    $this->drupalLogin($admin_user);
+    $this->admin_user = $this->drupalCreateUser(array('administer blocks'));
+    $this->drupalLogin($this->admin_user);
   }
 
   /**
@@ -114,5 +117,71 @@ class BlockTestCase extends DrupalWebTes
     $this->drupalPost('admin/build/block/configure/'. $block['module'] .'/'. $block['delta'], array('title' => 'Navigation'), t('Save block'));
     $this->assertText(t('The block configuration has been saved.'), t('Block title set.'));
   }
-}
 
+  /**
+   * Test configuring and moving a module-define block to specific regions.
+   */
+  function testBlockSettingsWithSecondTheme() {
+    // Set the default theme to bluemarine
+    variable_set('theme_default', 'bluemarine');
+    $theme_default = variable_get('theme_default', 'none');
+    
+    $block = array();
+    $block['module'] = 'user';
+    $block['delta'] = 3; // This is the 'Whos Online' block.
+    
+    $config = array(
+      'title' => 'Customised title for Who is online', 
+      'custom' => 1,
+      'visibility' => 1,
+      'pages' => 'user/*',
+    );
+
+    // Change block settings and confirm that interface works.
+    // Seems that the first edit in a test does nothing. So do an empty edit before the real one.
+    $this->drupalPost('admin/build/block/configure/'. $block['module'] .'/'. $block['delta'], array(), t('Save block'));
+    $this->drupalPost('admin/build/block/configure/'. $block['module'] .'/'. $block['delta'], $config, t('Save block'));  
+    $this->assertText(t('The block configuration has been saved.'), 'Block title and other settings changed.');
+    
+    // Check that the block is in the database.
+    $bid = db_result(db_query("SELECT bid FROM {blocks} WHERE module = '%s' AND delta = '%s'", array($block['module'], $block['delta'])));
+    $this->assertNotNull($bid, 'Block found in database');
+
+    // Display the block configure page - for visual debug.
+    $this->drupalGet('admin/build/block/configure/'. $block['module'] .'/'. $block['delta']);
+    
+    // Assign the block to a specific region.
+    $edit = array();
+    $edit[$block['module'] .'_'. $block['delta'] .'[region]'] = 'right';
+    $edit[$block['module'] .'_'. $block['delta'] .'[theme]'] = $theme_default;
+    $this->drupalPost('admin/build/block', $edit, t('Save blocks'));
+
+    // Confirm that the block is shown on the user page.
+    $this->drupalGet('user/' . $this->admin_user->uid);
+    $this->assertRaw('id="block-' . $block['module'] . '-' . $block['delta'] . '"', 'The block is shown on the user account page.');
+    $this->assertText($config['title'], 'The correct customised title is shown on the user account page.');
+    // Confirm that the box is NOT shown on the front page.
+    $this->drupalGet('node');
+    $this->assertNoRaw('id="block-' . $block['module'] . '-' . $block['delta'] . '"', 'The block is not shown on the front page.');
+
+    // Set default to an alternative theme.
+    variable_set('theme_default', 'garland');
+    $theme_default = variable_get('theme_default', '');
+    
+    // Assign the block to a specific region.
+    $edit = array();
+    $edit[$block['module'] .'_'. $block['delta'] .'[region]'] = 'right';
+    $edit[$block['module'] .'_'. $block['delta'] .'[theme]'] = $theme_default;
+    $this->drupalPost('admin/build/block', $edit, t('Save blocks'));
+        
+    // Confirm that the block is shown on the user page.
+    $this->drupalGet('user/' . $this->admin_user->uid);
+    $this->assertRaw('id="block-' . $block['module'] . '-' . $block['delta'] . '"', 'The block is shown on the user account page.');
+    $this->assertText($config['title'], 'The correct customised title is shown on the user account page.');
+    // Confirm that the box is NOT shown on the front page.
+    $this->drupalGet('node');
+    $this->assertNoRaw('id="block-' . $block['module'] . '-' . $block['delta'] . '"', 'The block is not shown on the front page.');
+
+  }
+
+}
