Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: ui/views/window/dialog_delegate_unittest.cc

Issue 454173002: Fixed BubbleBorder sizing problems & added unit tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Combined test fixtures and rewrote tests to be more easily maintained. Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« ui/views/bubble/bubble_border_unittest.cc ('K') | « ui/views/bubble/tray_bubble_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698