Objective C Test Failures

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Objective C Test Failures

Sean P. DeNigris
Administrator
4 tests are failing due to the following error:

        (ObjectiveCBridge classObjectForName: 'UIApplication') sharedApplication.

#sharedApplication -> DNU. (The error seems to be in the primitive primitiveGetMethodSignatureForSelectoron:, which returns 0 as an external memory address).

Steps taken so far:
1. I checked the Apple docs and everything seems correct.
2. I successfully evaluated the following in the same image as a sanity check:
        bundle := ObjectiveCObject findClassName: 'NSBundle'.
        aBundle := bundle bundleWithPath: '/Applications/Mail.app' asNSStringUTF8.
        aBundle bundleIdentifier asString.

What is going on here?

Thanks.
Sean
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Objective C Test Failures

johnmci
UIApplication is an iOS class that does not exist on OS-x. The test
will run on iOS, bur not on OS-x. Check the docs to see what the
proper class to use on OS-x

On Thursday, May 19, 2011, Sean P. DeNigris <[hidden email]> wrote:

> 4 tests are failing due to the following error:
>
>         (ObjectiveCBridge classObjectForName: 'UIApplication') sharedApplication.
>
> #sharedApplication -> DNU. (The error seems to be in the primitive
> primitiveGetMethodSignatureForSelectoron:, which returns 0 as an external
> memory address).
>
> Steps taken so far:
> 1. I checked the Apple docs and everything seems correct.
> 2. I successfully evaluated the following in the same image as a sanity
> check:
>         bundle := ObjectiveCObject findClassName: 'NSBundle'.
>         aBundle := bundle bundleWithPath: '/Applications/Mail.app' asNSStringUTF8.
>         aBundle bundleIdentifier asString.
>
> What is going on here?
>
> Thanks.
> Sean
>
> --
> View this message in context: http://forum.world.st/Objective-C-Test-Failures-tp3536795p3536795.html
> Sent from the Smalltalk VM - Beginners mailing list archive at Nabble.com.
> _______________________________________________
> VM-beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/vm-beginners
>

--
===========================================================================
John M. McIntosh <[hidden email]>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
===========================================================================
_______________________________________________
VM-beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/vm-beginners
Reply | Threaded
Open this post in threaded view
|

Re: Objective C Test Failures

Sean P. DeNigris
Administrator
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'))
Cheers,
Sean