OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/mac/scoped_nsobject.h" | 5 #include "base/mac/scoped_nsobject.h" |
6 #include "testing/gtest_mac.h" | 6 #include "testing/gtest_mac.h" |
7 #import "ui/base/cocoa/controls/hyperlink_text_view.h" | 7 #import "ui/base/cocoa/controls/hyperlink_text_view.h" |
8 #import "ui/gfx/test/ui_cocoa_test_helper.h" | 8 #import "ui/gfx/test/ui_cocoa_test_helper.h" |
9 | 9 |
10 namespace { | 10 namespace { |
(...skipping 22 matching lines...) Expand all Loading... |
33 NSBaselineOffsetAttributeName : @(kTextBaselineShift) | 33 NSBaselineOffsetAttributeName : @(kTextBaselineShift) |
34 }; | 34 }; |
35 } | 35 } |
36 | 36 |
37 NSMutableDictionary* GetDefaultLinkAttributes() { | 37 NSMutableDictionary* GetDefaultLinkAttributes() { |
38 if (!linkAttributes_.get()) { | 38 if (!linkAttributes_.get()) { |
39 linkAttributes_.reset( | 39 linkAttributes_.reset( |
40 [[NSMutableDictionary dictionaryWithDictionary: | 40 [[NSMutableDictionary dictionaryWithDictionary: |
41 GetDefaultTextAttributes()] retain]); | 41 GetDefaultTextAttributes()] retain]); |
42 [linkAttributes_ addEntriesFromDictionary:@{ | 42 [linkAttributes_ addEntriesFromDictionary:@{ |
43 NSForegroundColorAttributeName : [NSColor blueColor], | 43 NSForegroundColorAttributeName : [NSColor blueColor], |
44 NSUnderlineStyleAttributeName : @(YES), | 44 NSUnderlineStyleAttributeName : @(YES), |
45 NSCursorAttributeName : [NSCursor pointingHandCursor], | 45 NSCursorAttributeName : [NSCursor pointingHandCursor], |
46 NSUnderlineStyleAttributeName : @(NSSingleUnderlineStyle), | 46 NSUnderlineStyleAttributeName : @(NSUnderlineStyleSingle), |
47 NSLinkAttributeName : @""}]; | 47 NSLinkAttributeName : @"" |
| 48 }]; |
48 } | 49 } |
49 return [NSMutableDictionary dictionaryWithDictionary:linkAttributes_]; | 50 return [NSMutableDictionary dictionaryWithDictionary:linkAttributes_]; |
50 } | 51 } |
51 | 52 |
52 HyperlinkTextView* view_; | 53 HyperlinkTextView* view_; |
53 | 54 |
54 private: | 55 private: |
55 base::scoped_nsobject<NSMutableDictionary> linkAttributes_; | 56 base::scoped_nsobject<NSMutableDictionary> linkAttributes_; |
56 }; | 57 }; |
57 | 58 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 131 |
131 TEST_F(HyperlinkTextViewTest, FirstResponderBehavior) { | 132 TEST_F(HyperlinkTextViewTest, FirstResponderBehavior) { |
132 // By default, accept. | 133 // By default, accept. |
133 EXPECT_TRUE([view_ acceptsFirstResponder]); | 134 EXPECT_TRUE([view_ acceptsFirstResponder]); |
134 | 135 |
135 [view_ setRefusesFirstResponder:YES]; | 136 [view_ setRefusesFirstResponder:YES]; |
136 EXPECT_FALSE([view_ acceptsFirstResponder]); | 137 EXPECT_FALSE([view_ acceptsFirstResponder]); |
137 } | 138 } |
138 | 139 |
139 } // namespace | 140 } // namespace |
OLD | NEW |