mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-01 09:51:56 +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
139d309a73
commit
1f27e0ce61
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>
|
2011-07-06 Eric Wasylishen <ewasylishen@gmail.com>
|
||||||
|
|
||||||
* Tests/gui/NSView/NSView_autoresize_and_rounding.m:
|
* Tests/gui/NSView/NSView_autoresize_and_rounding.m:
|
||||||
|
|
|
@ -42,19 +42,71 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
[NSApplication sharedApplication];
|
[NSApplication sharedApplication];
|
||||||
window = [[NSWindow alloc] initWithContentRect: NSMakeRect(100,100,100,100)
|
window = [[NSWindow alloc] initWithContentRect: NSMakeRect(100,100,100,100)
|
||||||
styleMask: NSClosableWindowMask
|
styleMask: NSBorderlessWindowMask
|
||||||
backing: NSBackingStoreRetained
|
backing: NSBackingStoreRetained
|
||||||
defer: YES];
|
defer: YES];
|
||||||
|
|
||||||
view1 = [[NSView alloc] initWithFrame: NSMakeRect(10,10,10,10)];
|
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 |
|
[view1 setAutoresizingMask: NSViewMinXMargin |
|
||||||
NSViewWidthSizable |
|
NSViewWidthSizable |
|
||||||
NSViewMaxXMargin |
|
NSViewMaxXMargin |
|
||||||
NSViewMinYMargin |
|
NSViewMinYMargin |
|
||||||
NSViewHeightSizable |
|
NSViewHeightSizable |
|
||||||
NSViewMaxYMargin ];
|
NSViewMaxYMargin ];
|
||||||
|
|
||||||
[[window contentView] addSubview: view1];
|
|
||||||
|
|
||||||
// All autoresize masks are enabled. Check that halving the
|
// All autoresize masks are enabled. Check that halving the
|
||||||
// width and height of the window works as expected.
|
// width and height of the window works as expected.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue