• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright (c) 2013 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#import "ui/base/cocoa/nsgraphics_context_additions.h"
6
7#include "base/mac/scoped_nsobject.h"
8#import "ui/gfx/test/ui_cocoa_test_helper.h"
9
10typedef ui::CocoaTest NSGraphicsContextCrAdditionsTest;
11
12// Test fails, see http://crbug.com/249241
13TEST_F(NSGraphicsContextCrAdditionsTest, DISABLED_PatternPhase) {
14  NSRect frame = NSMakeRect(50, 50, 100, 100);
15  base::scoped_nsobject<NSView> view([[NSView alloc] initWithFrame:frame]);
16  [[test_window() contentView] addSubview:view];
17
18  [view lockFocus];
19  NSGraphicsContext* context = [NSGraphicsContext currentContext];
20
21  [context cr_setPatternPhase:NSZeroPoint forView:view];
22  EXPECT_EQ(0, [context patternPhase].y);
23
24  [view setWantsLayer:YES];
25  [context cr_setPatternPhase:NSZeroPoint forView:view];
26  EXPECT_EQ(-NSMinY(frame), [context patternPhase].y);
27
28  [view unlockFocus];
29}
30