Skip to content

Commit

Permalink
test: add snapshot image tests for rgba w/o alpha value
Browse files Browse the repository at this point in the history
  • Loading branch information
m1ga authored and sgtcoolguy committed Feb 3, 2021
1 parent 0dd7429 commit 51587b8
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 1 deletion.
14 changes: 13 additions & 1 deletion build/lib/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,19 @@ async function test(platforms, target, deviceId, deployType, deviceFamily, snaps

// If we're gathering images, make sure we get them all before we move on
if (snapshotPromises.length !== 0) {
await Promise.all(snapshotPromises);
try {
await Promise.all(snapshotPromises);
} catch (err) {
// If grabbing an image fails, can we report more details about why?
// The rejected error should have stdout/stderr properties
if (err.stderr) {
console.error(err.stderr);
}
if (err.stdout) {
console.log(err.stdout);
}
throw err;
}
}

return results;
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions tests/Resources/ti.ui.view.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1322,4 +1322,37 @@ describe('Titanium.UI.View', function () {
const view2 = Ti.UI.createView({ filterTouchesWhenObscured: true });
should(view2.filterTouchesWhenObscured).be.true();
});

it('rgba fallback', finish => {
if (isCI && utilities.isMacOS()) { // some of the CI mac nodes lie about their scale, which makes the image comparison fail
return finish(); // FIXME: skip when we move to official mocha package
}
win = Ti.UI.createWindow({ backgroundColor: '#fff' });
const rgbaView = Ti.UI.createView({
width: 100,
height: 100,
backgroundColor: 'rgba(255,0,0)',
left: 0
});
const rgbView = Ti.UI.createView({
width: 100,
height: 100,
backgroundColor: 'rgb(0,255,0)',
left: 100
});

win.addEventListener('postlayout', function postlayout() { // FIXME: Support once!
win.removeEventListener('postlayout', postlayout); // only run once
try {
should(rgbaView).matchImage('snapshots/rgbaView_red.png');
should(rgbView).matchImage('snapshots/rgbView_green.png');
} catch (err) {
return finish(err);
}
finish();
});
win.add(rgbaView);
win.add(rgbView);
win.open();
});
});

0 comments on commit 51587b8

Please sign in to comment.