Commit 02ebc4fa authored by Adam Barth's avatar Adam Barth

Remove some unused dart:sky IDLs

This CL deletes a bunch of unused IDL files and removes some dead code in the
engine.
parent e72a66ec
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:sky';
PaintingNode paintingNode = null;
Picture draw(int a, int r, int g, int b) {
final double devicePixelRatio = view.devicePixelRatio;
Size size = new Size(view.width, view.height);
PictureRecorder recorder = new PictureRecorder();
Canvas canvas = new Canvas(recorder, new Rect.fromLTRB(0.0, 0.0, view.width * devicePixelRatio, view.height * devicePixelRatio));
canvas.scale(devicePixelRatio, devicePixelRatio);
double radius = size.shortestSide * 0.45;
Paint paint = new Paint()..color = new Color.fromARGB(a, r, g, b);
canvas.drawCircle(size.center(Point.origin), radius, paint);
if (paintingNode == null) {
paintingNode = new PaintingNode();
Paint innerPaint = new Paint()..color = new Color.fromARGB(a, 255 - r, 255 - g, 255 - b);
PictureRecorder innerRecorder = new PictureRecorder();
Canvas innerCanvas = new Canvas(innerRecorder, Point.origin & size);
innerCanvas.drawCircle(size.center(Point.origin), radius * 0.5, innerPaint);
paintingNode.setBackingDrawable(innerRecorder.endRecordingAsDrawable());
}
canvas.drawPaintingNode(paintingNode, Point.origin);
return recorder.endRecording();
}
bool handleEvent(Event event) {
if (event.type == "pointerdown") {
view.picture = draw(255, 0, 0, 255);
view.scheduleFrame();
return true;
}
if (event.type == "pointerup") {
view.picture = draw(255, 0, 255, 0);
view.scheduleFrame();
return true;
}
return false;
}
void main() {
view.picture = draw(255, 0, 255, 0);
view.scheduleFrame();
view.setEventCallback(handleEvent);
}
import 'dart:sky';
import 'package:test/test.dart';
void main() {
var div;
setUp(() {
var document = new Document();
div = document.createElement("div");
});
test("should get by index", () {
div.setAttribute("attr0", "value0");
div.setAttribute("attr1", "value1");
var attrs = div.getAttributes();
expect(attrs.length, equals(2));
expect(attrs[0].name, equals("attr0"));
expect(attrs[0].value, equals("value0"));
expect(attrs[1].name, equals("attr1"));
expect(attrs[1].value, equals("value1"));
});
test("should set by name", () {
div.setAttribute("attrName", "value0");
expect(div.getAttribute("attrName"), equals("value0"));
expect(div.getAttributes()[0].name, equals("attrName"));
expect(div.getAttributes()[0].value, equals("value0"));
div.setAttribute("attrName", "new value");
expect(div.getAttribute("attrName"), equals("new value"));
expect(div.getAttributes()[0].name, equals("attrName"));
expect(div.getAttributes()[0].value, equals("new value"));
});
test("should be case sensitive", () {
div.setAttribute("attrName", "value0");
expect(div.getAttribute("attrname"), isNull);
expect(div.getAttribute("attrName"), equals("value0"));
});
test("should not live update", () {
div.setAttribute("attr0", "0");
div.setAttribute("attr1", "1");
div.setAttribute("attr2", "2");
var oldAttributes = div.getAttributes();
expect(oldAttributes.length, equals(3));
div.removeAttribute("attr1");
expect(oldAttributes.length, equals(3));
div.setAttribute("attr0", "value0");
div.setAttribute("attr2", "value2");
var newAttributes = div.getAttributes();
expect(newAttributes.length, equals(2));
expect(newAttributes[0].name, equals("attr0"));
expect(newAttributes[0].value, equals("value0"));
expect(newAttributes[1].name, equals("attr2"));
expect(newAttributes[1].value, equals("value2"));
expect(newAttributes, isNot(equals(oldAttributes)));
expect(oldAttributes[0].name, equals("attr0"));
expect(oldAttributes[0].value, equals("0"));
expect(oldAttributes[1].name, equals("attr1"));
expect(oldAttributes[1].value, equals("1"));
expect(oldAttributes[2].name, equals("attr2"));
expect(oldAttributes[2].value, equals("2"));
});
}
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