| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 { | 88 { |
| 89 return ::testing::PrintToString(*timing); | 89 return ::testing::PrintToString(*timing); |
| 90 } | 90 } |
| 91 }; | 91 }; |
| 92 | 92 |
| 93 TEST_F(TimingFunctionTestHelperTest, LinearPrintTo) | 93 TEST_F(TimingFunctionTestHelperTest, LinearPrintTo) |
| 94 { | 94 { |
| 95 RefPtr<TimingFunction> linearTiming = LinearTimingFunction::create(); | 95 RefPtr<TimingFunction> linearTiming = LinearTimingFunction::create(); |
| 96 EXPECT_THAT( | 96 EXPECT_THAT( |
| 97 PrintToString(linearTiming), | 97 PrintToString(linearTiming), |
| 98 ::testing::MatchesRegex("LinearTimingFunction@.*")); | 98 ::testing::MatchesRegex("linear")); |
| 99 } | 99 } |
| 100 | 100 |
| 101 TEST_F(TimingFunctionTestHelperTest, CubicPrintTo) | 101 TEST_F(TimingFunctionTestHelperTest, CubicPrintTo) |
| 102 { | 102 { |
| 103 RefPtr<TimingFunction> cubicEaseTiming = CubicBezierTimingFunction::preset(C
ubicBezierTimingFunction::EaseIn); | 103 RefPtr<TimingFunction> cubicEaseTiming = CubicBezierTimingFunction::preset(C
ubicBezierTimingFunction::EaseIn); |
| 104 EXPECT_THAT( | 104 EXPECT_THAT( |
| 105 PrintToString(cubicEaseTiming), | 105 PrintToString(cubicEaseTiming), |
| 106 ::testing::MatchesRegex("CubicBezierTimingFunction@.*\\(EaseIn, 0.42, 0,
1, 1\\)")); | 106 ::testing::MatchesRegex("ease-in")); |
| 107 | 107 |
| 108 RefPtr<TimingFunction> cubicCustomTiming = CubicBezierTimingFunction::create
(0.17, 0.67, 1, -1.73); | 108 RefPtr<TimingFunction> cubicCustomTiming = CubicBezierTimingFunction::create
(0.17, 0.67, 1, -1.73); |
| 109 EXPECT_THAT( | 109 EXPECT_THAT( |
| 110 PrintToString(cubicCustomTiming), | 110 PrintToString(cubicCustomTiming), |
| 111 ::testing::MatchesRegex("CubicBezierTimingFunction@.*\\(Custom, 0.17, 0.
67, 1, -1.73\\)")); | 111 ::testing::MatchesRegex("cubic-bezier\\(0.17, 0.67, 1, -1.73\\)")); |
| 112 } | 112 } |
| 113 | 113 |
| 114 TEST_F(TimingFunctionTestHelperTest, StepPrintTo) | 114 TEST_F(TimingFunctionTestHelperTest, StepPrintTo) |
| 115 { | 115 { |
| 116 RefPtr<TimingFunction> stepTimingStart = StepsTimingFunction::preset(StepsTi
mingFunction::Start); | 116 RefPtr<TimingFunction> stepTimingStart = StepsTimingFunction::preset(StepsTi
mingFunction::Start); |
| 117 EXPECT_THAT( | 117 EXPECT_THAT( |
| 118 PrintToString(stepTimingStart), | 118 PrintToString(stepTimingStart), |
| 119 ::testing::MatchesRegex("StepsTimingFunction@.*\\(Start, 1, true\\)")); | 119 ::testing::MatchesRegex("step-start")); |
| 120 | 120 |
| 121 RefPtr<TimingFunction> stepTimingCustom = StepsTimingFunction::create(5, fal
se); | 121 RefPtr<TimingFunction> stepTimingCustom = StepsTimingFunction::create(5, fal
se); |
| 122 EXPECT_THAT( | 122 EXPECT_THAT( |
| 123 PrintToString(stepTimingCustom), | 123 PrintToString(stepTimingCustom), |
| 124 ::testing::MatchesRegex("StepsTimingFunction@.*\\(Custom, 5, false\\)"))
; | 124 ::testing::MatchesRegex("steps\\(5, end\\)")); |
| 125 } | 125 } |
| 126 | 126 |
| 127 TEST_F(TimingFunctionTestHelperTest, ChainedPrintTo) | 127 TEST_F(TimingFunctionTestHelperTest, ChainedPrintTo) |
| 128 { | 128 { |
| 129 RefPtr<TimingFunction> linearTiming = LinearTimingFunction::create(); | 129 RefPtr<TimingFunction> linearTiming = LinearTimingFunction::create(); |
| 130 RefPtr<ChainedTimingFunction> chainedLinearSingle = ChainedTimingFunction::c
reate(); | 130 RefPtr<ChainedTimingFunction> chainedLinearSingle = ChainedTimingFunction::c
reate(); |
| 131 chainedLinearSingle->appendSegment(1.0, linearTiming.get()); | 131 chainedLinearSingle->appendSegment(1.0, linearTiming.get()); |
| 132 EXPECT_THAT( | 132 EXPECT_THAT( |
| 133 PrintToString(chainedLinearSingle), | 133 PrintToString(chainedLinearSingle), |
| 134 ::testing::MatchesRegex( | 134 ::testing::MatchesRegex( |
| 135 "ChainedTimingFunction@.*\\(" | 135 "chained\\(" |
| 136 "LinearTimingFunction@.*\\[0 -> 1\\]" | 136 "linear\\[0 -> 1\\]" |
| 137 "\\)")); | 137 "\\)")); |
| 138 | 138 |
| 139 RefPtr<TimingFunction> cubicCustomTiming = CubicBezierTimingFunction::create
(1.0, 0.0, 1, -1); | 139 RefPtr<TimingFunction> cubicCustomTiming = CubicBezierTimingFunction::create
(1.0, 0.0, 1, -1); |
| 140 | 140 |
| 141 RefPtr<ChainedTimingFunction> chainedMixed = ChainedTimingFunction::create()
; | 141 RefPtr<ChainedTimingFunction> chainedMixed = ChainedTimingFunction::create()
; |
| 142 chainedMixed->appendSegment(0.75, chainedLinearSingle.get()); | 142 chainedMixed->appendSegment(0.75, chainedLinearSingle.get()); |
| 143 chainedMixed->appendSegment(1.0, cubicCustomTiming.get()); | 143 chainedMixed->appendSegment(1.0, cubicCustomTiming.get()); |
| 144 EXPECT_THAT( | 144 EXPECT_THAT( |
| 145 PrintToString(chainedMixed), | 145 PrintToString(chainedMixed), |
| 146 ::testing::MatchesRegex( | 146 ::testing::MatchesRegex( |
| 147 "ChainedTimingFunction@.*\\(" | 147 "chained\\(" |
| 148 "ChainedTimingFunction@.*\\(" | 148 "chained\\(" |
| 149 "LinearTimingFunction@.*\\[0 -> 1\\]" | 149 "linear\\[0 -> 1\\]" |
| 150 "\\)\\[0 -> 0.75\\], " | 150 "\\)\\[0 -> 0.75\\], " |
| 151 "CubicBezierTimingFunction@.*\\(Custom, 1, 0, 1, -1\\)\\[0.75 ->
1\\]" | 151 "cubic-bezier\\(1, 0, 1, -1\\)\\[0.75 -> 1\\]" |
| 152 "\\)")); | 152 "\\)")); |
| 153 } | 153 } |
| 154 | 154 |
| 155 TEST_F(TimingFunctionTestHelperTest, BaseOperatorEq) | 155 TEST_F(TimingFunctionTestHelperTest, BaseOperatorEq) |
| 156 { | 156 { |
| 157 RefPtr<TimingFunction> linearTiming = LinearTimingFunction::create(); | 157 RefPtr<TimingFunction> linearTiming = LinearTimingFunction::create(); |
| 158 RefPtr<TimingFunction> cubicTiming1 = CubicBezierTimingFunction::preset(Cubi
cBezierTimingFunction::EaseIn); | 158 RefPtr<TimingFunction> cubicTiming1 = CubicBezierTimingFunction::preset(Cubi
cBezierTimingFunction::EaseIn); |
| 159 RefPtr<TimingFunction> cubicTiming2 = CubicBezierTimingFunction::create(0.17
, 0.67, 1, -1.73); | 159 RefPtr<TimingFunction> cubicTiming2 = CubicBezierTimingFunction::create(0.17
, 0.67, 1, -1.73); |
| 160 RefPtr<TimingFunction> stepsTiming1 = StepsTimingFunction::preset(StepsTimin
gFunction::End); | 160 RefPtr<TimingFunction> stepsTiming1 = StepsTimingFunction::preset(StepsTimin
gFunction::End); |
| 161 RefPtr<TimingFunction> stepsTiming2 = StepsTimingFunction::create(5, true); | 161 RefPtr<TimingFunction> stepsTiming2 = StepsTimingFunction::create(5, true); |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 EXPECT_REFV_NE(chainedMixed1, chainedSingleCubic1); | 317 EXPECT_REFV_NE(chainedMixed1, chainedSingleCubic1); |
| 318 EXPECT_REFV_NE(chainedMixed1, chainedSingleLinear1); | 318 EXPECT_REFV_NE(chainedMixed1, chainedSingleLinear1); |
| 319 | 319 |
| 320 RefPtr<ChainedTimingFunction> chainedMixed4 = ChainedTimingFunction::create(
); | 320 RefPtr<ChainedTimingFunction> chainedMixed4 = ChainedTimingFunction::create(
); |
| 321 chainedMixed4->appendSegment(0.20, chainedSingleLinear1.get()); // Different
offset | 321 chainedMixed4->appendSegment(0.20, chainedSingleLinear1.get()); // Different
offset |
| 322 chainedMixed4->appendSegment(1.0, cubicTiming1.get()); | 322 chainedMixed4->appendSegment(1.0, cubicTiming1.get()); |
| 323 EXPECT_REFV_NE(chainedMixed1, chainedMixed4); | 323 EXPECT_REFV_NE(chainedMixed1, chainedMixed4); |
| 324 } | 324 } |
| 325 | 325 |
| 326 } // namespace | 326 } // namespace |
| OLD | NEW |