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

Side by Side Diff: Source/core/animation/AnimatableDoubleTest.cpp

Issue 27664002: Web Animations: Regularise unit test names (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated to head Created 7 years, 2 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 | « Source/core/animation/AnimatableColorTest.cpp ('k') | Source/core/animation/AnimatableLength.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 21 matching lines...) Expand all
32 #include "core/animation/AnimatableDouble.h" 32 #include "core/animation/AnimatableDouble.h"
33 33
34 #include "core/css/CSSPrimitiveValue.h" 34 #include "core/css/CSSPrimitiveValue.h"
35 35
36 #include <gtest/gtest.h> 36 #include <gtest/gtest.h>
37 37
38 using namespace WebCore; 38 using namespace WebCore;
39 39
40 namespace { 40 namespace {
41 41
42 TEST(AnimatableDoubleTest, Create) 42 TEST(CoreAnimationAnimatableDoubleTest, Create)
43 { 43 {
44 EXPECT_TRUE(static_cast<bool>(AnimatableDouble::create(5).get())); 44 EXPECT_TRUE(static_cast<bool>(AnimatableDouble::create(5).get()));
45 EXPECT_TRUE(static_cast<bool>(AnimatableDouble::create(10).get())); 45 EXPECT_TRUE(static_cast<bool>(AnimatableDouble::create(10).get()));
46 } 46 }
47 47
48 TEST(AnimatableDoubleTest, Equal) 48 TEST(CoreAnimationAnimatableDoubleTest, Equal)
49 { 49 {
50 EXPECT_TRUE(AnimatableDouble::create(10)->equals(AnimatableDouble::create(10 ).get())); 50 EXPECT_TRUE(AnimatableDouble::create(10)->equals(AnimatableDouble::create(10 ).get()));
51 EXPECT_FALSE(AnimatableDouble::create(5)->equals(AnimatableDouble::create(10 ).get())); 51 EXPECT_FALSE(AnimatableDouble::create(5)->equals(AnimatableDouble::create(10 ).get()));
52 } 52 }
53 53
54 TEST(AnimatableDoubleTest, ToCSSValue) 54 TEST(CoreAnimationAnimatableDoubleTest, ToCSSValue)
55 { 55 {
56 RefPtr<CSSValue> cssValue5 = CSSPrimitiveValue::create(5, CSSPrimitiveValue: :CSS_NUMBER); 56 RefPtr<CSSValue> cssValue5 = CSSPrimitiveValue::create(5, CSSPrimitiveValue: :CSS_NUMBER);
57 RefPtr<CSSValue> cssValue10 = CSSPrimitiveValue::create(10, CSSPrimitiveValu e::CSS_NUMBER); 57 RefPtr<CSSValue> cssValue10 = CSSPrimitiveValue::create(10, CSSPrimitiveValu e::CSS_NUMBER);
58 EXPECT_TRUE(AnimatableDouble::create(5)->toCSSValue()->equals(*cssValue5.get ())); 58 EXPECT_TRUE(AnimatableDouble::create(5)->toCSSValue()->equals(*cssValue5.get ()));
59 EXPECT_FALSE(AnimatableDouble::create(5)->toCSSValue()->equals(*cssValue10.g et())); 59 EXPECT_FALSE(AnimatableDouble::create(5)->toCSSValue()->equals(*cssValue10.g et()));
60 } 60 }
61 61
62 TEST(AnimatableDoubleTest, ToDouble) 62 TEST(CoreAnimationAnimatableDoubleTest, ToDouble)
63 { 63 {
64 EXPECT_EQ(5.9, AnimatableDouble::create(5.9)->toDouble()); 64 EXPECT_EQ(5.9, AnimatableDouble::create(5.9)->toDouble());
65 EXPECT_EQ(-10, AnimatableDouble::create(-10)->toDouble()); 65 EXPECT_EQ(-10, AnimatableDouble::create(-10)->toDouble());
66 } 66 }
67 67
68 68
69 TEST(AnimatableDoubleTest, Interpolate) 69 TEST(CoreAnimationAnimatableDoubleTest, Interpolate)
70 { 70 {
71 RefPtr<AnimatableDouble> from10 = AnimatableDouble::create(10); 71 RefPtr<AnimatableDouble> from10 = AnimatableDouble::create(10);
72 RefPtr<AnimatableDouble> to20 = AnimatableDouble::create(20); 72 RefPtr<AnimatableDouble> to20 = AnimatableDouble::create(20);
73 EXPECT_EQ(5, toAnimatableDouble(AnimatableValue::interpolate(from10.get(), t o20.get(), -0.5).get())->toDouble()); 73 EXPECT_EQ(5, toAnimatableDouble(AnimatableValue::interpolate(from10.get(), t o20.get(), -0.5).get())->toDouble());
74 EXPECT_EQ(10, toAnimatableDouble(AnimatableValue::interpolate(from10.get(), to20.get(), 0).get())->toDouble()); 74 EXPECT_EQ(10, toAnimatableDouble(AnimatableValue::interpolate(from10.get(), to20.get(), 0).get())->toDouble());
75 EXPECT_EQ(14, toAnimatableDouble(AnimatableValue::interpolate(from10.get(), to20.get(), 0.4).get())->toDouble()); 75 EXPECT_EQ(14, toAnimatableDouble(AnimatableValue::interpolate(from10.get(), to20.get(), 0.4).get())->toDouble());
76 EXPECT_EQ(15, toAnimatableDouble(AnimatableValue::interpolate(from10.get(), to20.get(), 0.5).get())->toDouble()); 76 EXPECT_EQ(15, toAnimatableDouble(AnimatableValue::interpolate(from10.get(), to20.get(), 0.5).get())->toDouble());
77 EXPECT_EQ(16, toAnimatableDouble(AnimatableValue::interpolate(from10.get(), to20.get(), 0.6).get())->toDouble()); 77 EXPECT_EQ(16, toAnimatableDouble(AnimatableValue::interpolate(from10.get(), to20.get(), 0.6).get())->toDouble());
78 EXPECT_EQ(20, toAnimatableDouble(AnimatableValue::interpolate(from10.get(), to20.get(), 1).get())->toDouble()); 78 EXPECT_EQ(20, toAnimatableDouble(AnimatableValue::interpolate(from10.get(), to20.get(), 1).get())->toDouble());
79 EXPECT_EQ(25, toAnimatableDouble(AnimatableValue::interpolate(from10.get(), to20.get(), 1.5).get())->toDouble()); 79 EXPECT_EQ(25, toAnimatableDouble(AnimatableValue::interpolate(from10.get(), to20.get(), 1.5).get())->toDouble());
80 } 80 }
81 81
82 TEST(AnimatableDoubleTest, Add) 82 TEST(CoreAnimationAnimatableDoubleTest, Add)
83 { 83 {
84 EXPECT_EQ(-10, toAnimatableDouble(AnimatableValue::add(AnimatableDouble::cre ate(-2).get(), AnimatableDouble::create(-8).get()).get())->toDouble()); 84 EXPECT_EQ(-10, toAnimatableDouble(AnimatableValue::add(AnimatableDouble::cre ate(-2).get(), AnimatableDouble::create(-8).get()).get())->toDouble());
85 EXPECT_EQ(0, toAnimatableDouble(AnimatableValue::add(AnimatableDouble::creat e(50).get(), AnimatableDouble::create(-50).get()).get())->toDouble()); 85 EXPECT_EQ(0, toAnimatableDouble(AnimatableValue::add(AnimatableDouble::creat e(50).get(), AnimatableDouble::create(-50).get()).get())->toDouble());
86 EXPECT_EQ(10, toAnimatableDouble(AnimatableValue::add(AnimatableDouble::crea te(4).get(), AnimatableDouble::create(6).get()).get())->toDouble()); 86 EXPECT_EQ(10, toAnimatableDouble(AnimatableValue::add(AnimatableDouble::crea te(4).get(), AnimatableDouble::create(6).get()).get())->toDouble());
87 EXPECT_EQ(20, toAnimatableDouble(AnimatableValue::add(AnimatableDouble::crea te(0).get(), AnimatableDouble::create(20).get()).get())->toDouble()); 87 EXPECT_EQ(20, toAnimatableDouble(AnimatableValue::add(AnimatableDouble::crea te(0).get(), AnimatableDouble::create(20).get()).get())->toDouble());
88 EXPECT_EQ(30, toAnimatableDouble(AnimatableValue::add(AnimatableDouble::crea te(30).get(), AnimatableDouble::create(0).get()).get())->toDouble()); 88 EXPECT_EQ(30, toAnimatableDouble(AnimatableValue::add(AnimatableDouble::crea te(30).get(), AnimatableDouble::create(0).get()).get())->toDouble());
89 } 89 }
90 90
91 } 91 }
OLDNEW
« no previous file with comments | « Source/core/animation/AnimatableColorTest.cpp ('k') | Source/core/animation/AnimatableLength.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698