Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / Source / core / animation / animatable / AnimatableValueTestHelperTest.cpp
blobb2067a4e768c1e47379ed9ae42e68c8a424bf513
1 /*
2 * Copyright (c) 2013, Google Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
13 * distribution.
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #include "config.h"
32 #include "core/animation/animatable/AnimatableValueTestHelper.h"
34 #include "core/layout/ClipPathOperation.h"
35 #include "core/style/BasicShapes.h"
36 #include "platform/transforms/ScaleTransformOperation.h"
37 #include "platform/transforms/TranslateTransformOperation.h"
38 #include <gmock/gmock.h>
39 #include <gtest/gtest.h>
40 #include <sstream>
41 #include <string>
44 namespace blink {
46 class AnimationAnimatableValueTestHelperTest : public ::testing::Test {
47 protected:
48 ::std::string PrintToString(PassRefPtr<AnimatableValue> animValue)
50 return ::testing::PrintToString(*animValue.get());
54 TEST_F(AnimationAnimatableValueTestHelperTest, PrintTo)
56 EXPECT_THAT(
57 PrintToString(AnimatableClipPathOperation::create(ShapeClipPathOperation::create(BasicShapeCircle::create().get()).get())),
58 testing::StartsWith("AnimatableClipPathOperation")
61 EXPECT_EQ(
62 ::std::string("AnimatableColor(rgba(0, 0, 0, 0), #ff0000)"),
63 PrintToString(AnimatableColor::create(Color(0x000000FF), Color(0xFFFF0000))));
65 EXPECT_THAT(
66 PrintToString(const_cast<AnimatableValue*>(AnimatableValue::neutralValue())),
67 testing::StartsWith("AnimatableNeutral@"));
69 EXPECT_THAT(
70 PrintToString(AnimatableShapeValue::create(ShapeValue::createShapeValue(BasicShapeCircle::create().get(), ContentBox).get())),
71 testing::StartsWith("AnimatableShapeValue@"));
73 RefPtr<SVGDashArray> l2 = SVGDashArray::create();
74 l2->append(Length(1, blink::Fixed));
75 l2->append(Length(2, blink::Percent));
76 EXPECT_EQ(
77 ::std::string("AnimatableStrokeDasharrayList(1+0%, 0+2%)"),
78 PrintToString(AnimatableStrokeDasharrayList::create(l2, 1)));
80 EXPECT_EQ(
81 ::std::string("AnimatableUnknown(none)"),
82 PrintToString(AnimatableUnknown::create(CSSPrimitiveValue::createIdentifier(CSSValueNone).get())));
84 EXPECT_EQ(
85 ::std::string("AnimatableVisibility(VISIBLE)"),
86 PrintToString(AnimatableVisibility::create(VISIBLE)));
89 } // namespace blink