| 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 widget->Init(params); | 329 widget->Init(params); |
| 330 View* container = new View(); | 330 View* container = new View(); |
| 331 widget->SetContentsView(container); | 331 widget->SetContentsView(container); |
| 332 container->AddChildView(styled()); | 332 container->AddChildView(styled()); |
| 333 | 333 |
| 334 // Obtain the default text color for a label. | 334 // Obtain the default text color for a label. |
| 335 Label* label = new Label(ASCIIToUTF16(text)); | 335 Label* label = new Label(ASCIIToUTF16(text)); |
| 336 container->AddChildView(label); | 336 container->AddChildView(label); |
| 337 const SkColor kDefaultTextColor = label->enabled_color(); | 337 const SkColor kDefaultTextColor = label->enabled_color(); |
| 338 | 338 |
| 339 // Obtain the default text color for a link; | 339 // Obtain the default text color for a link. |
| 340 Link* link = new Link(ASCIIToUTF16(text_link)); | 340 Link* link = new Link(ASCIIToUTF16(text_link)); |
| 341 container->AddChildView(link); | 341 container->AddChildView(link); |
| 342 const SkColor kDefaultLinkColor = link->enabled_color(); | 342 const SkColor kDefaultLinkColor = link->enabled_color(); |
| 343 | 343 |
| 344 EXPECT_EQ(SK_ColorRED, | 344 EXPECT_EQ(SK_ColorRED, |
| 345 static_cast<Label*>(styled()->child_at(0))->enabled_color()); | 345 static_cast<Label*>(styled()->child_at(0))->enabled_color()); |
| 346 EXPECT_EQ(kDefaultLinkColor, | 346 EXPECT_EQ(kDefaultLinkColor, |
| 347 static_cast<Label*>(styled()->child_at(1))->enabled_color()); | 347 static_cast<Label*>(styled()->child_at(1))->enabled_color()); |
| 348 EXPECT_EQ(kDefaultTextColor, | 348 EXPECT_EQ(kDefaultTextColor, |
| 349 static_cast<Label*>(styled()->child_at(2))->enabled_color()); | 349 static_cast<Label*>(styled()->child_at(2))->enabled_color()); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 // all controls should be recreated | 487 // all controls should be recreated |
| 488 styled()->SetText(another_text); | 488 styled()->SetText(another_text); |
| 489 int updated_height = styled()->GetHeightForWidth(styled()->width()); | 489 int updated_height = styled()->GetHeightForWidth(styled()->width()); |
| 490 EXPECT_NE(updated_height, real_height); | 490 EXPECT_NE(updated_height, real_height); |
| 491 View* first_child_after_text_update = styled()->has_children() ? | 491 View* first_child_after_text_update = styled()->has_children() ? |
| 492 styled()->child_at(0) : nullptr; | 492 styled()->child_at(0) : nullptr; |
| 493 EXPECT_NE(first_child_after_text_update, first_child_after_layout); | 493 EXPECT_NE(first_child_after_text_update, first_child_after_layout); |
| 494 } | 494 } |
| 495 | 495 |
| 496 } // namespace views | 496 } // namespace views |
| OLD | NEW |