[Vm-beginners] Re: Objective C Test Failures

Sean P. DeNigris sean at clipperadams.com
Fri May 20 00:02:20 UTC 2011


John McIntosh wrote:
> 
> UIApplication is an iOS class that does not exist on OS-x.
> 

Thanks John. I replaced it with NSApplication, and got (with help from
Mathieu Suen's blog; although I'm pretty much just making things up when I
get stuck):

	| app nsRect rect nsWindow window origin size |
	app :=  (ObjectiveCBridge classObjectForName: 'NSApplication')
sharedApplication.
	origin := NSPoint externalNew.
	origin
		x: 0.0;
		y: 0.0.
	size := NSSize externalNew.
	size
		width: 100.0;
		height: 100.0.
	rect := NSRect externalNew.
	rect
		origin: origin;
		size: size.
		
	nsWindow := ObjectiveCBridge classObjectForName: 'NSWindow'.
	window := nsWindow alloc
					initWithContentRect: rect 
					styleMask: 15
					backing: 2 "Objc.ObjcAppKit nsBackingStoreBuffered"
					defer: (Character value: 1).
  	window
		setTitle: 'Test windows' asNSString;
		center;
		orderFront: 0;
		contentView.
  
	app run.

This time it choked on #initWithContentRect:styleMask:backing:defer:
  which eventually called nsInvocationSetStructureType:index:value
  which tried to call #asByteArray on NSRect, which doesn't exist.

NSRect is a subclass of ExternalStructure with #fields
	^ #((origin 'NSPoint')
		(size 'NSSize'))

NSPoint is a subclass of ExternalStructure with #fields
	^ #((x 'float')
		(y 'float'))

NSSize is a subclass of ExternalStructure with #fields
	^ #((width 'float')
		(height 'float'))


--
View this message in context: http://forum.world.st/Objective-C-Test-Failures-tp3536795p3537248.html
Sent from the Smalltalk VM - Beginners mailing list archive at Nabble.com.


More information about the VM-beginners mailing list