| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #import "ui/views/widget/native_widget_mac.h" | 5 #import "ui/views/widget/native_widget_mac.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #import "base/mac/foundation_util.h" | 9 #import "base/mac/foundation_util.h" |
| 10 #import "base/mac/scoped_nsobject.h" | 10 #import "base/mac/scoped_nsobject.h" |
| (...skipping 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1252 actual = gfx::ScreenRectToNSRect(widget.GetWorkAreaBoundsInScreen()); | 1252 actual = gfx::ScreenRectToNSRect(widget.GetWorkAreaBoundsInScreen()); |
| 1253 EXPECT_TRUE(NSIsEmptyRect(actual)); | 1253 EXPECT_TRUE(NSIsEmptyRect(actual)); |
| 1254 } | 1254 } |
| 1255 | 1255 |
| 1256 // Test that Widget opacity can be changed. | 1256 // Test that Widget opacity can be changed. |
| 1257 TEST_F(NativeWidgetMacTest, ChangeOpacity) { | 1257 TEST_F(NativeWidgetMacTest, ChangeOpacity) { |
| 1258 Widget* widget = CreateTopLevelPlatformWidget(); | 1258 Widget* widget = CreateTopLevelPlatformWidget(); |
| 1259 NSWindow* ns_window = widget->GetNativeWindow(); | 1259 NSWindow* ns_window = widget->GetNativeWindow(); |
| 1260 | 1260 |
| 1261 CGFloat old_opacity = [ns_window alphaValue]; | 1261 CGFloat old_opacity = [ns_window alphaValue]; |
| 1262 widget->SetOpacity(0xAA); | 1262 widget->SetOpacity(.7f); |
| 1263 EXPECT_NE(old_opacity, [ns_window alphaValue]); | 1263 EXPECT_NE(old_opacity, [ns_window alphaValue]); |
| 1264 EXPECT_DOUBLE_EQ(0xAA / 255.0, [ns_window alphaValue]); | 1264 EXPECT_DOUBLE_EQ(.7, [ns_window alphaValue]); |
| 1265 | 1265 |
| 1266 widget->CloseNow(); | 1266 widget->CloseNow(); |
| 1267 } | 1267 } |
| 1268 | 1268 |
| 1269 // Test that NativeWidgetMac::SchedulePaintInRect correctly passes the dirtyRect | 1269 // Test that NativeWidgetMac::SchedulePaintInRect correctly passes the dirtyRect |
| 1270 // parameter to BridgedContentView::drawRect, for a titled window (window with a | 1270 // parameter to BridgedContentView::drawRect, for a titled window (window with a |
| 1271 // toolbar). | 1271 // toolbar). |
| 1272 TEST_F(NativeWidgetMacTest, SchedulePaintInRect_Titled) { | 1272 TEST_F(NativeWidgetMacTest, SchedulePaintInRect_Titled) { |
| 1273 Widget* widget = CreateTopLevelPlatformWidget(); | 1273 Widget* widget = CreateTopLevelPlatformWidget(); |
| 1274 | 1274 |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1585 lastDirtyRect_ = dirtyRect; | 1585 lastDirtyRect_ = dirtyRect; |
| 1586 } | 1586 } |
| 1587 | 1587 |
| 1588 @end | 1588 @end |
| 1589 | 1589 |
| 1590 @implementation FocusableTestNSView | 1590 @implementation FocusableTestNSView |
| 1591 - (BOOL)acceptsFirstResponder { | 1591 - (BOOL)acceptsFirstResponder { |
| 1592 return YES; | 1592 return YES; |
| 1593 } | 1593 } |
| 1594 @end | 1594 @end |
| OLD | NEW |