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

Side by Side Diff: third_party/WebKit/Source/platform/animation/AnimationTranslationUtilTest.cpp

Issue 2615813003: Migrate WTF::Vector::append() to ::push_back() [part 14 of N] (Closed)
Patch Set: rebase, small fix in FontSettings.h Created 3 years, 11 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 21 matching lines...) Expand all
32 #include "platform/transforms/TranslateTransformOperation.h" 32 #include "platform/transforms/TranslateTransformOperation.h"
33 #include "testing/gtest/include/gtest/gtest.h" 33 #include "testing/gtest/include/gtest/gtest.h"
34 #include <memory> 34 #include <memory>
35 35
36 namespace blink { 36 namespace blink {
37 37
38 TEST(AnimationTranslationUtilTest, transformsWork) { 38 TEST(AnimationTranslationUtilTest, transformsWork) {
39 TransformOperations ops; 39 TransformOperations ops;
40 CompositorTransformOperations outOps; 40 CompositorTransformOperations outOps;
41 41
42 ops.operations().append(TranslateTransformOperation::create( 42 ops.operations().push_back(TranslateTransformOperation::create(
43 Length(2, Fixed), Length(0, Fixed), TransformOperation::TranslateX)); 43 Length(2, Fixed), Length(0, Fixed), TransformOperation::TranslateX));
44 ops.operations().append(RotateTransformOperation::create( 44 ops.operations().push_back(RotateTransformOperation::create(
45 0.1, 0.2, 0.3, 200000.4, TransformOperation::Rotate3D)); 45 0.1, 0.2, 0.3, 200000.4, TransformOperation::Rotate3D));
46 ops.operations().append(ScaleTransformOperation::create( 46 ops.operations().push_back(ScaleTransformOperation::create(
47 50.2, 100, -4, TransformOperation::Scale3D)); 47 50.2, 100, -4, TransformOperation::Scale3D));
48 toCompositorTransformOperations(ops, &outOps); 48 toCompositorTransformOperations(ops, &outOps);
49 49
50 EXPECT_EQ(3UL, outOps.asCcTransformOperations().size()); 50 EXPECT_EQ(3UL, outOps.asCcTransformOperations().size());
51 const float err = 0.0001; 51 const float err = 0.0001;
52 52
53 auto& op0 = outOps.asCcTransformOperations().at(0); 53 auto& op0 = outOps.asCcTransformOperations().at(0);
54 EXPECT_EQ(cc::TransformOperation::TRANSFORM_OPERATION_TRANSLATE, op0.type); 54 EXPECT_EQ(cc::TransformOperation::TRANSFORM_OPERATION_TRANSLATE, op0.type);
55 EXPECT_NEAR(op0.translate.x, 2.0f, err); 55 EXPECT_NEAR(op0.translate.x, 2.0f, err);
56 EXPECT_NEAR(op0.translate.y, 0.0f, err); 56 EXPECT_NEAR(op0.translate.y, 0.0f, err);
57 EXPECT_NEAR(op0.translate.z, 0.0f, err); 57 EXPECT_NEAR(op0.translate.z, 0.0f, err);
58 58
59 auto& op1 = outOps.asCcTransformOperations().at(1); 59 auto& op1 = outOps.asCcTransformOperations().at(1);
60 EXPECT_EQ(cc::TransformOperation::TRANSFORM_OPERATION_ROTATE, op1.type); 60 EXPECT_EQ(cc::TransformOperation::TRANSFORM_OPERATION_ROTATE, op1.type);
61 EXPECT_NEAR(op1.rotate.axis.x, 0.1f, err); 61 EXPECT_NEAR(op1.rotate.axis.x, 0.1f, err);
62 EXPECT_NEAR(op1.rotate.axis.y, 0.2f, err); 62 EXPECT_NEAR(op1.rotate.axis.y, 0.2f, err);
63 EXPECT_NEAR(op1.rotate.axis.z, 0.3f, err); 63 EXPECT_NEAR(op1.rotate.axis.z, 0.3f, err);
64 EXPECT_NEAR(op1.rotate.angle, 200000.4f, 0.01f); 64 EXPECT_NEAR(op1.rotate.angle, 200000.4f, 0.01f);
65 65
66 auto& op2 = outOps.asCcTransformOperations().at(2); 66 auto& op2 = outOps.asCcTransformOperations().at(2);
67 EXPECT_EQ(cc::TransformOperation::TRANSFORM_OPERATION_SCALE, op2.type); 67 EXPECT_EQ(cc::TransformOperation::TRANSFORM_OPERATION_SCALE, op2.type);
68 EXPECT_NEAR(op2.scale.x, 50.2f, err); 68 EXPECT_NEAR(op2.scale.x, 50.2f, err);
69 EXPECT_NEAR(op2.scale.y, 100.0f, err); 69 EXPECT_NEAR(op2.scale.y, 100.0f, err);
70 EXPECT_NEAR(op2.scale.z, -4.0f, err); 70 EXPECT_NEAR(op2.scale.z, -4.0f, err);
71 } 71 }
72 72
73 } // namespace blink 73 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698