Index: modules/simpletest/tests/common.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/common.test,v
retrieving revision 1.3
diff -u -p -r1.3 common.test
--- modules/simpletest/tests/common.test	21 Aug 2008 19:36:38 -0000	1.3
+++ modules/simpletest/tests/common.test	28 Aug 2008 08:31:40 -0000
@@ -137,3 +137,49 @@ class DrupalHTTPRequestTestCase extends 
     $this->assertEqual($unable_to_parse->error, 'unable to parse URL', t('Returned with unable to parse URL error.'));
   }
 }
+
+/**
+ * Test drupal_add_css().
+ */
+class CSSTestCase extends DrupalWebTestCase {
+  /**
+   * Implementation of getInfo().
+   */
+  function getInfo() {
+    return array(
+      'name' => t('Drupal add CSS'),
+      'description' => t('Perform various tests on drupal_add_css().'),
+      'group' => t('System'),
+    );
+  }
+
+  function testDrupalAddCSS() {
+    global $language;
+
+    // Setup language variables for testing RTL support.
+    define('LANGUAGE_RTL', 42);
+    $language->direction = LANGUAGE_RTL;
+
+    // Add a module CSS to the default location.
+    drupal_add_css(drupal_get_path('module', 'block') .'/block.css');
+
+    // Add a module CSS to mobile media with preprocess.
+    drupal_add_css(drupal_get_path('module', 'node') .'/node.css', 'module', 'mobile');
+
+    // Add a module CSS to print media without preprocess.
+    drupal_add_css(drupal_get_path('module', 'block') .'/block.css', 'module', 'print', FALSE);
+
+    // Add a theme CSS to print media.
+    drupal_add_css(drupal_get_path('theme', 'bluemarine') .'/style.css', 'theme', 'print');
+
+    // Pass no parameters and store the entire CSS array.
+    $css = drupal_add_css();
+
+    $this->assertTrue($css['all']['module'][drupal_get_path('module', 'block') .'/block.css'], t('Stylesheet added using default parameters; media = all, type = module, preprocess = TRUE.'), t('System'));
+    $this->assertTrue($css['mobile']['module'][drupal_get_path('module', 'node') .'/node.css'], t('Stylesheet added to mobile media with preprocess.'), t('System'));
+    $this->assertTrue(!$css['print']['module'][drupal_get_path('module', 'block') .'/block.css'], t('Stylesheet added to print media without preprocess.'), t('System'));
+    $this->assertTrue($css['print']['theme'][drupal_get_path('theme', 'bluemarine') .'/style.css'], t('Stylesheet added to print media without preprocess.'), t('System'));
+    $this->assertTrue($css['print']['theme'][drupal_get_path('theme', 'bluemarine') .'/style-rtl.css'], t('Right-to-left stylesheet added to print media without preprocess.'), t('System'));
+  }
+}
+
