本文整理汇总了Java中com.apple.jobjc.Invoke.MsgSend.invoke方法的典型用法代码示例。如果您正苦于以下问题:Java MsgSend.invoke方法的具体用法?Java MsgSend.invoke怎么用?Java MsgSend.invoke使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.apple.jobjc.Invoke.MsgSend
的用法示例。
在下文中一共展示了MsgSend.invoke方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testDoubleIntLongMethod
import com.apple.jobjc.Invoke.MsgSend; //导入方法依赖的package包/类
public void testDoubleIntLongMethod(){
final MyObject instObj = new MyObjectClass(runtime).alloc();
final int arg1 = 3;
final long arg2 = 4;
final float arg3 = 5.5F;
final double expected = 12.5D;
final MsgSend sel = new MsgSend(runtime, "add:and:and:", DoubleCoder.INST,
SIntCoder.INST, SLongLongCoder.INST, FloatCoder.INST);
sel.init(ctx, instObj);
SIntCoder.INST.push(ctx, arg1);
SLongLongCoder.INST.push(ctx, arg2);
FloatCoder.INST.push(ctx, arg3);
sel.invoke(ctx);
final double ret = DoubleCoder.INST.pop(ctx);
assertEquals(expected, ret);
}
示例2: testGetBlackColor
import com.apple.jobjc.Invoke.MsgSend; //导入方法依赖的package包/类
public void testGetBlackColor() throws Throwable {
final MacOSXFramework appKit = TestUtils.getAppKit();
final NSClass<? extends ID> clazz = UnsafeRuntimeAccess.getNSClass(appKit, "NSColor");
final MsgSend sel = UnsafeRuntimeAccess.createMsgSend(clazz, "redColor", PointerCoder.INST);
sel.init(nativeBuffer, clazz);
sel.invoke(nativeBuffer);
final long blackColorPtr = PrimitivePointerCoder.INST.pop(nativeBuffer);
String dscr = UnsafeRuntimeAccess.getDescriptionForPtr(blackColorPtr);
System.out.println("0x" + Long.toHexString(blackColorPtr) + ": " + dscr);
assertEquals("NSCalibratedRGBColorSpace 1 0 0 1", dscr);
}
示例3: testVoidVoidMethod
import com.apple.jobjc.Invoke.MsgSend; //导入方法依赖的package包/类
public void testVoidVoidMethod(){
final MyObject instObj = new MyObjectClass(runtime).alloc();
assertEquals(0, instObj.myMethodHits);
MsgSend sel = new MsgSend(runtime, "myMethod", VoidCoder.INST);
sel.init(ctx, instObj);
sel.invoke(ctx);
assertEquals(1, instObj.myMethodHits);
}
示例4: testVoidIntMethod
import com.apple.jobjc.Invoke.MsgSend; //导入方法依赖的package包/类
public void testVoidIntMethod(){
final MyObject instObj = new MyObjectClass(runtime).alloc();
MsgSend sel2 = new MsgSend(runtime, "intMethod", SIntCoder.INST);
sel2.init(ctx, instObj);
sel2.invoke(ctx);
int ret = SIntCoder.INST.popInt(ctx);
assertEquals(3, ret);
}
示例5: testStructStructMethod
import com.apple.jobjc.Invoke.MsgSend; //导入方法依赖的package包/类
public void testStructStructMethod(){
final MyObject instObj = new MyObjectClass(runtime).alloc();
NSPoint p = JObjC.getInstance().Foundation().NSMakePoint(3, 3);
MsgSend sel2 = new MsgSend(runtime, "doubleIt:", p.getCoder(), p.getCoder());
sel2.init(ctx, instObj);
p.getCoder().push(ctx, p);
sel2.invoke(ctx, p);
assertEquals(6.0, p.x());
}
示例6: testNSStringNSStringMethod
import com.apple.jobjc.Invoke.MsgSend; //导入方法依赖的package包/类
public void testNSStringNSStringMethod(){
final MyObject instObj = new MyObjectClass(runtime).alloc();
final NSString orig = Utils.get().strings().nsString("foobar");
final String expected = "foobarfoobarfoobar";
final MsgSend sel = new MsgSend(runtime, "stringTimesThree:", IDCoder.INST, IDCoder.INST);
sel.init(ctx, instObj);
IDCoder.INST.push(ctx, orig);
sel.invoke(ctx);
NSString ret = (NSString) IDCoder.INST.pop(ctx);
assertEquals(expected, Utils.get().strings().javaString(ret));
}