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

Side by Side Diff: views/widget/widget_win_unittest.cc

Issue 6268002: WidgetWin::SetBound on a maximized window leaves the window in the 'maximized' state. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updated copyright year in the modified files. Created 9 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « views/widget/widget_win.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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "views/widget/widget_win.h"
6
7 #include "base/basictypes.h"
8 #include "base/message_loop.h"
9 #include "base/scoped_ptr.h"
10 #include "testing/gtest/include/gtest/gtest.h"
11
12 using namespace views;
13
14 class WidgetWinTest : public testing::Test {
15 public:
16 WidgetWinTest() {
17 OleInitialize(NULL);
18 }
19
20 ~WidgetWinTest() {
21 OleUninitialize();
22 }
23
24 virtual void TearDown() {
25 // Flush the message loop because we have pending release tasks
26 // and these tasks if un-executed would upset Valgrind.
27 RunPendingMessages();
28 }
29
30 // Create a simple widget win. The caller is responsible for taking ownership
31 // of the returned value.
32 WidgetWin* CreateWidgetWin();
33
34 void RunPendingMessages() {
35 message_loop_.RunAllPending();
36 }
37
38 private:
39 MessageLoopForUI message_loop_;
40
41 DISALLOW_COPY_AND_ASSIGN(WidgetWinTest);
42 };
43
44
45 WidgetWin* WidgetWinTest::CreateWidgetWin() {
46 scoped_ptr<WidgetWin> window(new WidgetWin());
47 window->set_delete_on_destroy(false);
48 window->set_window_style(WS_OVERLAPPEDWINDOW);
49 window->Init(NULL, gfx::Rect(50, 50, 650, 650));
50 return window.release();
51 }
52
53 TEST_F(WidgetWinTest, ZoomWindow) {
54 scoped_ptr<WidgetWin> window(CreateWidgetWin());
55 window->ShowWindow(SW_HIDE);
56 EXPECT_FALSE(window->IsActive());
57 window->ShowWindow(SW_MAXIMIZE);
58 EXPECT_TRUE(window->IsZoomed());
59 window->CloseNow();
60 }
61
62 TEST_F(WidgetWinTest, SetBoundsForZoomedWindow) {
63 scoped_ptr<WidgetWin> window(CreateWidgetWin());
64 window->ShowWindow(SW_MAXIMIZE);
65 EXPECT_TRUE(window->IsZoomed());
66
67 // Create another window, so that it will be active.
68 scoped_ptr<WidgetWin> window2(CreateWidgetWin());
69 window2->ShowWindow(SW_MAXIMIZE);
70 EXPECT_TRUE(window2->IsActive());
71
72 // Verify that setting the bounds of a zoomed window will unzoom it and not
73 // cause it to be activated.
74 window->SetBounds(gfx::Rect(50, 50, 650, 650));
75 EXPECT_FALSE(window->IsZoomed());
76 EXPECT_FALSE(window->IsActive());
77
78 // Cleanup.
79 window->CloseNow();
80 window2->CloseNow();
81 }
OLDNEW
« no previous file with comments | « views/widget/widget_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698