haikuwebkit/LayoutTests/fast/canvas/canvas-path-isPointInPath-e...

31 lines
3.0 KiB
Plaintext
Raw Permalink Normal View History

Series of tests to ensure correct results of isPointInPath with Path2D argument.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS ctx.isPointInPath(path, 50, 50) is true
PASS ctx.isPointInPath(path, NaN, 50) is false
PASS ctx.isPointInPath(path, 50, NaN) is false
PASS ctx.isPointInPath(path, 50, 50, 'nonzero') is true
PASS ctx.isPointInPath(path, 50, 50, 'evenodd') is false
PASS ctx.isPointInPath(path, 50, 50, 'nonzero') is false
[Canvas] Split CanvasRenderingContext2D.idl into separate IDLs to match current HTML spec https://bugs.webkit.org/show_bug.cgi?id=176276 Reviewed by Dean Jackson. Source/WebCore: - Splits CanvasRenderingContext2D.idl out into: CanvasState CanvasTransform CanvasCompositing CanvasImageSmoothing CanvasFillStrokeStyles CanvasShadowStyles CanvasFilters CanvasRect CanvasDrawPath CanvasUserInterface CanvasText CanvasDrawImage CanvasImageData CanvasPathDrawingStyles CanvasTextDrawingStyles - Renames CanvasWindingRule enum to CanvasFillRule, and moves it to its own file so it can be reused by multiple IDLs. - Renames DOMPath to Path2D, which is what it is supposed to be called, and doesn't conflict with any WebCore names. - Converts lineCap, lineJoin, textAlign, textBaseline, direction to use enums, rather than DOMStrings, allowing us to remove a bunch of custom parsing. - Non-standard canvas API was grouped with related functionality in the broken out IDLs and clearly marked as non-standard. - Comments were added for places where we break with the standard, mostly around use of float where we should be using double. * CMakeLists.txt: * DerivedSources.cpp: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: Add new files. * bindings/js/CallTracerTypes.h: * inspector/InspectorCanvas.cpp: (WebCore::InspectorCanvas::buildInitialState): (WebCore::InspectorCanvas::buildAction): Update for renames, and use new convertEnumerationToString to serialize enumerations. * bindings/scripts/CodeGeneratorJS.pm: (GenerateEnumerationImplementationContent): (GenerateEnumerationHeaderContent): Split string conversion out of convertEnumerationToJS, and into its own function, convertEnumerationToString, to allow serialization to string outside of the bindings context, in this case, for the InspectorCanvas. (GenerateParametersCheck): Improve error message to make it clear which operation has the issue in order to make debugging easier. * html/ImageData.idl: Re-order constructors to match specification, and add FIXME for incorrect default argument. * html/TextMetrics.idl: Add spec'd exposure and spec comments, as well a FIXME to convert the unrestricted float parameters should be doubles. * html/canvas/CanvasCompositing.idl: Added. * html/canvas/CanvasDirection.h: Added. * html/canvas/CanvasDirection.idl: Added. * html/canvas/CanvasDrawImage.idl: Added. * html/canvas/CanvasDrawPath.idl: Added. * html/canvas/CanvasFillRule.h: Added. * html/canvas/CanvasFillRule.idl: Added. * html/canvas/CanvasFillStrokeStyles.idl: Added. * html/canvas/CanvasFilters.idl: Added. * html/canvas/CanvasImageData.idl: Added. * html/canvas/CanvasImageSmoothing.idl: Added. * html/canvas/CanvasLineCap.h: Added. * html/canvas/CanvasLineCap.idl: Added. * html/canvas/CanvasLineJoin.h: Added. * html/canvas/CanvasLineJoin.idl: Added. * html/canvas/CanvasPathDrawingStyles.idl: Added. * html/canvas/CanvasRect.idl: Added. * html/canvas/CanvasShadowStyles.idl: Added. * html/canvas/CanvasState.idl: Added. * html/canvas/CanvasText.idl: Added. * html/canvas/CanvasTextAlign.h: Added. * html/canvas/CanvasTextAlign.idl: Added. * html/canvas/CanvasTextBaseline.h: Added. * html/canvas/CanvasTextBaseline.idl: Added. * html/canvas/CanvasTextDrawingStyles.idl: Added. * html/canvas/CanvasTransform.idl: Added. * html/canvas/CanvasUserInterface.idl: Added. * html/canvas/ImageSmoothingQuality.h: Added. * html/canvas/ImageSmoothingQuality.idl: Added. Move CanvasRenderingContext2D.idl content into separate files to match the specification. * html/canvas/CanvasGradient.idl: * html/canvas/CanvasPath.idl: * html/canvas/CanvasPattern.idl: Add exposure and FIXMEs on changes need to match the spec. * html/canvas/CanvasRenderingContext2D.cpp: * html/canvas/CanvasRenderingContext2D.h: Switch to using enums for lineCap, lineJoin, textAlign, textBaseline, and direction. Rather than using the parsing / stringifying functions from GraphicsTypes, add simple switch based to/from converters to convert to/from the canvas type to the platform type. Also update for rename of DOMPath -> Path2D and WindingRule -> CanvasFillRule. Unfortunately, not all custom parsing could be removed. To support the legacy functions setLineCap and setLineJoin, which take Strings, two simply parse paths had to be brought back. They can't use the enums, because the rules for enums as parameters is stricter that what was implemented in the custom code (e.g. the bindings would have thrown for strings not in the enum set). * html/canvas/CanvasRenderingContext2D.idl: Move most of the functions into the new files, which are then 'implemented' by this. * html/canvas/DOMPath.cpp: Removed. * html/canvas/DOMPath.h: Removed. * html/canvas/DOMPath.idl: Removed. * html/canvas/Path2D.cpp: Copied from Source/WebCore/html/canvas/DOMPath.cpp. * html/canvas/Path2D.h: Copied from Source/WebCore/html/canvas/DOMPath.h. * html/canvas/Path2D.idl: Copied from Source/WebCore/html/canvas/DOMPath.idl. Rename DOMPath to Path2D to match the spec.. * platform/graphics/GraphicsTypes.cpp: (WebCore::parseLineCap): Deleted. (WebCore::lineCapName): Deleted. (WebCore::parseLineJoin): Deleted. (WebCore::lineJoinName): Deleted. (WebCore::textAlignName): Deleted. (WebCore::parseTextAlign): Deleted. (WebCore::textBaselineName): Deleted. (WebCore::parseTextBaseline): Deleted. * platform/graphics/GraphicsTypes.h: Remove now unused parsing / stringifying functions. * testing/Internals.cpp: Remove unused #include. * bindings/scripts/test/JS/JSTestCallbackInterface.cpp: * bindings/scripts/test/JS/JSTestCallbackInterface.h: * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestObj.h: * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp: * bindings/scripts/test/JS/JSTestStandaloneDictionary.h: * bindings/scripts/test/JS/JSTestStandaloneEnumeration.cpp: * bindings/scripts/test/JS/JSTestStandaloneEnumeration.h: Update test results to add convertEnumerationToString. LayoutTests: * fast/canvas/canvas-clip-path-expected.txt: * fast/canvas/canvas-fill-path-expected.txt: * fast/canvas/canvas-path-addPath-expected.txt: * fast/canvas/canvas-path-isPointInPath-expected.txt: * fast/canvas/canvas-path-isPointInStroke-expected.txt: * fast/canvas/canvas-stroke-path-expected.txt: * fast/canvas/winding-enumeration-expected.txt: * inspector/canvas/recording-2d-expected.txt: * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: Update results. Canonical link: https://commits.webkit.org/192969@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221598 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-05 00:23:03 +00:00
PASS ctx.isPointInPath(null, 50, 50) threw exception TypeError: Argument 3 ('fillRule') to CanvasRenderingContext2D.isPointInPath must be one of: "nonzero", "evenodd".
PASS ctx.isPointInPath(null, 50, 50, 'nonzero') threw exception TypeError: Argument 1 ('path') to CanvasRenderingContext2D.isPointInPath must be an instance of Path2D.
PASS ctx.isPointInPath(null, 50, 50, 'evenodd') threw exception TypeError: Argument 1 ('path') to CanvasRenderingContext2D.isPointInPath must be an instance of Path2D.
PASS ctx.isPointInPath([], 50, 50) threw exception TypeError: Argument 3 ('fillRule') to CanvasRenderingContext2D.isPointInPath must be one of: "nonzero", "evenodd".
PASS ctx.isPointInPath([], 50, 50, 'nonzero') threw exception TypeError: Argument 1 ('path') to CanvasRenderingContext2D.isPointInPath must be an instance of Path2D.
PASS ctx.isPointInPath([], 50, 50, 'evenodd') threw exception TypeError: Argument 1 ('path') to CanvasRenderingContext2D.isPointInPath must be an instance of Path2D.
PASS ctx.isPointInPath({}, 50, 50) threw exception TypeError: Argument 3 ('fillRule') to CanvasRenderingContext2D.isPointInPath must be one of: "nonzero", "evenodd".
PASS ctx.isPointInPath({}, 50, 50, 'nonzero') threw exception TypeError: Argument 1 ('path') to CanvasRenderingContext2D.isPointInPath must be an instance of Path2D.
PASS ctx.isPointInPath({}, 50, 50, 'evenodd') threw exception TypeError: Argument 1 ('path') to CanvasRenderingContext2D.isPointInPath must be an instance of Path2D.
PASS ctx.isPointInPath('path2d', 50, 50, 'evenodd') threw exception TypeError: Argument 1 ('path') to CanvasRenderingContext2D.isPointInPath must be an instance of Path2D.
PASS ctx.isPointInPath(undefined, 50, 50, 'evenodd') threw exception TypeError: Argument 1 ('path') to CanvasRenderingContext2D.isPointInPath must be an instance of Path2D.
PASS ctx.isPointInPath(Number.MAX_VALUE, 50, 50, 'evenodd') threw exception TypeError: Argument 1 ('path') to CanvasRenderingContext2D.isPointInPath must be an instance of Path2D.
PASS ctx.isPointInPath(function() {}, 50, 50, 'evenodd') threw exception TypeError: Argument 1 ('path') to CanvasRenderingContext2D.isPointInPath must be an instance of Path2D.
PASS ctx.isPointInPath(false, 50, 50, 'evenodd') threw exception TypeError: Argument 1 ('path') to CanvasRenderingContext2D.isPointInPath must be an instance of Path2D.
PASS ctx.isPointInPath(new Date(), 50, 50, 'evenodd') threw exception TypeError: Argument 1 ('path') to CanvasRenderingContext2D.isPointInPath must be an instance of Path2D.
PASS successfullyParsed is true
TEST COMPLETE