mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Make a reftest for the flights app.
This way we get some broad pixel test coverage. Do this by dumping the png from the flights app, uploading it to google storage and then having the reference file load the uploaded file. This isn't a good long-term solution. Long-term we should dump paint commands (or some other textual representation) and/or make more targetted reftests that don't need pngs. As such, the process for doing this is painful and manual. If we decide we want to have pixel tests properly, we'll want to do something more automated obviously. Also, turn on the discard_transparency bool when encoding the pngs. Otherwise, the png is lossy and none of this works. R=esprehn@chromium.org Review URL: https://codereview.chromium.org/836363003
This commit is contained in:
parent
8bdd05a389
commit
9629178ee6
24
HACKING.md
24
HACKING.md
@ -41,3 +41,27 @@ describe('My pretty test of my subject', function() {
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
Adding pixel tests
|
||||
------------------
|
||||
|
||||
Sky does not have proper pixel tests. Instead we have only reftests.
|
||||
If you want a pixel test, you need to dump the png from a reftest,
|
||||
upload it to googlestorage and then put and <img> pointing to the
|
||||
uploaded file in the reference.
|
||||
|
||||
1. Create your test (e.g. foo.sky).
|
||||
2. Create an dummy reference file (foo-expected.sky).
|
||||
3. Run the test (it will fail).
|
||||
4. Copy the -actual.png file to googlestorage (see below).
|
||||
5. Put an <img> pointing to your newly uploaded png in the reference file.
|
||||
|
||||
Copying the file to googlestorage:
|
||||
$ sha1sum ../out/Debug/layout-test-results/framework/flights-app-pixels-actual.png
|
||||
db0508cdfe69e996a93464050dc383f6480f1283 ../out/Debug/layout-test-results/framework/flights-app-pixels-actual.png
|
||||
$ gsutil.py cp ../out/Debug/layout-test-results/framework/flights-app-pixels-actual.png gs://mojo/sky-pngs/db0508cdfe69e996a93464050dc383f6480f1283
|
||||
|
||||
Long-term, we should not have these tests at all and should just
|
||||
dump paint commands. In the short-term, if we find we're doing this
|
||||
a lot we should obviously automate this process, e.g. test_sky could
|
||||
do all of this work, including spitting out the correct reference file.
|
||||
|
||||
@ -22,7 +22,7 @@ DisplayDelegate* DisplayDelegateBitmap::create(LayerClient* client) {
|
||||
}
|
||||
|
||||
void DisplayDelegateBitmap::GetPixelsForTesting(std::vector<unsigned char>* pixels) {
|
||||
gfx::PNGCodec::EncodeBGRASkBitmap(bitmap_, false, pixels);
|
||||
gfx::PNGCodec::EncodeBGRASkBitmap(bitmap_, true, pixels);
|
||||
}
|
||||
|
||||
void DisplayDelegateBitmap::Paint(mojo::GaneshSurface& surface, const gfx::Rect& size) {
|
||||
|
||||
13
tests/framework/flights-app-pixels-expected.sky
Normal file
13
tests/framework/flights-app-pixels-expected.sky
Normal file
@ -0,0 +1,13 @@
|
||||
<sky>
|
||||
<import src="../resources/run-after-display.sky" as="runAfterDisplay" />
|
||||
|
||||
<img src="http://storage.googleapis.com/mojo/sky-pngs/db0508cdfe69e996a93464050dc383f6480f1283" />
|
||||
|
||||
<script>
|
||||
window.addEventListener('load', function() {
|
||||
runAfterDisplay(function() {
|
||||
internals.notifyTestComplete("");
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</sky>
|
||||
13
tests/framework/flights-app-pixels.sky
Normal file
13
tests/framework/flights-app-pixels.sky
Normal file
@ -0,0 +1,13 @@
|
||||
<sky>
|
||||
<import src="../resources/run-after-display.sky" as="runAfterDisplay" />
|
||||
<import src="/sky/examples/flights-app/flights-app.sky" />
|
||||
<script>
|
||||
addEventListener("load", function() {
|
||||
var app = document.createElement("flights-app");
|
||||
document.querySelector("sky").appendChild(app);
|
||||
runAfterDisplay(function() {
|
||||
internals.notifyTestComplete("");
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</sky>
|
||||
Loading…
x
Reference in New Issue
Block a user