| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013, Google Inc. All rights reserved. | 2 * Copyright (c) 2013, Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 #include <sstream> | 43 #include <sstream> |
| 44 #include <string> | 44 #include <string> |
| 45 | 45 |
| 46 | 46 |
| 47 using namespace WebCore; | 47 using namespace WebCore; |
| 48 | 48 |
| 49 namespace { | 49 namespace { |
| 50 | 50 |
| 51 class AnimationAnimatableValueTestHelperTest : public ::testing::Test { | 51 class AnimationAnimatableValueTestHelperTest : public ::testing::Test { |
| 52 protected: | 52 protected: |
| 53 ::std::string PrintToString(PassRefPtr<AnimatableValue> animValue) | 53 ::std::string PrintToString(PassRefPtrWillBeRawPtr<AnimatableValue> animValu
e) |
| 54 { | 54 { |
| 55 return PrintToString(animValue.get()); | 55 return PrintToString(animValue.get()); |
| 56 } | 56 } |
| 57 | |
| 58 ::std::string PrintToString(const AnimatableValue* animValue) | |
| 59 { | |
| 60 return ::testing::PrintToString(*animValue); | |
| 61 } | |
| 62 }; | 57 }; |
| 63 | 58 |
| 64 TEST_F(AnimationAnimatableValueTestHelperTest, PrintTo) | 59 TEST_F(AnimationAnimatableValueTestHelperTest, PrintTo) |
| 65 { | 60 { |
| 66 EXPECT_THAT( | 61 EXPECT_THAT( |
| 67 PrintToString(AnimatableClipPathOperation::create(ShapeClipPathOperation
::create(BasicShapeCircle::create().get()).get())), | 62 PrintToString(AnimatableClipPathOperation::create(ShapeClipPathOperation
::create(BasicShapeCircle::create().get()).get())), |
| 68 testing::StartsWith("AnimatableClipPathOperation") | 63 testing::StartsWith("AnimatableClipPathOperation") |
| 69 ); | 64 ); |
| 70 | 65 |
| 71 EXPECT_EQ( | 66 EXPECT_EQ( |
| (...skipping 25 matching lines...) Expand all Loading... |
| 97 ))); | 92 ))); |
| 98 | 93 |
| 99 EXPECT_EQ( | 94 EXPECT_EQ( |
| 100 ::std::string("AnimatableLengthSize(AnimatableLength(3rem), AnimatableLe
ngth(4pt))"), | 95 ::std::string("AnimatableLengthSize(AnimatableLength(3rem), AnimatableLe
ngth(4pt))"), |
| 101 PrintToString(AnimatableLengthSize::create( | 96 PrintToString(AnimatableLengthSize::create( |
| 102 AnimatableLength::create(CSSPrimitiveValue::create(3, CSSPrimitiveVa
lue::CSS_REMS).get()), | 97 AnimatableLength::create(CSSPrimitiveValue::create(3, CSSPrimitiveVa
lue::CSS_REMS).get()), |
| 103 AnimatableLength::create(CSSPrimitiveValue::create(4, CSSPrimitiveVa
lue::CSS_PT).get()) | 98 AnimatableLength::create(CSSPrimitiveValue::create(4, CSSPrimitiveVa
lue::CSS_PT).get()) |
| 104 ))); | 99 ))); |
| 105 | 100 |
| 106 EXPECT_THAT( | 101 EXPECT_THAT( |
| 107 PrintToString(AnimatableValue::neutralValue()), | 102 PrintToString(const_cast<AnimatableValue*>(AnimatableValue::neutralValue
())), |
| 108 testing::StartsWith("AnimatableNeutral@")); | 103 testing::StartsWith("AnimatableNeutral@")); |
| 109 | 104 |
| 110 Vector<RefPtr<AnimatableValue> > v1; | 105 WillBeHeapVector<RefPtrWillBeMember<AnimatableValue> > v1; |
| 111 v1.append(AnimatableLength::create(CSSPrimitiveValue::create(3, CSSPrimitive
Value::CSS_REMS).get())); | 106 v1.append(AnimatableLength::create(CSSPrimitiveValue::create(3, CSSPrimitive
Value::CSS_REMS).get())); |
| 112 v1.append(AnimatableLength::create(CSSPrimitiveValue::create(4, CSSPrimitive
Value::CSS_PT).get())); | 107 v1.append(AnimatableLength::create(CSSPrimitiveValue::create(4, CSSPrimitive
Value::CSS_PT).get())); |
| 113 EXPECT_EQ( | 108 EXPECT_EQ( |
| 114 ::std::string("AnimatableRepeatable(AnimatableLength(3rem), AnimatableLe
ngth(4pt))"), | 109 ::std::string("AnimatableRepeatable(AnimatableLength(3rem), AnimatableLe
ngth(4pt))"), |
| 115 PrintToString(AnimatableRepeatable::create(v1))); | 110 PrintToString(AnimatableRepeatable::create(v1))); |
| 116 | 111 |
| 117 RefPtr<SVGLength> length1cm = SVGLength::create(LengthModeOther); | 112 RefPtr<SVGLength> length1cm = SVGLength::create(LengthModeOther); |
| 118 RefPtr<SVGLength> length2cm = SVGLength::create(LengthModeOther); | 113 RefPtr<SVGLength> length2cm = SVGLength::create(LengthModeOther); |
| 119 length1cm->setValueAsString("1cm", ASSERT_NO_EXCEPTION); | 114 length1cm->setValueAsString("1cm", ASSERT_NO_EXCEPTION); |
| 120 length2cm->setValueAsString("2cm", ASSERT_NO_EXCEPTION); | 115 length2cm->setValueAsString("2cm", ASSERT_NO_EXCEPTION); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 EXPECT_EQ( | 152 EXPECT_EQ( |
| 158 ::std::string("AnimatableUnknown(none)"), | 153 ::std::string("AnimatableUnknown(none)"), |
| 159 PrintToString(AnimatableUnknown::create(CSSPrimitiveValue::createIdentif
ier(CSSValueNone).get()))); | 154 PrintToString(AnimatableUnknown::create(CSSPrimitiveValue::createIdentif
ier(CSSValueNone).get()))); |
| 160 | 155 |
| 161 EXPECT_EQ( | 156 EXPECT_EQ( |
| 162 ::std::string("AnimatableVisibility(VISIBLE)"), | 157 ::std::string("AnimatableVisibility(VISIBLE)"), |
| 163 PrintToString(AnimatableVisibility::create(VISIBLE))); | 158 PrintToString(AnimatableVisibility::create(VISIBLE))); |
| 164 } | 159 } |
| 165 | 160 |
| 166 } // namespace | 161 } // namespace |
| OLD | NEW |