reorganized the samples, again. Moved the programs that were more test cases to the unit test directory and repackaged the unit test directory.
This commit is contained in:
55
unittest/com/jacob/test/MathProj/MathTest.java
Normal file
55
unittest/com/jacob/test/MathProj/MathTest.java
Normal file
@@ -0,0 +1,55 @@
|
||||
package com.jacob.test.MathProj;
|
||||
|
||||
import com.jacob.activeX.ActiveXComponent;
|
||||
import com.jacob.com.*;
|
||||
|
||||
/**
|
||||
* This example uses the MathTest sample VB COM DLL under
|
||||
* the MathProj directory
|
||||
* <pre>
|
||||
* -Djava.library.path=d:/jacob/release -Dcom.jacob.autogc=false -Dcom.jacob.debug=true
|
||||
* </pre>
|
||||
*/
|
||||
class MathTest {
|
||||
public static void main(String[] args) {
|
||||
MathTest me = new MathTest();
|
||||
me.runTest();
|
||||
}
|
||||
|
||||
public MathTest(){
|
||||
}
|
||||
|
||||
public void runTest(){
|
||||
// deprecated
|
||||
// System.runFinalizersOnExit(true);
|
||||
Dispatch test = new ActiveXComponent("MathTest.Math");
|
||||
TestEvents te = new TestEvents();
|
||||
DispatchEvents de = new DispatchEvents(test, te);
|
||||
if (de == null) {
|
||||
System.out
|
||||
.println("null returned when trying to create DispatchEvents");
|
||||
}
|
||||
System.out.println(Dispatch.call(test, "Add", new Variant(1),
|
||||
new Variant(2)));
|
||||
System.out.println(Dispatch.call(test, "Mult", new Variant(2),
|
||||
new Variant(2)));
|
||||
Variant v = Dispatch.call(test, "Mult", new Variant(2), new Variant(2));
|
||||
// this should return false
|
||||
System.out.println("v.isNull=" + v.isNull());
|
||||
v = Dispatch.call(test, "getNothing");
|
||||
// these should return nothing
|
||||
System.out.println("v.isNull=" + v.isNull());
|
||||
System.out.println("v.toDispatch=" + v.toDispatch());
|
||||
}
|
||||
|
||||
public class TestEvents {
|
||||
public void DoneAdd(Variant[] args) {
|
||||
System.out.println("DoneAdd called in java");
|
||||
}
|
||||
|
||||
public void DoneMult(Variant[] args) {
|
||||
System.out.println("DoneMult called in java");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user