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

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

Issue 2480813003: Reduce views::Border creation verbosity by promoting factory functions (Closed)
Patch Set: fix bad merge Created 4 years, 1 month 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
« no previous file with comments | « ui/views/examples/vector_example.cc ('k') | no next file » | 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 GetContentsView()->set_background( 303 GetContentsView()->set_background(
304 Background::CreateSolidBackground(SK_ColorWHITE)); 304 Background::CreateSolidBackground(SK_ColorWHITE));
305 305
306 Checkbox* cb = new Checkbox(ASCIIToUTF16("This is a checkbox")); 306 Checkbox* cb = new Checkbox(ASCIIToUTF16("This is a checkbox"));
307 GetContentsView()->AddChildView(cb); 307 GetContentsView()->AddChildView(cb);
308 // In this fast paced world, who really has time for non hard-coded layout? 308 // In this fast paced world, who really has time for non hard-coded layout?
309 cb->SetBounds(10, 10, 200, 20); 309 cb->SetBounds(10, 10, 200, 20);
310 cb->set_id(TOP_CHECKBOX_ID); 310 cb->set_id(TOP_CHECKBOX_ID);
311 311
312 left_container_ = new PaneView(); 312 left_container_ = new PaneView();
313 left_container_->SetBorder(Border::CreateSolidBorder(1, SK_ColorBLACK)); 313 left_container_->SetBorder(CreateSolidBorder(1, SK_ColorBLACK));
314 left_container_->set_background( 314 left_container_->set_background(
315 Background::CreateSolidBackground(240, 240, 240)); 315 Background::CreateSolidBackground(240, 240, 240));
316 left_container_->set_id(LEFT_CONTAINER_ID); 316 left_container_->set_id(LEFT_CONTAINER_ID);
317 GetContentsView()->AddChildView(left_container_); 317 GetContentsView()->AddChildView(left_container_);
318 left_container_->SetBounds(10, 35, 250, 200); 318 left_container_->SetBounds(10, 35, 250, 200);
319 319
320 int label_x = 5; 320 int label_x = 5;
321 int label_width = 50; 321 int label_width = 50;
322 int label_height = 15; 322 int label_height = 15;
323 int text_field_width = 150; 323 int text_field_width = 150;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 cb->set_id(FRUIT_CHECKBOX_ID); 387 cb->set_id(FRUIT_CHECKBOX_ID);
388 left_container_->AddChildView(cb); 388 left_container_->AddChildView(cb);
389 y += 20; 389 y += 20;
390 390
391 Combobox* combobox = new Combobox(&combobox_model_); 391 Combobox* combobox = new Combobox(&combobox_model_);
392 combobox->SetBounds(label_x + label_width + 5, y, 150, 30); 392 combobox->SetBounds(label_x + label_width + 5, y, 150, 30);
393 combobox->set_id(COMBOBOX_ID); 393 combobox->set_id(COMBOBOX_ID);
394 left_container_->AddChildView(combobox); 394 left_container_->AddChildView(combobox);
395 395
396 right_container_ = new PaneView(); 396 right_container_ = new PaneView();
397 right_container_->SetBorder(Border::CreateSolidBorder(1, SK_ColorBLACK)); 397 right_container_->SetBorder(CreateSolidBorder(1, SK_ColorBLACK));
398 right_container_->set_background( 398 right_container_->set_background(
399 Background::CreateSolidBackground(240, 240, 240)); 399 Background::CreateSolidBackground(240, 240, 240));
400 right_container_->set_id(RIGHT_CONTAINER_ID); 400 right_container_->set_id(RIGHT_CONTAINER_ID);
401 GetContentsView()->AddChildView(right_container_); 401 GetContentsView()->AddChildView(right_container_);
402 right_container_->SetBounds(270, 35, 300, 200); 402 right_container_->SetBounds(270, 35, 300, 200);
403 403
404 y = 10; 404 y = 10;
405 int radio_button_height = 18; 405 int radio_button_height = 18;
406 int gap_between_radio_buttons = 10; 406 int gap_between_radio_buttons = 10;
407 RadioButton* radio_button = new RadioButton(ASCIIToUTF16("Asparagus"), 1); 407 RadioButton* radio_button = new RadioButton(ASCIIToUTF16("Asparagus"), 1);
(...skipping 10 matching lines...) Expand all
418 RadioButton* radio_button_to_check = radio_button; 418 RadioButton* radio_button_to_check = radio_button;
419 y += radio_button_height + gap_between_radio_buttons; 419 y += radio_button_height + gap_between_radio_buttons;
420 radio_button = new RadioButton(ASCIIToUTF16("Cauliflower"), 1); 420 radio_button = new RadioButton(ASCIIToUTF16("Cauliflower"), 1);
421 radio_button->set_id(CAULIFLOWER_BUTTON_ID); 421 radio_button->set_id(CAULIFLOWER_BUTTON_ID);
422 right_container_->AddChildView(radio_button); 422 right_container_->AddChildView(radio_button);
423 radio_button->SetBounds(5, y, 70, radio_button_height); 423 radio_button->SetBounds(5, y, 70, radio_button_height);
424 radio_button->SetGroup(1); 424 radio_button->SetGroup(1);
425 y += radio_button_height + gap_between_radio_buttons; 425 y += radio_button_height + gap_between_radio_buttons;
426 426
427 View* inner_container = new View(); 427 View* inner_container = new View();
428 inner_container->SetBorder(Border::CreateSolidBorder(1, SK_ColorBLACK)); 428 inner_container->SetBorder(CreateSolidBorder(1, SK_ColorBLACK));
429 inner_container->set_background( 429 inner_container->set_background(
430 Background::CreateSolidBackground(230, 230, 230)); 430 Background::CreateSolidBackground(230, 230, 230));
431 inner_container->set_id(INNER_CONTAINER_ID); 431 inner_container->set_id(INNER_CONTAINER_ID);
432 right_container_->AddChildView(inner_container); 432 right_container_->AddChildView(inner_container);
433 inner_container->SetBounds(100, 10, 150, 180); 433 inner_container->SetBounds(100, 10, 150, 180);
434 434
435 ScrollView* scroll_view = new ScrollView(); 435 ScrollView* scroll_view = new ScrollView();
436 scroll_view->set_id(SCROLL_VIEW_ID); 436 scroll_view->set_id(SCROLL_VIEW_ID);
437 inner_container->AddChildView(scroll_view); 437 inner_container->AddChildView(scroll_view);
438 scroll_view->SetBounds(1, 1, 148, 178); 438 scroll_view->SetBounds(1, 1, 148, 178);
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 GetFocusManager()->AdvanceFocus(false); 879 GetFocusManager()->AdvanceFocus(false);
880 EXPECT_FALSE(GetFocusManager()->GetFocusedView()); 880 EXPECT_FALSE(GetFocusManager()->GetFocusedView());
881 881
882 // Advance backwards from the root node. 882 // Advance backwards from the root node.
883 GetFocusManager()->ClearFocus(); 883 GetFocusManager()->ClearFocus();
884 GetFocusManager()->AdvanceFocus(true); 884 GetFocusManager()->AdvanceFocus(true);
885 EXPECT_FALSE(GetFocusManager()->GetFocusedView()); 885 EXPECT_FALSE(GetFocusManager()->GetFocusedView());
886 } 886 }
887 887
888 } // namespace views 888 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/examples/vector_example.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698