Package org.rococoa

Examples of org.rococoa.ObjCObjectByReference


    }
    }
   
    @Test public void test() {
    File file = new File(testMovieFile);
        ObjCObjectByReference errorReference = new ObjCObjectByReference();
        QTMovie movie = QTMovie.movieWithFile_error(file, errorReference);

        assertNotNull(movie);
        assertNull(errorReference.getValueAs(NSError.class));//.id().isNull());
        QTTime time3 =  movie.currentTime();
        assertEquals(testMovieTimeScale, time3.timeScale.intValue());
       
        movie.setSelection(new QTTimeRange(new QTTime(50, testMovieTimeScale), new QTTime(100, testMovieTimeScale)));
    assertEquals(new QTTime(50, testMovieTimeScale), movie.selectionStart());
View Full Code Here


    assertEquals(new QTTime(150, testMovieTimeScale), movie.selectionEnd());
    }
 
    @Test public void testError() {
        File file = new File("NOSUCH");
        ObjCObjectByReference errorReference = new ObjCObjectByReference();
    QTMovie movie = QTMovie.movieWithFile_error(file, errorReference);
        assertNull(movie);
        NSError error = errorReference.getValueAs(NSError.class);
    assertEquals(-2000, error.code().intValue());
    }
View Full Code Here

    @Test
    public void testArgument() {
        NSAutoreleasePool pool = NSAutoreleasePool.new_();
        TestShunt shunt = Rococoa.create("TestShunt", TestShunt.class);
        ObjCObjectByReference reference = new ObjCObjectByReference();
        shunt.testNSNumberByReference_with(reference, 42);
        NSNumber value = reference.getValueAs(NSNumber.class);
        assertEquals(42, value.intValue());

        // we better have retained the result by the time it gets back
        assertEquals(3, value.retainCount());
        pool.drain();
View Full Code Here

     @param property the property whose value should be retrieved
     *  @return the value asociated with the property
     *  @throws IllegalArgumentException if an error occurs while reading the property
     */
    public NSObject getProperty(SpeechProperty property) throws IllegalArgumentException {
         ObjCObjectByReference errorPtr = new ObjCObjectByReference();
         NSObject result = objectForProperty_error(property.getNativeValue(), errorPtr);
         NSError error = errorPtr.getValueAs(NSError.class);
         //objectForProperty:error isn't well documented, so be very conservative
         if ( result != null && !result.id().isNull() && (error == null || error.id().isNull() || error.code().intValue() == 0) ) {
             return result;
         } else {
             throw new IllegalArgumentException("Could not get property: " + property + ", error: " + error.localizedDescription());
View Full Code Here

     @param property the property whose value will be set
     *  @param value the value to set
     *  @throws IllegalArgumentException if an error occurs while setting the property
     */
    public void setProperty(SpeechProperty property, NSObject value) throws IllegalArgumentException {
        ObjCObjectByReference errorPtr = new ObjCObjectByReference();
        if ( !setObject_forProperty_error(value, property.getNativeValue(), errorPtr) ) {
            NSError error = errorPtr.getValueAs(NSError.class);
            throw new IllegalArgumentException("Could not set property: " + property + " to value " + value + ", error: " + error.localizedDescription());
        }
    }
View Full Code Here

TOP

Related Classes of org.rococoa.ObjCObjectByReference

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.