| OLD | NEW |
| 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 | 15 |
| 16 class PaintRenderingContext2DTest : public ::testing::Test { | 16 class PaintRenderingContext2DTest : public ::testing::Test { |
| 17 protected: | 17 protected: |
| 18 void SetUp() override; | 18 void SetUp() override; |
| 19 | 19 |
| 20 Persistent<PaintRenderingContext2D> m_ctx; | 20 Persistent<PaintRenderingContext2D> m_ctx; |
| 21 }; | 21 }; |
| 22 | 22 |
| 23 void PaintRenderingContext2DTest::SetUp() | 23 void PaintRenderingContext2DTest::SetUp() |
| 24 { | 24 { |
| 25 m_ctx = PaintRenderingContext2D::create(ImageBuffer::create(IntSize(s_width,
s_height))); | 25 m_ctx = PaintRenderingContext2D::create(ImageBuffer::create(IntSize(s_width,
s_height)), false /* hasAlpha */); |
| 26 } | 26 } |
| 27 | 27 |
| 28 void trySettingStrokeStyle(PaintRenderingContext2D* ctx, const String& expected,
const String& value) | 28 void trySettingStrokeStyle(PaintRenderingContext2D* ctx, const String& expected,
const String& value) |
| 29 { | 29 { |
| 30 StringOrCanvasGradientOrCanvasPattern result, arg, dummy; | 30 StringOrCanvasGradientOrCanvasPattern result, arg, dummy; |
| 31 dummy.setString("red"); | 31 dummy.setString("red"); |
| 32 arg.setString(value); | 32 arg.setString(value); |
| 33 ctx->setStrokeStyle(dummy); | 33 ctx->setStrokeStyle(dummy); |
| 34 ctx->setStrokeStyle(arg); | 34 ctx->setStrokeStyle(arg); |
| 35 ctx->strokeStyle(result); | 35 ctx->strokeStyle(result); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 EXPECT_EQ(lineJoinAfter, m_ctx->lineJoin()); | 69 EXPECT_EQ(lineJoinAfter, m_ctx->lineJoin()); |
| 70 | 70 |
| 71 m_ctx->restore(); | 71 m_ctx->restore(); |
| 72 | 72 |
| 73 EXPECT_EQ(shadowBlurBefore, m_ctx->shadowBlur()); | 73 EXPECT_EQ(shadowBlurBefore, m_ctx->shadowBlur()); |
| 74 EXPECT_EQ(lineJoinBefore, m_ctx->lineJoin()); | 74 EXPECT_EQ(lineJoinBefore, m_ctx->lineJoin()); |
| 75 } | 75 } |
| 76 | 76 |
| 77 } // namespace | 77 } // namespace |
| 78 } // namespace blink | 78 } // namespace blink |
| OLD | NEW |