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

Side by Side Diff: third_party/WebKit/Source/modules/csspaint/PaintRenderingContext2DTest.cpp

Issue 2104103003: Fix zoom in CSS paint worklets (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2nd rebase Created 4 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
« no previous file with comments | « third_party/WebKit/Source/modules/csspaint/PaintRenderingContext2D.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/csspaint/PaintRenderingContext2D.h" 5 #include "modules/csspaint/PaintRenderingContext2D.h"
6 6
7 #include "platform/graphics/ImageBuffer.h" 7 #include "platform/graphics/ImageBuffer.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace blink { 10 namespace blink {
11 namespace { 11 namespace {
12 12
13 static const int s_width = 50; 13 static const int s_width = 50;
14 static const int s_height = 75; 14 static const int s_height = 75;
15 static const float s_zoom = 1.0;
15 16
16 class PaintRenderingContext2DTest : public ::testing::Test { 17 class PaintRenderingContext2DTest : public ::testing::Test {
17 protected: 18 protected:
18 void SetUp() override; 19 void SetUp() override;
19 20
20 Persistent<PaintRenderingContext2D> m_ctx; 21 Persistent<PaintRenderingContext2D> m_ctx;
21 }; 22 };
22 23
23 void PaintRenderingContext2DTest::SetUp() 24 void PaintRenderingContext2DTest::SetUp()
24 { 25 {
25 m_ctx = PaintRenderingContext2D::create(ImageBuffer::create(IntSize(s_width, s_height)), false /* hasAlpha */); 26 m_ctx = PaintRenderingContext2D::create(ImageBuffer::create(IntSize(s_width, s_height)), false /* hasAlpha */, s_zoom);
26 } 27 }
27 28
28 void trySettingStrokeStyle(PaintRenderingContext2D* ctx, const String& expected, const String& value) 29 void trySettingStrokeStyle(PaintRenderingContext2D* ctx, const String& expected, const String& value)
29 { 30 {
30 StringOrCanvasGradientOrCanvasPattern result, arg, dummy; 31 StringOrCanvasGradientOrCanvasPattern result, arg, dummy;
31 dummy.setString("red"); 32 dummy.setString("red");
32 arg.setString(value); 33 arg.setString(value);
33 ctx->setStrokeStyle(dummy); 34 ctx->setStrokeStyle(dummy);
34 ctx->setStrokeStyle(arg); 35 ctx->setStrokeStyle(arg);
35 ctx->strokeStyle(result); 36 ctx->strokeStyle(result);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 EXPECT_EQ(lineJoinAfter, m_ctx->lineJoin()); 70 EXPECT_EQ(lineJoinAfter, m_ctx->lineJoin());
70 71
71 m_ctx->restore(); 72 m_ctx->restore();
72 73
73 EXPECT_EQ(shadowBlurBefore, m_ctx->shadowBlur()); 74 EXPECT_EQ(shadowBlurBefore, m_ctx->shadowBlur());
74 EXPECT_EQ(lineJoinBefore, m_ctx->lineJoin()); 75 EXPECT_EQ(lineJoinBefore, m_ctx->lineJoin());
75 } 76 }
76 77
77 } // namespace 78 } // namespace
78 } // namespace blink 79 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/csspaint/PaintRenderingContext2D.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698