A simple test the make sure image transformations work as expected (also see
http://dev.plone.org/plone/ticket/8506).  First we create an image and check
the dimensions of the image itself and one of the scales:

  >>> from plone.app.testing import TEST_USER_ID, setRoles
  >>> setRoles(layer['portal'], TEST_USER_ID, ['Manager'])
  >>> from plone.app.imaging.tests.utils import getData
  >>> data = getData('image.jpg')
  >>> portal = layer['portal']
  >>> portal.invokeFactory('Image', id='foo', title='Foo', image=data)
  'foo'

  >>> image = portal['foo']
  >>> image.width, image.height
  (500, 200)
  >>> traverse = portal.REQUEST.traverseName
  >>> scale = traverse(image, 'image_mini')
  >>> scale.width, scale.height
  (200, 80)

Let's also check a custom scale size:

  >>> from plone.app.imaging.tests.base import getSettings
  >>> settings = getSettings()
  >>> settings.allowed_sizes = [u'mini 200:200', u'foo 100:100']
  >>> scale = traverse(image, 'image_foo')
  >>> scale.width, scale.height
  (100, 40)

  >>> from transaction import commit
  >>> commit()

We use a testbrowser to rotate the image:

  >>> from plone.testing.z2 import Browser
  >>> from plone.app.testing import TEST_USER_NAME, TEST_USER_PASSWORD
  >>> browser = Browser(layer['app'])
  >>> browser.addHeader('Authorization', 'Basic %s:%s' % (TEST_USER_NAME, TEST_USER_PASSWORD))
  >>> browser.open('http://nohost/plone/foo/view')
  >>> browser.getLink('Transform').click()
  >>> browser.getControl(name='method').displayValue = ['Rotate 90 clockwise']
  >>> browser.getControl('Execute').click()

Let's check if the image has been rotated — its dimensions should have
switched due to the 90º rotation:

  >>> image = portal['foo']
  >>> image.width, image.height
  (200, 500)

The same should be true for its scales:

  >>> scale = traverse(image, 'image_mini')
  >>> scale.width, scale.height
  (80, 200)
  >>> scale = traverse(image, 'image_foo')
  >>> scale.width, scale.height
  (40, 100)
