mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 19:01:15 +00:00
* Tests/gui/NSView/NSView_autoresize_and_rounding.m:
More autoresizing test cases git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33472 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
f4d911f81f
commit
81508c17ff
2 changed files with 60 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
|||
2011-07-06 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Tests/gui/NSView/NSView_autoresize_and_rounding.m:
|
||||
More autoresizing test cases
|
||||
|
||||
2011-07-06 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Tests/gui/NSView/NSView_autoresize_and_rounding.m:
|
||||
|
|
|
@ -42,19 +42,71 @@ int main(int argc, char **argv)
|
|||
|
||||
[NSApplication sharedApplication];
|
||||
window = [[NSWindow alloc] initWithContentRect: NSMakeRect(100,100,100,100)
|
||||
styleMask: NSClosableWindowMask
|
||||
styleMask: NSBorderlessWindowMask
|
||||
backing: NSBackingStoreRetained
|
||||
defer: YES];
|
||||
|
||||
view1 = [[NSView alloc] initWithFrame: NSMakeRect(10,10,10,10)];
|
||||
[[window contentView] addSubview: view1];
|
||||
|
||||
/**
|
||||
* Basic autoresizing test
|
||||
*/
|
||||
|
||||
// No autosizing
|
||||
|
||||
[view1 setAutoresizingMask: NSViewNotSizable];
|
||||
passed = CHECK(view1, NSMakeRect(10,10,10,10)) && passed;
|
||||
[window setContentSize: NSMakeSize(50, 100)];
|
||||
passed = CHECK(view1, NSMakeRect(10,10,10,10)) && passed;
|
||||
[window setContentSize: NSMakeSize(200, 100)];
|
||||
passed = CHECK(view1, NSMakeRect(10,10,10,10)) && passed;
|
||||
[window setContentSize: NSMakeSize(100, 100)];
|
||||
passed = CHECK(view1, NSMakeRect(10,10,10,10)) && passed;
|
||||
|
||||
// NSViewWidthSizable
|
||||
|
||||
[view1 setFrame: NSMakeRect(10,10,10,10)];
|
||||
[view1 setAutoresizingMask: NSViewWidthSizable];
|
||||
passed = CHECK(view1, NSMakeRect(10,10,10,10)) && passed;
|
||||
[window setContentSize: NSMakeSize(96, 100)];
|
||||
passed = CHECK(view1, NSMakeRect(10,10,6,10)) && passed;
|
||||
[window setContentSize: NSMakeSize(200, 100)];
|
||||
passed = CHECK(view1, NSMakeRect(10,10,110,10)) && passed;
|
||||
[window setContentSize: NSMakeSize(100, 100)];
|
||||
passed = CHECK(view1, NSMakeRect(10,10,10,10)) && passed;
|
||||
|
||||
// NSViewWidthSizable | NSViewMaxXMargin
|
||||
|
||||
[view1 setFrame: NSMakeRect(0,0,33,33)];
|
||||
[view1 setAutoresizingMask: NSViewWidthSizable | NSViewMaxXMargin];
|
||||
[window setContentSize: NSMakeSize(200, 100)];
|
||||
passed = CHECK(view1, NSMakeRect(0,0,66,33)) && passed;
|
||||
[window setContentSize: NSMakeSize(100, 100)];
|
||||
|
||||
// NSViewWidthSizable | NSViewMinXMargin
|
||||
|
||||
[view1 setFrame: NSMakeRect(50,0,25,25)];
|
||||
[view1 setAutoresizingMask: NSViewWidthSizable | NSViewMinXMargin];
|
||||
[window setContentSize: NSMakeSize(175, 100)];
|
||||
passed = CHECK(view1, NSMakeRect(100,0,50,25)) && passed;
|
||||
[window setContentSize: NSMakeSize(100, 100)];
|
||||
|
||||
|
||||
pass(passed,"NSView autoresizing works");
|
||||
|
||||
/**
|
||||
* Rounding test
|
||||
*/
|
||||
|
||||
passed = 1;
|
||||
[view1 setFrame: NSMakeRect(10, 10, 10, 10)];
|
||||
[view1 setAutoresizingMask: NSViewMinXMargin |
|
||||
NSViewWidthSizable |
|
||||
NSViewMaxXMargin |
|
||||
NSViewMinYMargin |
|
||||
NSViewHeightSizable |
|
||||
NSViewMaxYMargin ];
|
||||
|
||||
[[window contentView] addSubview: view1];
|
||||
|
||||
// All autoresize masks are enabled. Check that halving the
|
||||
// width and height of the window works as expected.
|
||||
|
|
Loading…
Reference in a new issue