mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Make tests/clipping/canvas-rounded-corners.sky actually run.
Because we dump dart errors to LOG(ERROR) (stderr) instead of console.log / stdout, tests with dart errors just "pass" and we don't notice they're not running. This was the case with canvas-rounded-corners.sky. I don't think this test actually passes yet, despite it claiming to, but I at least have made it run and not crash. Required me commenting out a ton of CanvasRenderingContext2D, but that's fine, it wasn't actually working and it's better to have it be compiling valid dart. R=abarth@chromium.org, ojan@chromium.org BUG= Review URL: https://codereview.chromium.org/936563002
This commit is contained in:
parent
7c33481af9
commit
5e47f9a8f2
@ -169,6 +169,9 @@ def interface_context(interface):
|
||||
# For overloaded methods, only generate one accessor
|
||||
('overload_index' not in method or method['overload_index'] == 1))
|
||||
|
||||
for method in methods:
|
||||
assert 'overloads' not in method, 'Dart does not support overloads, %s in %s' % (method['name'], interface.name)
|
||||
|
||||
generate_method_native_entries(interface, methods, 'Method')
|
||||
|
||||
context.update({
|
||||
|
||||
@ -31,6 +31,7 @@
|
||||
NoInterfaceObject,
|
||||
ImplementedAs=DOMWindowCSS,
|
||||
] interface CSS {
|
||||
boolean supports(DOMString property, DOMString value);
|
||||
// Dart does not support overloads.
|
||||
// boolean supports(DOMString property, DOMString value);
|
||||
boolean supports(DOMString conditionText);
|
||||
};
|
||||
|
||||
@ -68,7 +68,8 @@ enum CanvasFillRule { "nonzero", "evenodd" };
|
||||
CanvasGradient createLinearGradient(float x0, float y0, float x1, float y1);
|
||||
[RaisesException] CanvasGradient createRadialGradient(float x0, float y0, float r0, float x1, float y1, float r1);
|
||||
[RaisesException] CanvasPattern createPattern(HTMLCanvasElement canvas, DOMString? repetitionType);
|
||||
[RaisesException] CanvasPattern createPattern(HTMLImageElement image, DOMString? repetitionType);
|
||||
// Dart does not support overloads!
|
||||
// [RaisesException] CanvasPattern createPattern(HTMLImageElement image, DOMString? repetitionType);
|
||||
|
||||
// shadows
|
||||
attribute unrestricted float shadowOffsetX;
|
||||
@ -84,19 +85,19 @@ enum CanvasFillRule { "nonzero", "evenodd" };
|
||||
// path API (see also CanvasPathMethods)
|
||||
void beginPath();
|
||||
void fill(optional CanvasFillRule winding);
|
||||
void fill(Path2D path, optional CanvasFillRule winding);
|
||||
// void fill(Path2D path, optional CanvasFillRule winding);
|
||||
void stroke();
|
||||
void stroke(Path2D path);
|
||||
// void stroke(Path2D path);
|
||||
// Focus rings
|
||||
void drawFocusIfNeeded(Element element);
|
||||
void drawFocusIfNeeded(Path2D path, Element element);
|
||||
// void drawFocusIfNeeded(Path2D path, Element element);
|
||||
|
||||
void clip(optional CanvasFillRule winding);
|
||||
void clip(Path2D path, optional CanvasFillRule winding);
|
||||
// void clip(Path2D path, optional CanvasFillRule winding);
|
||||
boolean isPointInPath(unrestricted float x, unrestricted float y, optional CanvasFillRule winding);
|
||||
boolean isPointInPath(Path2D path, unrestricted float x, unrestricted float y, optional CanvasFillRule winding);
|
||||
// boolean isPointInPath(Path2D path, unrestricted float x, unrestricted float y, optional CanvasFillRule winding);
|
||||
boolean isPointInStroke(unrestricted float x, unrestricted float y);
|
||||
boolean isPointInStroke(Path2D path, unrestricted float x, unrestricted float y);
|
||||
// boolean isPointInStroke(Path2D path, unrestricted float x, unrestricted float y);
|
||||
|
||||
// text (see also the CanvasDrawingStyles interface)
|
||||
void fillText(DOMString text, unrestricted float x, unrestricted float y, optional unrestricted float maxWidth);
|
||||
@ -105,21 +106,21 @@ enum CanvasFillRule { "nonzero", "evenodd" };
|
||||
|
||||
// drawing images
|
||||
[RaisesException] void drawImage(HTMLImageElement image, unrestricted float x, unrestricted float y);
|
||||
[RaisesException] void drawImage(HTMLImageElement image, unrestricted float x, unrestricted float y, unrestricted float width, unrestricted float height);
|
||||
[RaisesException] void drawImage(HTMLImageElement image, unrestricted float sx, unrestricted float sy, unrestricted float sw, unrestricted float sh, unrestricted float dx, unrestricted float dy, unrestricted float dw, unrestricted float dh);
|
||||
[RaisesException] void drawImage(HTMLCanvasElement canvas, unrestricted float x, unrestricted float y);
|
||||
[RaisesException] void drawImage(HTMLCanvasElement canvas, unrestricted float x, unrestricted float y, unrestricted float width, unrestricted float height);
|
||||
[RaisesException] void drawImage(HTMLCanvasElement canvas, unrestricted float sx, unrestricted float sy, unrestricted float sw, unrestricted float sh, unrestricted float dx, unrestricted float dy, unrestricted float dw, unrestricted float dh);
|
||||
[RaisesException] void drawImage(ImageBitmap imageBitmap, unrestricted float x, unrestricted float y);
|
||||
[RaisesException] void drawImage(ImageBitmap imageBitmap, unrestricted float x, unrestricted float y, unrestricted float width, unrestricted float height);
|
||||
[RaisesException] void drawImage(ImageBitmap imageBitmap, unrestricted float sx, unrestricted float sy, unrestricted float sw, unrestricted float sh, unrestricted float dx, unrestricted float dy, unrestricted float dw, unrestricted float dh);
|
||||
//[RaisesException] void drawImage(HTMLImageElement image, unrestricted float x, unrestricted float y, unrestricted float width, unrestricted float height);
|
||||
//[RaisesException] void drawImage(HTMLImageElement image, unrestricted float sx, unrestricted float sy, unrestricted float sw, unrestricted float sh, unrestricted float dx, unrestricted float dy, unrestricted float dw, unrestricted float dh);
|
||||
//[RaisesException] void drawImage(HTMLCanvasElement canvas, unrestricted float x, unrestricted float y);
|
||||
//[RaisesException] void drawImage(HTMLCanvasElement canvas, unrestricted float x, unrestricted float y, unrestricted float width, unrestricted float height);
|
||||
//[RaisesException] void drawImage(HTMLCanvasElement canvas, unrestricted float sx, unrestricted float sy, unrestricted float sw, unrestricted float sh, unrestricted float dx, unrestricted float dy, unrestricted float dw, unrestricted float dh);
|
||||
// [RaisesException] void drawImage(ImageBitmap imageBitmap, unrestricted float x, unrestricted float y);
|
||||
//[RaisesException] void drawImage(ImageBitmap imageBitmap, unrestricted float x, unrestricted float y, unrestricted float width, unrestricted float height);
|
||||
//[RaisesException] void drawImage(ImageBitmap imageBitmap, unrestricted float sx, unrestricted float sy, unrestricted float sw, unrestricted float sh, unrestricted float dx, unrestricted float dy, unrestricted float dw, unrestricted float dh);
|
||||
|
||||
// pixel manipulation
|
||||
ImageData createImageData(ImageData imagedata);
|
||||
[RaisesException] ImageData createImageData(float sw, float sh);
|
||||
//[RaisesException] ImageData createImageData(float sw, float sh);
|
||||
[RaisesException] ImageData getImageData(float sx, float sy, float sw, float sh);
|
||||
void putImageData(ImageData imagedata, float dx, float dy);
|
||||
void putImageData(ImageData imagedata, float dx, float dy, float dirtyX, float dirtyY, float dirtyWidth, float dirtyHeight);
|
||||
//void putImageData(ImageData imagedata, float dx, float dy, float dirtyX, float dirtyY, float dirtyWidth, float dirtyHeight);
|
||||
|
||||
// Context state
|
||||
// Should be merged with WebGL counterpart in CanvasRenderingContext, once no-longer experimental
|
||||
@ -135,8 +136,9 @@ enum CanvasFillRule { "nonzero", "evenodd" };
|
||||
attribute unrestricted float miterLimit; // (default 10)
|
||||
|
||||
// dashed lines
|
||||
void setLineDash(sequence<unrestricted float> dash);
|
||||
sequence<unrestricted float> getLineDash();
|
||||
// TODO(eseidel): Generator doesn't handle List<unrestricted float> yet.
|
||||
// void setLineDash(sequence<unrestricted float> dash);
|
||||
// sequence<unrestricted float> getLineDash();
|
||||
attribute unrestricted float lineDashOffset;
|
||||
|
||||
// text
|
||||
@ -153,20 +155,20 @@ enum CanvasFillRule { "nonzero", "evenodd" };
|
||||
void setMiterLimit(unrestricted float limit);
|
||||
void clearShadow();
|
||||
void setStrokeColor(DOMString color, optional unrestricted float alpha);
|
||||
void setStrokeColor(unrestricted float grayLevel, optional unrestricted float alpha);
|
||||
void setStrokeColor(unrestricted float r, unrestricted float g, unrestricted float b, unrestricted float a);
|
||||
void setStrokeColor(unrestricted float c, unrestricted float m, unrestricted float y, unrestricted float k, unrestricted float a);
|
||||
//void setStrokeColor(unrestricted float grayLevel, optional unrestricted float alpha);
|
||||
//void setStrokeColor(unrestricted float r, unrestricted float g, unrestricted float b, unrestricted float a);
|
||||
//void setStrokeColor(unrestricted float c, unrestricted float m, unrestricted float y, unrestricted float k, unrestricted float a);
|
||||
void setFillColor(DOMString color, optional unrestricted float alpha);
|
||||
void setFillColor(unrestricted float grayLevel, optional unrestricted float alpha);
|
||||
void setFillColor(unrestricted float r, unrestricted float g, unrestricted float b, unrestricted float a);
|
||||
void setFillColor(unrestricted float c, unrestricted float m, unrestricted float y, unrestricted float k, unrestricted float a);
|
||||
//void setFillColor(unrestricted float grayLevel, optional unrestricted float alpha);
|
||||
//void setFillColor(unrestricted float r, unrestricted float g, unrestricted float b, unrestricted float a);
|
||||
//void setFillColor(unrestricted float c, unrestricted float m, unrestricted float y, unrestricted float k, unrestricted float a);
|
||||
void drawImageFromRect(
|
||||
HTMLImageElement? image, optional unrestricted float sx, optional unrestricted float sy, optional unrestricted float sw, optional unrestricted float sh,
|
||||
optional unrestricted float dx, optional unrestricted float dy, optional unrestricted float dw, optional unrestricted float dh, optional DOMString compositeOperation);
|
||||
void setShadow(unrestricted float width, unrestricted float height, unrestricted float blur, optional DOMString color, optional unrestricted float alpha);
|
||||
void setShadow(unrestricted float width, unrestricted float height, unrestricted float blur, unrestricted float grayLevel, optional unrestricted float alpha);
|
||||
void setShadow(unrestricted float width, unrestricted float height, unrestricted float blur, unrestricted float r, unrestricted float g, unrestricted float b, unrestricted float a);
|
||||
void setShadow(unrestricted float width, unrestricted float height, unrestricted float blur, unrestricted float c, unrestricted float m, unrestricted float y, unrestricted float k, unrestricted float a);
|
||||
//void setShadow(unrestricted float width, unrestricted float height, unrestricted float blur, unrestricted float grayLevel, optional unrestricted float alpha);
|
||||
//void setShadow(unrestricted float width, unrestricted float height, unrestricted float blur, unrestricted float r, unrestricted float g, unrestricted float b, unrestricted float a);
|
||||
//void setShadow(unrestricted float width, unrestricted float height, unrestricted float blur, unrestricted float c, unrestricted float m, unrestricted float y, unrestricted float k, unrestricted float a);
|
||||
};
|
||||
|
||||
CanvasRenderingContext2D implements CanvasPathMethods;
|
||||
|
||||
@ -100,7 +100,9 @@ void DartController::ExecuteModule(RefPtr<AbstractModule> module) {
|
||||
DCHECK(Dart_CurrentIsolate() == dart_state()->isolate());
|
||||
DartApiScope dart_api_scope;
|
||||
|
||||
LogIfError(Dart_FinalizeLoading(true));
|
||||
// Don't continue if we failed to load the module.
|
||||
if (LogIfError(Dart_FinalizeLoading(true)))
|
||||
return;
|
||||
Dart_Handle library = module->library()->dart_value();
|
||||
const char* name = module->isApplication() ? "main" : "init";
|
||||
Dart_Handle closure_name = Dart_NewStringFromCString(name);
|
||||
|
||||
@ -16,11 +16,13 @@
|
||||
</ul>
|
||||
<canvas id="theCanvas" width="257" height="257"></canvas>
|
||||
<script>
|
||||
import 'dart:sky';
|
||||
|
||||
void main() {
|
||||
var theCanvas = document.getElementById('theCanvas');
|
||||
var context = theCanvas.getContext('2d');
|
||||
context.fillColor = 'green';
|
||||
context.fillRect(0, 0, theCanvas.width, theCanvas.width);
|
||||
context.fillRect(0.0, 0.0, 1.0 * theCanvas.width, 1.0 * theCanvas.width);
|
||||
}
|
||||
</script>
|
||||
</sky>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user