OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "cc/resources/platform_color.h" |
| 6 |
| 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 |
| 9 namespace cc { |
| 10 namespace { |
| 11 |
| 12 // Verify SameComponentOrder on this platform. |
| 13 TEST(PlatformColorTest, SameComponentOrder) { |
| 14 bool rgba = !!SK_B32_SHIFT; |
| 15 |
| 16 for (size_t i = 0; i <= RESOURCE_FORMAT_MAX; ++i) { |
| 17 ResourceFormat format = static_cast<ResourceFormat>(i); |
| 18 switch (format) { |
| 19 case RGBA_8888: |
| 20 EXPECT_EQ(rgba, PlatformColor::SameComponentOrder(format)); |
| 21 break; |
| 22 case RGBA_4444: |
| 23 // RGBA_4444 indicates the number of bytes per pixel but the format |
| 24 // doesn't actually imply RGBA ordering. It uses the native ordering. |
| 25 EXPECT_EQ(true, PlatformColor::SameComponentOrder(format)); |
| 26 break; |
| 27 case BGRA_8888: |
| 28 EXPECT_NE(rgba, PlatformColor::SameComponentOrder(format)); |
| 29 break; |
| 30 case ALPHA_8: |
| 31 case LUMINANCE_8: |
| 32 case RGB_565: |
| 33 case ETC1: |
| 34 case RED_8: |
| 35 EXPECT_FALSE(PlatformColor::SameComponentOrder(format)); |
| 36 break; |
| 37 } |
| 38 } |
| 39 } |
| 40 |
| 41 } // namespace |
| 42 } // namespace cc |
OLD | NEW |