Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Side by Side Diff: Source/core/html/canvas/CanvasRenderingContext2DAPITest.cpp

Issue 1224443003: Copy line dashes when copying/assigning CanvasRenderingContext2DState (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/html/canvas/CanvasRenderingContext2DState.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "config.h" 5 #include "config.h"
6 #include "core/html/canvas/CanvasRenderingContext2D.h" 6 #include "core/html/canvas/CanvasRenderingContext2D.h"
7 7
8 #include "core/frame/FrameView.h" 8 #include "core/frame/FrameView.h"
9 #include "core/html/HTMLDocument.h" 9 #include "core/html/HTMLDocument.h"
10 #include "core/html/ImageData.h" 10 #include "core/html/ImageData.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 { 167 {
168 StringOrCanvasGradientOrCanvasPattern value; 168 StringOrCanvasGradientOrCanvasPattern value;
169 context2d()->fillStyle(value); 169 context2d()->fillStyle(value);
170 EXPECT_TRUE(value.isString()); 170 EXPECT_TRUE(value.isString());
171 EXPECT_EQ(String("#000000"), value.getAsString()); 171 EXPECT_EQ(String("#000000"), value.getAsString());
172 } 172 }
173 173
174 EXPECT_EQ(String("rgba(0, 0, 0, 0)"), context2d()->shadowColor()); 174 EXPECT_EQ(String("rgba(0, 0, 0, 0)"), context2d()->shadowColor());
175 } 175 }
176 176
177 TEST_F(CanvasRenderingContext2DAPITest, LineDashStateSave)
178 {
179 createContext(NonOpaque);
180
181 Vector<float> simpleDash;
182 simpleDash.append(4);
183 simpleDash.append(2);
184
185 context2d()->setLineDash(simpleDash);
186 EXPECT_EQ(simpleDash, context2d()->getLineDash());
187 context2d()->save();
188 // Realize the save.
189 context2d()->scale(2, 2);
190 EXPECT_EQ(simpleDash, context2d()->getLineDash());
191 context2d()->restore();
192 EXPECT_EQ(simpleDash, context2d()->getLineDash());
193 }
194
177 TEST_F(CanvasRenderingContext2DAPITest, CreateImageData) 195 TEST_F(CanvasRenderingContext2DAPITest, CreateImageData)
178 { 196 {
179 createContext(NonOpaque); 197 createContext(NonOpaque);
180 198
181 NonThrowableExceptionState exceptionState; 199 NonThrowableExceptionState exceptionState;
182 200
183 // create a 100x50 imagedata and fill it with white pixels 201 // create a 100x50 imagedata and fill it with white pixels
184 ImageData* imageData = context2d()->createImageData(100, 50, exceptionState) ; 202 ImageData* imageData = context2d()->createImageData(100, 50, exceptionState) ;
185 EXPECT_FALSE(exceptionState.hadException()); 203 EXPECT_FALSE(exceptionState.hadException());
186 EXPECT_EQ(100, imageData->width()); 204 EXPECT_EQ(100, imageData->width());
(...skipping 23 matching lines...) Expand all
210 ImageData* imgdata4 = context2d()->createImageData(-10, -20, exceptionState) ; 228 ImageData* imgdata4 = context2d()->createImageData(-10, -20, exceptionState) ;
211 EXPECT_FALSE(exceptionState.hadException()); 229 EXPECT_FALSE(exceptionState.hadException());
212 230
213 EXPECT_EQ((unsigned)800, imgdata1->data()->length()); 231 EXPECT_EQ((unsigned)800, imgdata1->data()->length());
214 EXPECT_EQ((unsigned)800, imgdata2->data()->length()); 232 EXPECT_EQ((unsigned)800, imgdata2->data()->length());
215 EXPECT_EQ((unsigned)800, imgdata3->data()->length()); 233 EXPECT_EQ((unsigned)800, imgdata3->data()->length());
216 EXPECT_EQ((unsigned)800, imgdata4->data()->length()); 234 EXPECT_EQ((unsigned)800, imgdata4->data()->length());
217 } 235 }
218 236
219 } // namespace blink 237 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/core/html/canvas/CanvasRenderingContext2DState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698