Split scroll test in two, as only the visibleRect method wont work for

views without window.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33614 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2011-07-23 14:21:28 +00:00
parent c100baf6b4
commit 1043d6ecce
3 changed files with 40 additions and 0 deletions

View file

@ -1,3 +1,8 @@
2011-07-23 Fred Kiefer <FredKiefer@gmx.de>
* Tests/gui/NSView/NSView_visibleRect.m: New test.
* Tests/gui/NSView/scrollRectToVisible.m: Use an NSWindow.
2011-07-23 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSView.m (autoresize): Handle negative flexible space.

View file

@ -0,0 +1,26 @@
/*
copyright 2011 Fred Kiefer on 18.07.11.
*/
#include "Testing.h"
#include <Foundation/NSAutoreleasePool.h>
#include <Foundation/NSGeometry.h>
#include <AppKit/NSView.h>
int main(int argc, char **argv)
{
CREATE_AUTORELEASE_POOL(arp);
NSRect f = NSMakeRect(0,0,100,100);
NSView *v = [[NSView alloc] initWithFrame: f];
int passed = 1;
if (!NSEqualRects([v visibleRect], f))
{
passed = 0;
}
pass(passed, "NSView -visibleRect works");
DESTROY(arp);
return 0;
}

View file

@ -6,7 +6,9 @@ copyright 2004 Alexander Malmberg <alexander@malmberg.org>
#include <Foundation/NSAutoreleasePool.h>
#include <Foundation/NSGeometry.h>
#include <AppKit/NSApplication.h>
#include <AppKit/NSClipView.h>
#include <AppKit/NSWindow.h>
#define TEST(r,s) \
if (!NSEqualRects([v visibleRect],r)) \
@ -22,10 +24,17 @@ copyright 2004 Alexander Malmberg <alexander@malmberg.org>
int main(int argc, char **argv)
{
NSWindow *window;
CREATE_AUTORELEASE_POOL(arp);
NSClipView *cv=[[NSClipView alloc] initWithFrame: NSMakeRect(0,0,10,10)];
NSView *v=[[NSView alloc] initWithFrame: NSMakeRect(0,0,100,100)];
[cv setDocumentView: v];
[NSApplication sharedApplication];
window = [[NSWindow alloc] initWithContentRect: NSMakeRect(100,100,200,200)
styleMask: NSClosableWindowMask
backing: NSBackingStoreRetained
defer: YES];
[[window contentView] addSubview: cv];
/* Initial position. */
TEST(NSMakeRect(0,0,10,10),"1")