Commit c66cafb5 authored by Isabella Scalzi's avatar Isabella Scalzi Committed by Commit Bot

[quickview] Add test |openQuickViewImageRawWithOrientation|

Now that piexloader supports using a RAW image's "thumbnail", add a
Quick View test using a RAW .NEF file containing only a "thumbnail"
image. Because the image has an orientation in its metadata, it should
render rotated 90 degrees clockwise.

Also test that the dimensions shown in the metadata box reflect
the rendered orientation of the test image.

Bug: 1039141
Change-Id: I9ac567c3b7af79ef68d2d463ab47ad7844c533d6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2063612
Commit-Queue: Noel Gordon <noel@chromium.org>
Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#742490}
parent 1d0122c1
...@@ -1068,6 +1068,48 @@ ...@@ -1068,6 +1068,48 @@
chrome.test.assertEq('f/8 0.002 12mm ISO200', film); chrome.test.assertEq('f/8 0.002 12mm ISO200', film);
}; };
/**
* Tests opening Quick View on an RAW .NEF image and that the dimensions
* shown in the metadata box respect the image EXIF orientation.
*/
testcase.openQuickViewImageRawWithOrientation = async () => {
const caller = getCaller();
/**
* The <webview> resides in the <files-safe-media type="image"> shadow DOM,
* which is a child of the #quick-view shadow DOM.
*/
const webView =
['#quick-view', 'files-safe-media[type="image"]', 'webview'];
// Open Files app on Downloads containing ENTRIES.rawNef.
const appId =
await setupAndWaitUntilReady(RootPath.DOWNLOADS, [ENTRIES.rawNef], []);
// Open the file in Quick View.
await openQuickView(appId, ENTRIES.rawNef.nameText);
// Wait for the Quick View <webview> to load and display its content.
function checkWebViewImageLoaded(elements) {
let haveElements = Array.isArray(elements) && elements.length === 1;
if (haveElements) {
haveElements = elements[0].styles.display.includes('block');
}
if (!haveElements || elements[0].attributes.loaded !== '') {
return pending(caller, 'Waiting for <webview> to load.');
}
return;
}
await repeatUntil(async () => {
return checkWebViewImageLoaded(await remoteCall.callRemoteTestUtil(
'deepQueryAllElements', appId, [webView, ['display']]));
});
// Check: the Dimensions shown in the metadata box are correct.
const size = await getQuickViewMetadataBoxField(appId, 'Dimensions');
chrome.test.assertEq('1324 x 4028', size);
};
/** /**
* Tests that opening a broken image in Quick View displays the "no-preview * Tests that opening a broken image in Quick View displays the "no-preview
* available" generic icon and has a [load-error] attribute. * available" generic icon and has a [load-error] attribute.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment