mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-03 07:20:42 +00:00
* Tests/gui/NSSavePanel/setDelegate_reload.m: Rewrite to remove
use of @defs(). Base on idea by Wolfgang Lux <wolfgang.lux@gmail.com> git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@36313 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
12b5c60a5a
commit
87d76137a9
2 changed files with 62 additions and 75 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2013-03-08 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
|
* Tests/gui/NSSavePanel/setDelegate_reload.m: Rewrite to remove
|
||||||
|
use of @defs().
|
||||||
|
Base on idea by Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||||
|
|
||||||
2013-03-08 Fred Kiefer <FredKiefer@gmx.de>
|
2013-03-08 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Source/NSTableColumn.m (-initWithCoder:): Make columns
|
* Source/NSTableColumn.m (-initWithCoder:): Make columns
|
||||||
|
|
|
@ -7,20 +7,16 @@ delegate changes.
|
||||||
|
|
||||||
#include "Testing.h"
|
#include "Testing.h"
|
||||||
|
|
||||||
/*#include <Foundation/NSAutoreleasePool.h>
|
|
||||||
#include <Foundation/NSBundle.h>
|
|
||||||
#include <AppKit/NSApplication.h>
|
|
||||||
#include <AppKit/NSBrowser.h>
|
|
||||||
#include <AppKit/NSMatrix.h>
|
|
||||||
#include <AppKit/NSSavePanel.h>
|
|
||||||
#include <AppKit/NSWindow.h>*/
|
|
||||||
#include <AppKit/AppKit.h>
|
#include <AppKit/AppKit.h>
|
||||||
|
|
||||||
/* Ugly but automatable. :) */
|
@implementation NSSavePanel (TestDelegate)
|
||||||
typedef struct
|
|
||||||
|
- (NSMatrix *)lastColumnMatrix
|
||||||
{
|
{
|
||||||
@defs(NSSavePanel);
|
return [_browser matrixInColumn: [_browser lastColumn]];
|
||||||
} NSSavePanel_ivars;
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
@interface Delegate : NSObject
|
@interface Delegate : NSObject
|
||||||
@end
|
@end
|
||||||
|
@ -30,10 +26,9 @@ typedef struct
|
||||||
static BOOL pressed;
|
static BOOL pressed;
|
||||||
static NSSavePanel *sp;
|
static NSSavePanel *sp;
|
||||||
|
|
||||||
+(BOOL) panel: (NSSavePanel *)p
|
+ (BOOL) panel: (NSSavePanel *)p
|
||||||
shouldShowFilename: (NSString *)fname
|
shouldShowFilename: (NSString *)fname
|
||||||
{
|
{
|
||||||
// printf("should show '%s'?\n",[fname cString]);
|
|
||||||
if ([[fname lastPathComponent] isEqual: @"B"])
|
if ([[fname lastPathComponent] isEqual: @"B"])
|
||||||
{
|
{
|
||||||
return NO;
|
return NO;
|
||||||
|
@ -41,40 +36,30 @@ static NSSavePanel *sp;
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*+(void) foo
|
|
||||||
{
|
|
||||||
printf("did press button\n");
|
|
||||||
pressed=YES;
|
|
||||||
[sp validateVisibleColumns];
|
|
||||||
}*/
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
NSAutoreleasePool *arp=[NSAutoreleasePool new];
|
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
||||||
NSSavePanel *p;
|
NSSavePanel *p;
|
||||||
NSBrowser *b;
|
|
||||||
NSMatrix *m;
|
NSMatrix *m;
|
||||||
|
|
||||||
[NSApplication sharedApplication];
|
[NSApplication sharedApplication];
|
||||||
|
|
||||||
sp=p=[NSSavePanel savePanel];
|
p = [NSSavePanel savePanel];
|
||||||
[p setShowsHiddenFiles: NO];
|
[p setShowsHiddenFiles: NO];
|
||||||
[p setDirectory: [[[[[NSBundle mainBundle] bundlePath]
|
[p setDirectory: [[[[[NSBundle mainBundle] bundlePath]
|
||||||
stringByDeletingLastPathComponent] stringByDeletingLastPathComponent]
|
stringByDeletingLastPathComponent] stringByDeletingLastPathComponent]
|
||||||
stringByAppendingPathComponent: @"dummy"]];
|
stringByAppendingPathComponent: @"dummy"]];
|
||||||
|
|
||||||
b=((NSSavePanel_ivars *)p)->_browser;
|
m = [p lastColumnMatrix];
|
||||||
m=[b matrixInColumn: [b lastColumn]];
|
|
||||||
pass([m numberOfRows] == 2
|
pass([m numberOfRows] == 2
|
||||||
&& [[[m cellAtRow: 0 column: 0] stringValue] isEqual: @"A"]
|
&& [[[m cellAtRow: 0 column: 0] stringValue] isEqual: @"A"]
|
||||||
&& [[[m cellAtRow: 1 column: 0] stringValue] isEqual: @"B"],
|
&& [[[m cellAtRow: 1 column: 0] stringValue] isEqual: @"B"],
|
||||||
"browser initially contains all files");
|
"browser initially contains all files");
|
||||||
|
|
||||||
[p setDelegate: [Delegate self]];
|
[p setDelegate: [Delegate self]];
|
||||||
b=((NSSavePanel_ivars *)p)->_browser;
|
m = [p lastColumnMatrix];
|
||||||
m=[b matrixInColumn: [b lastColumn]];
|
|
||||||
pass([m numberOfRows] == 1
|
pass([m numberOfRows] == 1
|
||||||
&& [[[m cellAtRow: 0 column: 0] stringValue] isEqual: @"A"],
|
&& [[[m cellAtRow: 0 column: 0] stringValue] isEqual: @"A"],
|
||||||
"browser is reloaded after -setDelegate:");
|
"browser is reloaded after -setDelegate:");
|
||||||
|
@ -82,8 +67,7 @@ int main(int argc, char **argv)
|
||||||
/* Not really a -setDelegate: issue, but the other methods involved are
|
/* Not really a -setDelegate: issue, but the other methods involved are
|
||||||
documented as doing the wrong thing. */
|
documented as doing the wrong thing. */
|
||||||
[p setDelegate: nil];
|
[p setDelegate: nil];
|
||||||
b=((NSSavePanel_ivars *)p)->_browser;
|
m = [p lastColumnMatrix];
|
||||||
m=[b matrixInColumn: [b lastColumn]];
|
|
||||||
testHopeful = YES;
|
testHopeful = YES;
|
||||||
pass([m numberOfRows] == 2
|
pass([m numberOfRows] == 2
|
||||||
&& [[[m cellAtRow: 0 column: 0] stringValue] isEqual: @"A"]
|
&& [[[m cellAtRow: 0 column: 0] stringValue] isEqual: @"A"]
|
||||||
|
@ -91,10 +75,8 @@ int main(int argc, char **argv)
|
||||||
"browser contains all files after resetting delegate");
|
"browser contains all files after resetting delegate");
|
||||||
testHopeful = NO;
|
testHopeful = NO;
|
||||||
|
|
||||||
[b scrollColumnsLeftBy: [b lastColumn]];
|
|
||||||
[p setDelegate: [Delegate self]];
|
[p setDelegate: [Delegate self]];
|
||||||
b=((NSSavePanel_ivars *)p)->_browser;
|
m = [p lastColumnMatrix];
|
||||||
m=[b matrixInColumn: [b lastColumn]];
|
|
||||||
pass([m numberOfRows] == 1
|
pass([m numberOfRows] == 1
|
||||||
&& [[[m cellAtRow: 0 column: 0] stringValue] isEqual: @"A"],
|
&& [[[m cellAtRow: 0 column: 0] stringValue] isEqual: @"A"],
|
||||||
"browser is reloaded after -setDelegate: (2)");
|
"browser is reloaded after -setDelegate: (2)");
|
||||||
|
@ -102,4 +84,3 @@ int main(int argc, char **argv)
|
||||||
[arp release];
|
[arp release];
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue