facebookarchive / ios-snapshot-test-case

Snapshot view unit tests for iOS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Render in fixed resolution (dpi / context scale)

werediver opened this issue · comments

At the moment the framework renders test images in the device-specific resolution (dpi / context scale).

// the scale factor is set to the scale factor of the device’s main screen
UIGraphicsBeginImageContextWithOptions(bounds.size, NO, 0);

To allow snapshot-tests to run on both 2x and 3x devices we record and store snapshots for both 2x and 3x devices. This takes time and loads the repository with snapshots identical up to dpi.

I wonder whether the framework will work correctly with a fixed context scale (e.g. 2x)? Are there any pitfalls and/or performance issues?

I appreciate any comments regarding the question.

The pull-request #166 enables context scale manipulation, thus also allowing device-independent snapshot tests.

Still the question is whether it's practical to do fixed-scale / device-independent snapshot tests?