OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "modules/canvas2d/CanvasRenderingContext2D.h" | 5 #include "modules/canvas2d/CanvasRenderingContext2D.h" |
6 | 6 |
7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
8 #include "core/frame/FrameView.h" | 8 #include "core/frame/FrameView.h" |
9 #include "core/frame/Settings.h" | 9 #include "core/frame/Settings.h" |
10 #include "core/html/HTMLCanvasElement.h" | 10 #include "core/html/HTMLCanvasElement.h" |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
237 ImageData* imageData = context2d()->createImageData(100, 50, exceptionState); | 237 ImageData* imageData = context2d()->createImageData(100, 50, exceptionState); |
238 EXPECT_FALSE(exceptionState.hadException()); | 238 EXPECT_FALSE(exceptionState.hadException()); |
239 EXPECT_EQ(100, imageData->width()); | 239 EXPECT_EQ(100, imageData->width()); |
240 EXPECT_EQ(50, imageData->height()); | 240 EXPECT_EQ(50, imageData->height()); |
241 | 241 |
242 for (unsigned i = 0; i < imageData->data()->length(); ++i) | 242 for (unsigned i = 0; i < imageData->data()->length(); ++i) |
243 imageData->data()->data()[i] = 255; | 243 imageData->data()->data()[i] = 255; |
244 | 244 |
245 EXPECT_EQ(255, imageData->data()->data()[32]); | 245 EXPECT_EQ(255, imageData->data()->data()[32]); |
246 | 246 |
247 // createImageData(imageData) should create a new ImageData of the same size a s 'imageData' | 247 // createImageData(imageData) should create a new ImageData of the same size |
248 // as 'imageData' | |
Justin Novosad
2016/10/03 18:13:11
oops
| |
248 // but filled with transparent black | 249 // but filled with transparent black |
249 | 250 |
250 ImageData* sameSizeImageData = | 251 ImageData* sameSizeImageData = |
251 context2d()->createImageData(imageData, exceptionState); | 252 context2d()->createImageData(imageData, exceptionState); |
252 EXPECT_FALSE(exceptionState.hadException()); | 253 EXPECT_FALSE(exceptionState.hadException()); |
253 EXPECT_EQ(100, sameSizeImageData->width()); | 254 EXPECT_EQ(100, sameSizeImageData->width()); |
254 EXPECT_EQ(50, sameSizeImageData->height()); | 255 EXPECT_EQ(50, sameSizeImageData->height()); |
255 EXPECT_EQ(0, sameSizeImageData->data()->data()[32]); | 256 EXPECT_EQ(0, sameSizeImageData->data()->data()[32]); |
256 | 257 |
257 // createImageData(width, height) takes the absolute magnitude of the size arg uments | 258 // createImageData(width, height) takes the absolute magnitude of the size |
259 // arguments | |
258 | 260 |
259 ImageData* imgdata1 = context2d()->createImageData(10, 20, exceptionState); | 261 ImageData* imgdata1 = context2d()->createImageData(10, 20, exceptionState); |
260 EXPECT_FALSE(exceptionState.hadException()); | 262 EXPECT_FALSE(exceptionState.hadException()); |
261 ImageData* imgdata2 = context2d()->createImageData(-10, 20, exceptionState); | 263 ImageData* imgdata2 = context2d()->createImageData(-10, 20, exceptionState); |
262 EXPECT_FALSE(exceptionState.hadException()); | 264 EXPECT_FALSE(exceptionState.hadException()); |
263 ImageData* imgdata3 = context2d()->createImageData(10, -20, exceptionState); | 265 ImageData* imgdata3 = context2d()->createImageData(10, -20, exceptionState); |
264 EXPECT_FALSE(exceptionState.hadException()); | 266 EXPECT_FALSE(exceptionState.hadException()); |
265 ImageData* imgdata4 = context2d()->createImageData(-10, -20, exceptionState); | 267 ImageData* imgdata4 = context2d()->createImageData(-10, -20, exceptionState); |
266 EXPECT_FALSE(exceptionState.hadException()); | 268 EXPECT_FALSE(exceptionState.hadException()); |
267 | 269 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
359 AXObject* axObject = axObjectCache->getOrCreate(buttonElement); | 361 AXObject* axObject = axObjectCache->getOrCreate(buttonElement); |
360 | 362 |
361 LayoutRect axBounds = axObject->getBoundsInFrameCoordinates(); | 363 LayoutRect axBounds = axObject->getBoundsInFrameCoordinates(); |
362 EXPECT_EQ(25, axBounds.x().toInt()); | 364 EXPECT_EQ(25, axBounds.x().toInt()); |
363 EXPECT_EQ(25, axBounds.y().toInt()); | 365 EXPECT_EQ(25, axBounds.y().toInt()); |
364 EXPECT_EQ(40, axBounds.width().toInt()); | 366 EXPECT_EQ(40, axBounds.width().toInt()); |
365 EXPECT_EQ(40, axBounds.height().toInt()); | 367 EXPECT_EQ(40, axBounds.height().toInt()); |
366 } | 368 } |
367 | 369 |
368 } // namespace blink | 370 } // namespace blink |
OLD | NEW |