summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDavid Rothstein <drothstein@gmail.com>2015-10-12 01:14:45 -0400
committerDavid Rothstein <drothstein@gmail.com>2015-10-12 01:14:45 -0400
commite344d465b2e8c7dd4e812dbecfd29a10c6f2066e (patch)
tree3f203bfec9a897c9d23852e6d716998853774f3d /modules
parenta70cff3ed4a9cb2ff11164314bcad74e22b45ce7 (diff)
downloadbrdo-e344d465b2e8c7dd4e812dbecfd29a10c6f2066e.tar.gz
brdo-e344d465b2e8c7dd4e812dbecfd29a10c6f2066e.tar.bz2
Issue #1737714 by legovaer, rlhawk: Help text does not display when editing an image effect
Diffstat (limited to 'modules')
-rw-r--r--modules/image/image.module2
-rw-r--r--modules/image/image.test70
2 files changed, 71 insertions, 1 deletions
diff --git a/modules/image/image.module b/modules/image/image.module
index fac8de955..dd71253d5 100644
--- a/modules/image/image.module
+++ b/modules/image/image.module
@@ -64,7 +64,7 @@ function image_help($path, $arg) {
$effect = image_effect_definition_load($arg[7]);
return isset($effect['help']) ? ('<p>' . $effect['help'] . '</p>') : NULL;
case 'admin/config/media/image-styles/edit/%/effects/%':
- $effect = ($arg[5] == 'add') ? image_effect_definition_load($arg[6]) : image_effect_load($arg[6], $arg[4]);
+ $effect = ($arg[5] == 'add') ? image_effect_definition_load($arg[6]) : image_effect_load($arg[7], $arg[5]);
return isset($effect['help']) ? ('<p>' . $effect['help'] . '</p>') : NULL;
}
}
diff --git a/modules/image/image.test b/modules/image/image.test
index 359197948..87d803a53 100644
--- a/modules/image/image.test
+++ b/modules/image/image.test
@@ -78,6 +78,24 @@ class ImageFieldTestCase extends DrupalWebTestCase {
}
/**
+ * Create a random style.
+ *
+ * @return array
+ * A list containing the details of the generated image style.
+ */
+ function createRandomStyle() {
+ $style_name = strtolower($this->randomName(10));
+ $style_label = $this->randomString();
+ image_style_save(array('name' => $style_name, 'label' => $style_label));
+ $style_path = 'admin/config/media/image-styles/edit/' . $style_name;
+ return array(
+ 'name' => $style_name,
+ 'label' => $style_label,
+ 'path' => $style_path,
+ );
+ }
+
+ /**
* Upload an image to a node.
*
* @param $image
@@ -470,6 +488,58 @@ class ImageEffectsUnitTest extends ImageToolkitTestCase {
}
/**
+ * Tests the administrative user interface.
+ */
+class ImageAdminUiTestCase extends ImageFieldTestCase {
+ public static function getInfo() {
+ return array(
+ 'name' => 'Administrative user interface',
+ 'description' => 'Tests the forms used in the administrative user interface.',
+ 'group' => 'Image',
+ );
+ }
+
+ function setUp() {
+ parent::setUp(array('image'));
+ }
+
+ /**
+ * Test if the help text is available on the add effect form.
+ */
+ function testAddEffectHelpText() {
+ // Create a random image style.
+ $style = $this->createRandomStyle();
+
+ // Open the add effect form and check for the help text.
+ $this->drupalGet($style['path'] . '/add/image_crop');
+ $this->assertText(t('Cropping will remove portions of an image to make it the specified dimensions.'), 'The image style effect help text was displayed on the add effect page.');
+ }
+
+ /**
+ * Test if the help text is available on the edit effect form.
+ */
+ function testEditEffectHelpText() {
+ // Create a random image style.
+ $random_style = $this->createRandomStyle();
+
+ // Add the crop effect to the image style.
+ $edit = array();
+ $edit['data[width]'] = 20;
+ $edit['data[height]'] = 20;
+ $this->drupalPost($random_style['path'] . '/add/image_crop', $edit, t('Add effect'));
+
+ // Open the edit effect form and check for the help text.
+ drupal_static_reset('image_styles');
+ $style = image_style_load($random_style['name']);
+
+ foreach ($style['effects'] as $ieid => $effect) {
+ $this->drupalGet($random_style['path'] . '/effects/' . $ieid);
+ $this->assertText(t('Cropping will remove portions of an image to make it the specified dimensions.'), 'The image style effect help text was displayed on the edit effect page.');
+ }
+ }
+}
+
+/**
* Tests creation, deletion, and editing of image styles and effects.
*/
class ImageAdminStylesUnitTest extends ImageFieldTestCase {