OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/strings/utf_string_conversions.h" | 5 #include "base/strings/utf_string_conversions.h" |
6 #include "ui/base/hit_test.h" | 6 #include "ui/base/hit_test.h" |
7 #include "ui/views/bubble/bubble_border.h" | 7 #include "ui/views/bubble/bubble_border.h" |
8 #include "ui/views/bubble/bubble_frame_view.h" | 8 #include "ui/views/bubble/bubble_frame_view.h" |
9 #include "ui/views/controls/button/checkbox.h" | 9 #include "ui/views/controls/button/checkbox.h" |
10 #include "ui/views/controls/button/label_button.h" | 10 #include "ui/views/controls/button/label_button.h" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 TEST_F(DialogTest, RemoveDefaultButton) { | 182 TEST_F(DialogTest, RemoveDefaultButton) { |
183 // Removing buttons from the dialog here should not cause a crash on close. | 183 // Removing buttons from the dialog here should not cause a crash on close. |
184 delete dialog()->GetDialogClientView()->ok_button(); | 184 delete dialog()->GetDialogClientView()->ok_button(); |
185 delete dialog()->GetDialogClientView()->cancel_button(); | 185 delete dialog()->GetDialogClientView()->cancel_button(); |
186 } | 186 } |
187 | 187 |
188 TEST_F(DialogTest, HitTest) { | 188 TEST_F(DialogTest, HitTest) { |
189 // Ensure that the new style's BubbleFrameView hit-tests as expected. | 189 // Ensure that the new style's BubbleFrameView hit-tests as expected. |
190 const NonClientView* view = dialog()->GetWidget()->non_client_view(); | 190 const NonClientView* view = dialog()->GetWidget()->non_client_view(); |
191 BubbleFrameView* frame = static_cast<BubbleFrameView*>(view->frame_view()); | 191 BubbleFrameView* frame = static_cast<BubbleFrameView*>(view->frame_view()); |
192 const int border = frame->bubble_border()->GetBorderThickness(); | 192 const int border = frame->bubble_border()->GetBorderExteriorThickness(); |
193 | 193 |
194 struct { | 194 struct { |
195 const int point; | 195 const int point; |
196 const int hit; | 196 const int hit; |
197 } cases[] = { | 197 } cases[] = { |
198 { border, HTSYSMENU }, | 198 { border, HTSYSMENU }, |
199 { border + 10, HTSYSMENU }, | 199 { border + 10, HTSYSMENU }, |
200 { border + 20, HTCAPTION }, | 200 { border + 20, HTCAPTION }, |
201 { border + 40, HTCLIENT }, | 201 { border + 40, HTCLIENT }, |
202 { border + 50, HTCLIENT }, | 202 { border + 50, HTCLIENT }, |
(...skipping 19 matching lines...) Expand all Loading... |
222 frame2->GetPreferredSize().height()); | 222 frame2->GetPreferredSize().height()); |
223 | 223 |
224 // Giving the default test dialog a title will yield the same bounds. | 224 // Giving the default test dialog a title will yield the same bounds. |
225 dialog()->set_title(base::ASCIIToUTF16("Title")); | 225 dialog()->set_title(base::ASCIIToUTF16("Title")); |
226 dialog()->GetWidget()->UpdateWindowTitle(); | 226 dialog()->GetWidget()->UpdateWindowTitle(); |
227 EXPECT_EQ(frame1->GetPreferredSize().height(), | 227 EXPECT_EQ(frame1->GetPreferredSize().height(), |
228 frame2->GetPreferredSize().height()); | 228 frame2->GetPreferredSize().height()); |
229 } | 229 } |
230 | 230 |
231 } // namespace views | 231 } // namespace views |
OLD | NEW |