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

Side by Side Diff: ui/views/window/dialog_delegate_unittest.cc

Issue 16361009: Do not allow Views new-dialog-style windows to be resized. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make DialogTest.HitTest more flexible. Created 7 years, 6 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 | « ui/views/views.gyp ('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) 2012 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 "ui/base/hit_test.h"
6 #include "ui/views/bubble/bubble_border.h"
7 #include "ui/views/bubble/bubble_frame_view.h"
8 #include "ui/views/test/views_test_base.h"
9 #include "ui/views/widget/widget.h"
10 #include "ui/views/window/dialog_delegate.h"
11
12 namespace views {
13
14 typedef ViewsTestBase DialogTest;
15
16 namespace {
17
18 class TestDialog : public DialogDelegateView {
19 public:
20 TestDialog() {}
21 virtual ~TestDialog() {}
22
23 // BubbleDelegateView overrides:
24 virtual gfx::Size GetPreferredSize() OVERRIDE { return gfx::Size(200, 200); }
25
26 private:
27 DISALLOW_COPY_AND_ASSIGN(TestDialog);
28 };
29
30 } // namespace
31
32 TEST_F(DialogTest, HitTest) {
33 TestDialog* dialog = new TestDialog();
34 DialogDelegate::CreateDialogWidget(dialog, NULL, GetContext());
35 const NonClientView* view = dialog->GetWidget()->non_client_view();
36
37 if (DialogDelegate::UseNewStyle()) {
38 // Ensure that the new style's BubbleFrameView hit-tests as expected.
39 BubbleFrameView* frame = static_cast<BubbleFrameView*>(view->frame_view());
40 const int border = frame->bubble_border()->GetBorderThickness();
41
42 struct {
43 const int point;
44 const int hit;
45 } cases[] = {
46 { border, HTSYSMENU },
47 { border + 10, HTSYSMENU },
48 { border + 20, HTCAPTION },
49 { border + 40, HTCLIENT },
50 { border + 50, HTCLIENT },
51 { 1000, HTNOWHERE },
52 };
53
54 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) {
55 gfx::Point point(cases[i].point, cases[i].point);
56 EXPECT_EQ(cases[i].hit, frame->NonClientHitTest(point))
57 << " with border: " << border << ", at point " << cases[i].point;
58 }
59 }
60 }
61
62 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/views.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698