diff --git a/modules/image/image.test b/modules/image/image.test
index e4b6d37..846ddd1 100644
--- a/modules/image/image.test
+++ b/modules/image/image.test
@@ -1566,3 +1566,47 @@ class ImageFieldDefaultImagesTestCase extends ImageFieldTestCase {
   }
 
 }
+
+/**
+ * Tests image theme functions.
+ */
+class ImageThemeFunctionWebTestCase extends DrupalWebTestCase {
+
+  public static function getInfo() {
+    return array(
+      'name' => 'Image theme functions',
+      'description' => 'Test that the image theme functions work correctly.',
+      'group' => 'Image',
+    );
+  }
+
+  function setUp() {
+    parent::setUp(array('image', 'image_module_test'));
+  }
+
+  /**
+   * Tests usage of the image field formatters.
+   */
+  function testImageFormatterTheme() {
+    // Create an image.
+    $files = $this->drupalGetTestFiles('image');
+    $file = file_save(reset($files));
+
+    // Create a full path and a path fragment.
+    $path = $this->randomName();
+
+    // Create a style.
+    image_style_save(array('name' => 'image_test'));
+    $url = image_style_url('image_test', $file->uri);
+
+    $this->drupalGet('image-theme-test/image-formatter/' . $file->fid . '/' . $path);
+
+    // Test using theme_image_formatter() without an image title, alt text, or
+    // link options.
+    $this->assertTrue($this->xpath('//a[contains(@href, :href)]/img[contains(@src, :url)]', array(':href' => $path, ':url' => $url)), 'theme_image_formatter() correctly renders without title, alt, or path options.');
+
+    // Link the image to a fragment on the page, and not a full URL.
+    $this->assertTrue($this->xpath('//a[contains(@href, :href)]/img[contains(@src, :url)]', array(':href' => '#' . $path, ':url' => $url)), 'theme_image_formatter() correctly renders a link fragment.');
+  }
+
+}
diff --git a/modules/image/tests/image_module_test.module b/modules/image/tests/image_module_test.module
index 766a9d9..fdb3959 100644
--- a/modules/image/tests/image_module_test.module
+++ b/modules/image/tests/image_module_test.module
@@ -39,3 +39,47 @@ function image_module_test_image_effect_info() {
 function image_module_test_null_effect(array &$image, array $data) {
   return TRUE;
 }
+
+/**
+ * Implements hook_menu().
+ */
+function image_module_test_menu() {
+  $items = array();
+
+  $items['image-theme-test/image-formatter/%file/%'] = array(
+    'page callback' => 'image_module_test_image_formatter',
+    'page arguments' => array(2, 3),
+    'access callback' => TRUE,
+  );
+
+  return $items;
+}
+
+/**
+ * Page callback: Tests usage of the image field formatters.
+ */
+function image_module_test_image_formatter($file, $path) {
+  // Test using theme_image_formatter() without an image title, alt text, or
+  // link options.
+  $element = array(
+    '#theme' => 'image_formatter',
+    '#image_style' => 'image_test',
+    '#item' => array(
+      'uri' => $file->uri,
+    ),
+    '#path' => array(
+      'path' => $path,
+    ),
+  );
+  $output['path'] = $element;
+
+  // Link the image to a fragment on the page, and not a full URL.
+  $element['#path']['path'] = '';
+  $element['#path']['options'] = array(
+    'external' => TRUE,
+    'fragment' => $path,
+  );
+
+  $output['fragment'] = $element;
+  return $output;
+}
