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

Unified Diff: chrome/browser/ui/cocoa/hover_image_button_unittest.mm

Issue 12937008: Move HoverButton and HoverImageButton from chrome/browser/ui/cocoa/ to ui/base/cocoa. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/hover_image_button_unittest.mm
diff --git a/chrome/browser/ui/cocoa/hover_image_button_unittest.mm b/chrome/browser/ui/cocoa/hover_image_button_unittest.mm
deleted file mode 100644
index 7702c5c703ca74d87c953a2fe50ada0e6b59198a..0000000000000000000000000000000000000000
--- a/chrome/browser/ui/cocoa/hover_image_button_unittest.mm
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#import <Cocoa/Cocoa.h>
-
-#include "base/memory/scoped_nsobject.h"
-#import "chrome/browser/ui/cocoa/cocoa_test_helper.h"
-#import "chrome/browser/ui/cocoa/hover_image_button.h"
-#include "grit/theme_resources.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "ui/base/resource/resource_bundle.h"
-#include "ui/gfx/image/image.h"
-
-namespace {
-
-class HoverImageButtonTest : public CocoaTest {
- public:
- HoverImageButtonTest() {
- NSRect content_frame = [[test_window() contentView] frame];
- scoped_nsobject<HoverImageButton> button(
- [[HoverImageButton alloc] initWithFrame:content_frame]);
- button_ = button.get();
- [[test_window() contentView] addSubview:button_];
- }
-
- void DrawRect() {
- [button_ lockFocus];
- [button_ drawRect:[button_ bounds]];
- [button_ unlockFocus];
- }
-
- HoverImageButton* button_;
-};
-
-// Test mouse events.
-TEST_F(HoverImageButtonTest, ImageSwap) {
- ResourceBundle& rb = ResourceBundle::GetSharedInstance();
- NSImage* image = rb.GetNativeImageNamed(IDR_HOME).ToNSImage();
- NSImage* hover = rb.GetNativeImageNamed(IDR_BACK).ToNSImage();
- [button_ setDefaultImage:image];
- [button_ setHoverImage:hover];
-
- [button_ mouseEntered:nil];
- DrawRect();
- EXPECT_EQ([button_ image], hover);
- [button_ mouseExited:nil];
- DrawRect();
- EXPECT_NE([button_ image], hover);
- EXPECT_EQ([button_ image], image);
-}
-
-// Test mouse events.
-TEST_F(HoverImageButtonTest, Opacity) {
- ResourceBundle& rb = ResourceBundle::GetSharedInstance();
- NSImage* image = rb.GetNativeImageNamed(IDR_HOME).ToNSImage();
- [button_ setDefaultImage:image];
- [button_ setDefaultOpacity:0.5];
- [button_ setHoverImage:image];
- [button_ setHoverOpacity:1.0];
-
- [button_ mouseEntered:nil];
- DrawRect();
- EXPECT_EQ([button_ alphaValue], 1.0);
- [button_ mouseExited:nil];
- DrawRect();
- EXPECT_EQ([button_ alphaValue], 0.5);
-}
-
-} // namespace

Powered by Google App Engine
This is Rietveld 408576698