| OLD | NEW |
| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 auto& op2 = outOps.asCcTransformOperations().at(2); | 67 auto& op2 = outOps.asCcTransformOperations().at(2); |
| 68 EXPECT_EQ(cc::TransformOperation::TRANSFORM_OPERATION_SCALE, op2.type); | 68 EXPECT_EQ(cc::TransformOperation::TRANSFORM_OPERATION_SCALE, op2.type); |
| 69 EXPECT_NEAR(op2.scale.x, 50.2f, err); | 69 EXPECT_NEAR(op2.scale.x, 50.2f, err); |
| 70 EXPECT_NEAR(op2.scale.y, 100.0f, err); | 70 EXPECT_NEAR(op2.scale.y, 100.0f, err); |
| 71 EXPECT_NEAR(op2.scale.z, -4.0f, err); | 71 EXPECT_NEAR(op2.scale.z, -4.0f, err); |
| 72 } | 72 } |
| 73 | 73 |
| 74 TEST(AnimationTranslationUtilTest, filtersWork) | 74 TEST(AnimationTranslationUtilTest, filtersWork) |
| 75 { | 75 { |
| 76 FilterOperations ops; | 76 FilterOperations ops; |
| 77 CompositorFilterOperations outOps; | |
| 78 | |
| 79 ops.operations().append(BasicColorMatrixFilterOperation::create(0.5, FilterO
peration::SATURATE)); | 77 ops.operations().append(BasicColorMatrixFilterOperation::create(0.5, FilterO
peration::SATURATE)); |
| 80 ops.operations().append(BasicColorMatrixFilterOperation::create(0.2, FilterO
peration::GRAYSCALE)); | 78 ops.operations().append(BasicColorMatrixFilterOperation::create(0.2, FilterO
peration::GRAYSCALE)); |
| 81 ops.operations().append(BasicColorMatrixFilterOperation::create(0.8, FilterO
peration::SEPIA)); | 79 ops.operations().append(BasicColorMatrixFilterOperation::create(0.8, FilterO
peration::SEPIA)); |
| 82 ops.operations().append(BasicComponentTransferFilterOperation::create(0.1, F
ilterOperation::OPACITY)); | 80 ops.operations().append(BasicComponentTransferFilterOperation::create(0.1, F
ilterOperation::OPACITY)); |
| 83 toCompositorFilterOperations(ops, &outOps); | 81 |
| 82 CompositorFilterOperations outOps = toCompositorFilterOperations(ops); |
| 84 | 83 |
| 85 EXPECT_EQ(4UL, outOps.asCcFilterOperations().size()); | 84 EXPECT_EQ(4UL, outOps.asCcFilterOperations().size()); |
| 86 const float err = 0.0001; | 85 const float err = 0.0001; |
| 87 | 86 |
| 88 auto& op0 = outOps.asCcFilterOperations().at(0); | 87 auto& op0 = outOps.asCcFilterOperations().at(0); |
| 89 EXPECT_EQ(cc::FilterOperation::SATURATE, op0.type()); | 88 EXPECT_EQ(cc::FilterOperation::SATURATE, op0.type()); |
| 90 EXPECT_NEAR(op0.amount(), 0.5f, err); | 89 EXPECT_NEAR(op0.amount(), 0.5f, err); |
| 91 | 90 |
| 92 auto& op1 = outOps.asCcFilterOperations().at(1); | 91 auto& op1 = outOps.asCcFilterOperations().at(1); |
| 93 EXPECT_EQ(cc::FilterOperation::GRAYSCALE, op1.type()); | 92 EXPECT_EQ(cc::FilterOperation::GRAYSCALE, op1.type()); |
| 94 EXPECT_NEAR(op1.amount(), 0.2f, err); | 93 EXPECT_NEAR(op1.amount(), 0.2f, err); |
| 95 | 94 |
| 96 auto& op2 = outOps.asCcFilterOperations().at(2); | 95 auto& op2 = outOps.asCcFilterOperations().at(2); |
| 97 EXPECT_EQ(cc::FilterOperation::SEPIA, op2.type()); | 96 EXPECT_EQ(cc::FilterOperation::SEPIA, op2.type()); |
| 98 EXPECT_NEAR(op2.amount(), 0.8f, err); | 97 EXPECT_NEAR(op2.amount(), 0.8f, err); |
| 99 | 98 |
| 100 auto& op3 = outOps.asCcFilterOperations().at(3); | 99 auto& op3 = outOps.asCcFilterOperations().at(3); |
| 101 EXPECT_EQ(cc::FilterOperation::OPACITY, op3.type()); | 100 EXPECT_EQ(cc::FilterOperation::OPACITY, op3.type()); |
| 102 EXPECT_NEAR(op3.amount(), 0.1f, err); | 101 EXPECT_NEAR(op3.amount(), 0.1f, err); |
| 103 } | 102 } |
| 104 | 103 |
| 105 } // namespace blink | 104 } // namespace blink |
| OLD | NEW |