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

Side by Side Diff: ui/views/focus/focus_traversal_unittest.cc

Issue 145033006: views: Make View::set_border() take a scoped_ptr<>. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to ToT Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « ui/views/examples/text_example.cc ('k') | ui/views/linux_ui/linux_ui.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/views/focus/focus_manager.h" 5 #include "ui/views/focus/focus_manager.h"
6 6
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "ui/base/models/combobox_model.h" 10 #include "ui/base/models/combobox_model.h"
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 GetContentsView()->set_background( 289 GetContentsView()->set_background(
290 Background::CreateSolidBackground(SK_ColorWHITE)); 290 Background::CreateSolidBackground(SK_ColorWHITE));
291 291
292 Checkbox* cb = new Checkbox(ASCIIToUTF16("This is a checkbox")); 292 Checkbox* cb = new Checkbox(ASCIIToUTF16("This is a checkbox"));
293 GetContentsView()->AddChildView(cb); 293 GetContentsView()->AddChildView(cb);
294 // In this fast paced world, who really has time for non hard-coded layout? 294 // In this fast paced world, who really has time for non hard-coded layout?
295 cb->SetBounds(10, 10, 200, 20); 295 cb->SetBounds(10, 10, 200, 20);
296 cb->set_id(kTopCheckBoxID); 296 cb->set_id(kTopCheckBoxID);
297 297
298 left_container_ = new PaneView(); 298 left_container_ = new PaneView();
299 left_container_->set_border(Border::CreateSolidBorder(1, SK_ColorBLACK)); 299 left_container_->SetBorder(Border::CreateSolidBorder(1, SK_ColorBLACK));
300 left_container_->set_background( 300 left_container_->set_background(
301 Background::CreateSolidBackground(240, 240, 240)); 301 Background::CreateSolidBackground(240, 240, 240));
302 left_container_->set_id(kLeftContainerID); 302 left_container_->set_id(kLeftContainerID);
303 GetContentsView()->AddChildView(left_container_); 303 GetContentsView()->AddChildView(left_container_);
304 left_container_->SetBounds(10, 35, 250, 200); 304 left_container_->SetBounds(10, 35, 250, 200);
305 305
306 int label_x = 5; 306 int label_x = 5;
307 int label_width = 50; 307 int label_width = 50;
308 int label_height = 15; 308 int label_height = 15;
309 int text_field_width = 150; 309 int text_field_width = 150;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 cb->set_id(kFruitCheckBoxID); 374 cb->set_id(kFruitCheckBoxID);
375 left_container_->AddChildView(cb); 375 left_container_->AddChildView(cb);
376 y += 20; 376 y += 20;
377 377
378 Combobox* combobox = new Combobox(&combobox_model_); 378 Combobox* combobox = new Combobox(&combobox_model_);
379 combobox->SetBounds(label_x + label_width + 5, y, 150, 30); 379 combobox->SetBounds(label_x + label_width + 5, y, 150, 30);
380 combobox->set_id(kComboboxID); 380 combobox->set_id(kComboboxID);
381 left_container_->AddChildView(combobox); 381 left_container_->AddChildView(combobox);
382 382
383 right_container_ = new PaneView(); 383 right_container_ = new PaneView();
384 right_container_->set_border(Border::CreateSolidBorder(1, SK_ColorBLACK)); 384 right_container_->SetBorder(Border::CreateSolidBorder(1, SK_ColorBLACK));
385 right_container_->set_background( 385 right_container_->set_background(
386 Background::CreateSolidBackground(240, 240, 240)); 386 Background::CreateSolidBackground(240, 240, 240));
387 right_container_->set_id(kRightContainerID); 387 right_container_->set_id(kRightContainerID);
388 GetContentsView()->AddChildView(right_container_); 388 GetContentsView()->AddChildView(right_container_);
389 right_container_->SetBounds(270, 35, 300, 200); 389 right_container_->SetBounds(270, 35, 300, 200);
390 390
391 y = 10; 391 y = 10;
392 int radio_button_height = 18; 392 int radio_button_height = 18;
393 int gap_between_radio_buttons = 10; 393 int gap_between_radio_buttons = 10;
394 RadioButton* radio_button = new RadioButton(ASCIIToUTF16("Asparagus"), 1); 394 RadioButton* radio_button = new RadioButton(ASCIIToUTF16("Asparagus"), 1);
(...skipping 10 matching lines...) Expand all
405 RadioButton* radio_button_to_check = radio_button; 405 RadioButton* radio_button_to_check = radio_button;
406 y += radio_button_height + gap_between_radio_buttons; 406 y += radio_button_height + gap_between_radio_buttons;
407 radio_button = new RadioButton(ASCIIToUTF16("Cauliflower"), 1); 407 radio_button = new RadioButton(ASCIIToUTF16("Cauliflower"), 1);
408 radio_button->set_id(kCauliflowerButtonID); 408 radio_button->set_id(kCauliflowerButtonID);
409 right_container_->AddChildView(radio_button); 409 right_container_->AddChildView(radio_button);
410 radio_button->SetBounds(5, y, 70, radio_button_height); 410 radio_button->SetBounds(5, y, 70, radio_button_height);
411 radio_button->SetGroup(1); 411 radio_button->SetGroup(1);
412 y += radio_button_height + gap_between_radio_buttons; 412 y += radio_button_height + gap_between_radio_buttons;
413 413
414 View* inner_container = new View(); 414 View* inner_container = new View();
415 inner_container->set_border(Border::CreateSolidBorder(1, SK_ColorBLACK)); 415 inner_container->SetBorder(Border::CreateSolidBorder(1, SK_ColorBLACK));
416 inner_container->set_background( 416 inner_container->set_background(
417 Background::CreateSolidBackground(230, 230, 230)); 417 Background::CreateSolidBackground(230, 230, 230));
418 inner_container->set_id(kInnerContainerID); 418 inner_container->set_id(kInnerContainerID);
419 right_container_->AddChildView(inner_container); 419 right_container_->AddChildView(inner_container);
420 inner_container->SetBounds(100, 10, 150, 180); 420 inner_container->SetBounds(100, 10, 150, 180);
421 421
422 ScrollView* scroll_view = new ScrollView(); 422 ScrollView* scroll_view = new ScrollView();
423 scroll_view->set_id(kScrollViewID); 423 scroll_view->set_id(kScrollViewID);
424 inner_container->AddChildView(scroll_view); 424 inner_container->AddChildView(scroll_view);
425 scroll_view->SetBounds(1, 1, 148, 178); 425 scroll_view->SetBounds(1, 1, 148, 178);
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 GetFocusManager()->AdvanceFocus(true); 784 GetFocusManager()->AdvanceFocus(true);
785 View* focused_view = GetFocusManager()->GetFocusedView(); 785 View* focused_view = GetFocusManager()->GetFocusedView();
786 EXPECT_TRUE(focused_view != NULL); 786 EXPECT_TRUE(focused_view != NULL);
787 if (focused_view) 787 if (focused_view)
788 EXPECT_EQ(kRightTraversalIDs[j], focused_view->id()); 788 EXPECT_EQ(kRightTraversalIDs[j], focused_view->id());
789 } 789 }
790 } 790 }
791 } 791 }
792 792
793 } // namespace views 793 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/examples/text_example.cc ('k') | ui/views/linux_ui/linux_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698