zucchini-src/zucchini — pull request #34 by phatmann (2013-08-18 05:20:42+00:00)
Title: Mask orientation

**Description**

The primary purpose of this pull request is to get Zucchini to use the correct masks based on the device's current orientation. It contains the following changes:

1. Every mask can have a landscape and portrait version, by appending _landscape or _portrait to the end of the file name. If an orientation-specific version of the mask is not available, then the generic version is used. For example, assume that the current device specifies ipad_io6 as the screen and the device is in landscape orientation when a screenshot is taken. In this case the ipad_io6_landscape.png global mask file is used if available, otherwise ipad_io6.png is used. The same scheme is used for screen masks and screenshot-specific masks.

2. A screenshot file name no longer contains the screen name and orientation. Instead, this information is extracted from the automation log.

3. The screen masks are stored in support/screens/masks/DEVICE_SCREEN instead of support/masks. This allows screen masks to be provided for each device, just like the screenshot-specific masks.

I have provided tests to cover the new functionality.

**Notes**

I originally was going to use the orientation embedded in the screenshot file name, but this gets stripped out when a screenshot is processed. This means the orientation is not available when later running a comparison via `zucchini run -p`. I also realized that screen-specific masks would not work when using `zucchini run -p` for the same reason. So adding metadata to the filename is a flawed idea.

Instead of embedding metadata in the file name, I am writing the orientation and screen name to the automation log. After the run is completed I parse the log into an easy-to-read YAML file. The YAML file is updated when a screenshot is rotated, to avoid rotating the screenshot again when using `zucchini run -p`.