Make our raw/ tests actually check the paint output.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1153053012
This commit is contained in:
Hixie
2015-05-28 17:35:59 -07:00
parent 798729bcf4
commit 30035f03b5
4 changed files with 49 additions and 4 deletions

View File

@@ -1,4 +1,12 @@
CONSOLE: unittest-suite-wait-for-done
CONSOLE: TestView enabled
CONSOLE:
PAINT FOR FRAME #1 ----------------------------------------------
1 | TestDisplayList() constructor: 800.0 x 600.0
1 | paintChild at 0.0,0.0
1 | | TestDisplayList() constructor: 800.0 x 600.0
1 | | drawRect(0.0:0.0:600.0:800.0, Paint(0xff00ff00))
------------------------------------------------------------------------
CONSOLE: PASS: should size to render view
CONSOLE:
CONSOLE: All 1 tests passed.

View File

@@ -4,6 +4,7 @@
import '../resources/third_party/unittest/unittest.dart';
import '../resources/unit.dart';
import '../resources/display_list.dart';
import 'dart:sky' as sky;
import 'package:sky/framework/rendering/render_box.dart';
@@ -16,9 +17,11 @@ void main() {
decoration: new BoxDecoration(backgroundColor: 0xFF00FF00)
)
);
RenderView renderView = new RenderView(child: root);
TestView renderView = new TestView(child: root);
renderView.layout(new ViewConstraints(width: sky.view.width, height: sky.view.height));
expect(root.size.width, equals(sky.view.width));
expect(root.size.height, equals(sky.view.height));
renderView.paintFrame();
print(renderView.lastPaint); // TODO(ianh): figure out how to make this fit the unit testing framework better
});
}

View File

@@ -1,4 +1,38 @@
CONSOLE: unittest-suite-wait-for-done
CONSOLE: TestView enabled
CONSOLE:
PAINT FOR FRAME #1 ----------------------------------------------
1 | TestDisplayList() constructor: 800.0 x 600.0
1 | paintChild at 0.0,0.0
1 | | TestDisplayList() constructor: 800.0 x 600.0
1 | | drawRect(0.0:0.0:600.0:800.0, Paint(0xff000000))
1 | | paintChild at 0.0,0.0
1 | | | TestDisplayList() constructor: 800.0 x 600.0
1 | | | drawRect(0.0:0.0:82.5:800.0, Paint(0xffffff00))
1 | | paintChild at 350.0,82.5
1 | | | TestDisplayList() constructor: 800.0 x 600.0
1 | | | drawRect(0.0:0.0:100.0:100.0, Paint(0x7700ffff))
1 | | paintChild at 0.0,182.5
1 | | | TestDisplayList() constructor: 800.0 x 600.0
1 | | | paintChild at 10.0,10.0
1 | | | | TestDisplayList() constructor: 800.0 x 600.0
1 | | | | drawRect(0.0:0.0:150.0:780.0, Paint(0xffffffff))
1 | | | | paintChild at 0.0,0.0
1 | | | | | TestDisplayList() constructor: 800.0 x 600.0
1 | | | | | drawRect(0.0:0.0:50.0:780.0, Paint(0xff00ff00))
1 | | | | paintChild at 0.0,50.0
1 | | | | | TestDisplayList() constructor: 800.0 x 600.0
1 | | | | | drawRect(0.0:0.0:100.0:780.0, Paint(0x7700ffff))
1 | | paintChild at 0.0,352.5
1 | | | TestDisplayList() constructor: 800.0 x 600.0
1 | | | drawRect(0.0:0.0:247.5:800.0, Paint(0xff333333))
1 | | | paintChild at 0.0,0.0
1 | | | | TestDisplayList() constructor: 800.0 x 600.0
1 | | | | drawRect(0.0:0.0:247.5:266.6666564941406, Paint(0x77ff00ff))
1 | | | paintChild at 266.6666666666667,0.0
1 | | | | TestDisplayList() constructor: 800.0 x 600.0
1 | | | | drawRect(0.0:0.0:247.5:533.3333129882812, Paint(0xff0000ff))
------------------------------------------------------------------------
CONSOLE: PASS: should flex
CONSOLE:
CONSOLE: All 1 tests passed.

View File

@@ -4,6 +4,7 @@
import '../resources/third_party/unittest/unittest.dart';
import '../resources/unit.dart';
import '../resources/display_list.dart';
import 'dart:sky' as sky;
import 'package:sky/framework/app.dart';
import 'package:sky/framework/rendering/render_block.dart';
@@ -35,7 +36,7 @@ class RenderSolidColor extends RenderDecoratedBox {
}
}
AppView app;
TestApp app;
void main() {
initUnit();
@@ -86,8 +87,7 @@ void main() {
flexRoot.add(decoratedRow);
decoratedRow.parentData.flex = 3;
app = new AppView(root);
app = new TestApp(root);
expect(root.size.width, equals(sky.view.width));
expect(root.size.height, equals(sky.view.height));