OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "services/ui/public/interfaces/cursor/cursor_struct_traits.h" | 5 #include "services/ui/public/interfaces/cursor/cursor_struct_traits.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "mojo/common/common_custom_types_struct_traits.h" | 8 #include "mojo/common/common_custom_types_struct_traits.h" |
9 #include "mojo/public/cpp/bindings/binding_set.h" | 9 #include "mojo/public/cpp/bindings/binding_set.h" |
10 #include "services/ui/public/interfaces/cursor/cursor.mojom.h" | 10 #include "services/ui/public/interfaces/cursor/cursor.mojom.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 EXPECT_TRUE(copy.IsSameAs(output)); | 82 EXPECT_TRUE(copy.IsSameAs(output)); |
83 | 83 |
84 // But make sure that the pixel data actually is equivalent. | 84 // But make sure that the pixel data actually is equivalent. |
85 ASSERT_EQ(input.cursor_frames().size(), output.cursor_frames().size()); | 85 ASSERT_EQ(input.cursor_frames().size(), output.cursor_frames().size()); |
86 for (size_t f = 0; f < input.cursor_frames().size(); ++f) { | 86 for (size_t f = 0; f < input.cursor_frames().size(); ++f) { |
87 ASSERT_EQ(input.cursor_frames()[f].width(), | 87 ASSERT_EQ(input.cursor_frames()[f].width(), |
88 output.cursor_frames()[f].width()); | 88 output.cursor_frames()[f].width()); |
89 ASSERT_EQ(input.cursor_frames()[f].height(), | 89 ASSERT_EQ(input.cursor_frames()[f].height(), |
90 output.cursor_frames()[f].height()); | 90 output.cursor_frames()[f].height()); |
91 | 91 |
92 input.cursor_frames()[f].lockPixels(); | |
93 output.cursor_frames()[f].lockPixels(); | |
94 for (int x = 0; x < input.cursor_frames()[f].width(); ++x) { | 92 for (int x = 0; x < input.cursor_frames()[f].width(); ++x) { |
95 for (int y = 0; y < input.cursor_frames()[f].height(); ++y) { | 93 for (int y = 0; y < input.cursor_frames()[f].height(); ++y) { |
96 EXPECT_EQ(input.cursor_frames()[f].getColor(x, y), | 94 EXPECT_EQ(input.cursor_frames()[f].getColor(x, y), |
97 output.cursor_frames()[f].getColor(x, y)); | 95 output.cursor_frames()[f].getColor(x, y)); |
98 } | 96 } |
99 } | 97 } |
100 | |
101 output.cursor_frames()[f].unlockPixels(); | |
102 input.cursor_frames()[f].unlockPixels(); | |
103 } | 98 } |
104 } | 99 } |
105 | 100 |
106 } // namespace ui | 101 } // namespace ui |
OLD | NEW |