mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-25 06:51:08 +00:00
* Tests/gui/NSView/NSView_autoresize_and_rounding.m: Add
centerScanRect test git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34103 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
f70becfe6e
commit
e52455a31f
2 changed files with 49 additions and 15 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2011-11-01 Eric Wasylishen <ewasylishen@gmail.com>
|
||||||
|
|
||||||
|
* Tests/gui/NSView/NSView_autoresize_and_rounding.m: Add
|
||||||
|
centerScanRect test
|
||||||
|
|
||||||
2011-10-31 Fred Kiefer <FredKiefer@gmx.de>
|
2011-10-31 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Tests/gui/NSSavePanel/setDelegate_reload.m: Switch the save panel to
|
* Tests/gui/NSSavePanel/setDelegate_reload.m: Switch the save panel to
|
||||||
|
|
|
@ -13,24 +13,32 @@
|
||||||
#include <AppKit/NSWindow.h>
|
#include <AppKit/NSWindow.h>
|
||||||
#include <AppKit/NSTextView.h>
|
#include <AppKit/NSTextView.h>
|
||||||
|
|
||||||
int CHECK(NSView *view, NSRect frame)
|
BOOL rects_almost_equal(NSRect r1, NSRect r2) {
|
||||||
{
|
if (fabs(r1.origin.x - r2.origin.x)>0.001
|
||||||
NSRect r;
|
|| fabs(r1.origin.y - r2.origin.y)>0.001
|
||||||
|
|| fabs(r1.size.width - r2.size.width)>0.001
|
||||||
r = [view frame];
|
|| fabs(r1.size.height - r2.size.height)>0.001)
|
||||||
if (fabs(r.origin.x - frame.origin.x)>0.001
|
|
||||||
|| fabs(r.origin.y - frame.origin.y)>0.001
|
|
||||||
|| fabs(r.size.width - frame.size.width)>0.001
|
|
||||||
|| fabs(r.size.height - frame.size.height)>0.001)
|
|
||||||
{
|
{
|
||||||
printf("(1) expected frame (%g %g)+(%g %g), got (%g %g)+(%g %g)\n",
|
printf("(1) expected frame (%g %g)+(%g %g), got (%g %g)+(%g %g)\n",
|
||||||
frame.origin.x, frame.origin.y, frame.size.width, frame.size.height,
|
r2.origin.x, r2.origin.y, r2.size.width, r2.size.height,
|
||||||
r.origin.x, r.origin.y, r.size.width, r.size.height);
|
r1.origin.x, r1.origin.y, r1.size.width, r1.size.height);
|
||||||
|
|
||||||
return 0;
|
return NO;
|
||||||
}
|
}
|
||||||
return 1;
|
else
|
||||||
|
{
|
||||||
|
return YES;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int CHECK(NSView *view, NSRect frame)
|
||||||
|
{
|
||||||
|
NSRect r = [view frame];
|
||||||
|
return rects_almost_equal(r, frame);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
@ -194,6 +202,27 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
pass(passed,"NSView autoresize rounding works");
|
pass(passed,"NSView autoresize rounding works");
|
||||||
|
|
||||||
|
// Test centerScanRect
|
||||||
|
|
||||||
|
{
|
||||||
|
NSView *view2 = [[NSView alloc] initWithFrame: NSMakeRect(0, 0, 100, 100)];
|
||||||
|
|
||||||
|
PASS(rects_almost_equal([view2 centerScanRect: NSMakeRect(0.5, 0.5, 100, 100)],
|
||||||
|
NSMakeRect(1, 1, 100, 100)),
|
||||||
|
"centerScanRect works 1");
|
||||||
|
PASS(rects_almost_equal([view2 centerScanRect: NSMakeRect(0.9, 0.9, 99.9, 99.9)],
|
||||||
|
NSMakeRect(1, 1, 100, 100)),
|
||||||
|
"centerScanRect works 2");
|
||||||
|
PASS(rects_almost_equal([view2 centerScanRect: NSMakeRect(0.9, 0.9, 99.4, 99.4)],
|
||||||
|
NSMakeRect(1, 1, 99, 99)),
|
||||||
|
"centerScanRect works 3");
|
||||||
|
PASS(rects_almost_equal([view2 centerScanRect: NSMakeRect(0.4, 0.4, 99.4, 99.4)],
|
||||||
|
NSMakeRect(0, 0, 100, 100)),
|
||||||
|
"centerScanRect works 4");
|
||||||
|
|
||||||
|
[view2 release];
|
||||||
|
}
|
||||||
|
|
||||||
DESTROY(arp);
|
DESTROY(arp);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue