haikuwebkit/LayoutTests/fast/canvas/canvas-imageSmoothingQualit...

41 lines
1.5 KiB
Plaintext
Raw Permalink Normal View History

Source/WebCore: Add support for the imageSmoothingQuality property for CanvasRenderingContext2D. https://bugs.webkit.org/show_bug.cgi?id=149541 Patch by Katlyn Graff <kgraff@apple.com> on 2015-09-30 Reviewed by Ryosuke Niwa. As documented here: https://html.spec.whatwg.org/multipage/scripting.html#image-smoothing Exposes the smooothing quality of algorithms used for scaling images. Valid input values are low, medium, and high: associated algorithms are expected to vary for differing hardware. setImageSmoothingQuality provides a handle into CGInterpolationQuality. Test: fast/canvas/canvas-imageSmoothingQuality.html * html/canvas/CanvasRenderingContext2D.cpp: (WebCore::CanvasRenderingContext2D::State::State): (WebCore::CanvasRenderingContext2D::State::operator=): (WebCore::smoothingToInterpolationQuality): (WebCore::CanvasRenderingContext2D::imageSmoothingQuality): (WebCore::CanvasRenderingContext2D::setImageSmoothingQuality): (WebCore::CanvasRenderingContext2D::setImageSmoothingEnabled): * html/canvas/CanvasRenderingContext2D.h: * html/canvas/CanvasRenderingContext2D.idl: LayoutTests: Tests support for imageSmoothingQuality attribute of Canvas element. https://bugs.webkit.org/show_bug.cgi?id=149541 Patch by Katlyn Graff <kgraff@apple.com> on 2015-09-30 Reviewed by Ryosuke Niwa. Tests low, medium, high, and default values, value persistence when imageSmoothingEnabled is changed, and invalid input. * fast/canvas/canvas-imageSmoothingQuality-expected.txt: Added. * fast/canvas/canvas-imageSmoothingQuality.html: Added. Canonical link: https://commits.webkit.org/167799@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@190383 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-10-01 03:17:26 +00:00
Tests for the imageSmoothingQuality attribute.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS lowContext.imageSmoothingQuality is 'low'
PASS mediumContext.imageSmoothingQuality is 'medium'
PASS highContext.imageSmoothingQuality is 'high'
PASS lowData is not mediumData
PASS mediumData is not highData
PASS lowData is not highData
PASS sampleAlpha(lowData) is >= sampleAlpha(mediumData)
PASS sampleAlpha(mediumData) is >= sampleAlpha(highData)
PASS defaultContext.imageSmoothingQuality is 'low'
PASS highContext.imageSmoothingEnabled = false; highContext.imageSmoothingQuality is 'high'
PASS highContext.imageSmoothingQuality = 'medium'; highContext.imageSmoothingQuality is 'medium'
highContext.imageSmoothingEnabled = true; highContext.imageSmoothingQuality = 'high';
PASS scaleImageData(highCanvas, '3223') did not throw exception.
PASS highContext.imageSmoothingQuality is 'high'
PASS scaleImageData(highCanvas, 'bad_input') did not throw exception.
PASS highContext.imageSmoothingQuality is 'high'
PASS scaleImageData(highCanvas, 'LOW') did not throw exception.
PASS highContext.imageSmoothingQuality is 'high'
PASS scaleImageData(highCanvas, 'Medium') did not throw exception.
PASS highContext.imageSmoothingQuality is 'high'
highContext.save(); highContext.imageSmoothingQuality = 'medium';
PASS highContext.restore(); highContext.imageSmoothingQuality is 'high'
PASS scaleImageData(highCanvas, highCanvas.imageSmoothingQuality); is highData
PASS successfullyParsed is true
TEST COMPLETE