FUNCTIONAL DOCTEST
------------------

SETUP

    >>> self.setRoles(('Manager',))
    >>> browser = self.getBrowser()
    >>> browser.open(portal.absolute_url())
    >>> image = self.test_image

ADD IMAGE

    >>> browser.handleErrors = False
    >>> browser.getLink(url='createObject?type_name=RichImage').click()
    >>> browser.getControl(name='title').value = 'Foo'
    >>> browser.getControl(name='image_file').mech_control.add_file(image, filename='foo.png')
    >>> browser.getControl('Save').click()

    >>> browser.url
    'http://nohost/plone/foo.../view'
    >>> browser.contents
    '...Info...Changes saved...
     ...Foo...
     ...<img src="http://nohost/plone/foo.../image_preview"...title="Foo"...
     ...Click to view full-size...Size...3.5 kB...'

EDIT IMAGE

    >>> browser.getLink('Edit').click()
    >>> browser.getControl(name='title').value = 'Foobar'
    >>> browser.getControl('Replace with new image').selected = True
    >>> browser.getControl(name='image_file').mech_control.add_file(self.test_image_small, filename='foobar.png')
    >>> browser.getControl('Save').click()

    >>> browser.url
    'http://nohost/plone/foo.../view'
    >>> browser.contents
    '...Info...Changes saved...
     ...Foobar...
     ...<img src="http://nohost/plone/foo.../image_preview"...title="Foobar"...
     ...Click to view full-size...Size...1 kB...'

CROP IMAGE

    >>> browser.getLink('Edit').click()
    >>> browser.contents
    '...Crops...
    ...category...'

    >>> browser.getLink(id='category_crop_edit').click()
    >>> browser.getControl(name='crop').value = 'category'
    >>> browser.getControl(name='x1').value = '0'
    >>> browser.getControl(name='x2').value = '1'
    >>> browser.getControl(name='y1').value = '0'
    >>> browser.getControl(name='y2').value = '1'
    >>> browser.getControl(name='cropScale').value = '1'
    >>> browser.getControl(name='recrop').click()
    >>> browser.contents
    '...Crop saved...
    ...<img src="http://nohost/plone/foo.../image_category"...title="Foobar"...height="159" width="209"...'

