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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 EXPECT_EQ(AnimatableColorImpl(Color(0xFF001020)).interpolateTo(Color(0xFF408
0C0), 3. / 16).toColor().rgb(), 0xFF0C253E); | 59 EXPECT_EQ(AnimatableColorImpl(Color(0xFF001020)).interpolateTo(Color(0xFF408
0C0), 3. / 16).toColor().rgb(), 0xFF0C253E); |
60 | 60 |
61 EXPECT_EQ(AnimatableColorImpl(Color(0x0000FF00)).interpolateTo(Color(0xFFFF0
0FF), 0.5).toColor().rgb(), 0x80FF00FF); | 61 EXPECT_EQ(AnimatableColorImpl(Color(0x0000FF00)).interpolateTo(Color(0xFFFF0
0FF), 0.5).toColor().rgb(), 0x80FF00FF); |
62 EXPECT_EQ(AnimatableColorImpl(Color(0x4000FF00)).interpolateTo(Color(0x80FF0
0FF), 0.5).toColor().rgb(), 0x60AA55AAu); | 62 EXPECT_EQ(AnimatableColorImpl(Color(0x4000FF00)).interpolateTo(Color(0x80FF0
0FF), 0.5).toColor().rgb(), 0x60AA55AAu); |
63 EXPECT_EQ(AnimatableColorImpl(Color(0x40FF00FF)).interpolateTo(Color(0x80FFF
FFF), 0.5).toColor().rgb(), 0x60FFAAFFu); | 63 EXPECT_EQ(AnimatableColorImpl(Color(0x40FF00FF)).interpolateTo(Color(0x80FFF
FFF), 0.5).toColor().rgb(), 0x60FFAAFFu); |
64 | 64 |
65 EXPECT_EQ(AnimatableColorImpl(Color(0x10204080)).interpolateTo(Color(0x10408
0C0), 0.5).toColor().rgb(), 0x103060A0u); | 65 EXPECT_EQ(AnimatableColorImpl(Color(0x10204080)).interpolateTo(Color(0x10408
0C0), 0.5).toColor().rgb(), 0x103060A0u); |
66 } | 66 } |
67 | 67 |
68 TEST(AnimationAnimatableColorTest, Distance) | |
69 { | |
70 EXPECT_NEAR(1.0, AnimatableColorImpl(Color(0xFF000000)).distanceTo(Color(0xF
FFF0000)), 0.00000001); | |
71 EXPECT_NEAR(13.0 / 255, AnimatableColorImpl(Color(0xFF53647C)).distanceTo(Co
lor(0xFF506070)), 0.00000001); | |
72 EXPECT_NEAR(60.0 / 255, AnimatableColorImpl(Color(0x3C000000)).distanceTo(Co
lor(0x00FFFFFF)), 0.00000001); | |
73 EXPECT_NEAR(60.0 / 255, AnimatableColorImpl(Color(0x3C000000)).distanceTo(Co
lor(0x3C00FF00)), 0.00000001); | |
74 | |
75 RefPtrWillBeRawPtr<AnimatableColor> first = AnimatableColor::create(Animatab
leColorImpl(Color(0xFF53647C)), AnimatableColorImpl(Color(0xFF000000))); | |
76 RefPtrWillBeRawPtr<AnimatableColor> second = AnimatableColor::create(Animata
bleColorImpl(Color(0xFF506070)), AnimatableColorImpl(Color(0xFF000000))); | |
77 EXPECT_NEAR(13.0 / 255, AnimatableValue::distance(first.get(), second.get())
, 0.00000001); | |
78 } | 68 } |
79 | |
80 } | |
OLD | NEW |