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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 92 |
93 for (int x = 0; x < input.cursor_frames()[f].width(); ++x) { | 93 for (int x = 0; x < input.cursor_frames()[f].width(); ++x) { |
94 for (int y = 0; y < input.cursor_frames()[f].height(); ++y) { | 94 for (int y = 0; y < input.cursor_frames()[f].height(); ++y) { |
95 EXPECT_EQ(input.cursor_frames()[f].getColor(x, y), | 95 EXPECT_EQ(input.cursor_frames()[f].getColor(x, y), |
96 output.cursor_frames()[f].getColor(x, y)); | 96 output.cursor_frames()[f].getColor(x, y)); |
97 } | 97 } |
98 } | 98 } |
99 } | 99 } |
100 } | 100 } |
101 | 101 |
| 102 // Test that we deal with empty bitmaps. (When a cursor resource isn't loaded |
| 103 // in the renderer, the renderer will send a kCurstomCursor with an empty |
| 104 // bitmap.) |
| 105 TEST_F(CursorStructTraitsTest, TestEmptyCursor) { |
| 106 const base::TimeDelta kFrameDelay = base::TimeDelta::FromMilliseconds(15); |
| 107 const gfx::Point kHotspot = gfx::Point(5, 2); |
| 108 const float kScale = 2.0f; |
| 109 |
| 110 ui::CursorData input(kHotspot, {SkBitmap()}, kScale, kFrameDelay); |
| 111 |
| 112 ui::CursorData output; |
| 113 ASSERT_TRUE(EchoCursorData(input, &output)); |
| 114 |
| 115 ASSERT_EQ(1u, output.cursor_frames().size()); |
| 116 EXPECT_TRUE(output.cursor_frames().front().empty()); |
| 117 } |
| 118 |
102 } // namespace ui | 119 } // namespace ui |
OLD | NEW |