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:
37
unittest/com/jacob/test/MathProj/Math.cls
Normal file
37
unittest/com/jacob/test/MathProj/Math.cls
Normal file
@@ -0,0 +1,37 @@
|
||||
VERSION 1.0 CLASS
|
||||
BEGIN
|
||||
MultiUse = -1 'True
|
||||
Persistable = 0 'NotPersistable
|
||||
DataBindingBehavior = 0 'vbNone
|
||||
DataSourceBehavior = 0 'vbNone
|
||||
MTSTransactionMode = 0 'NotAnMTSObject
|
||||
END
|
||||
Attribute VB_Name = "Math"
|
||||
Attribute VB_GlobalNameSpace = False
|
||||
Attribute VB_Creatable = True
|
||||
Attribute VB_PredeclaredId = False
|
||||
Attribute VB_Exposed = True
|
||||
Attribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes"
|
||||
Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
|
||||
'To fire this event, use RaiseEvent with the following syntax:
|
||||
'RaiseEvent DoneAdd[(arg1, arg2, ... , argn)]
|
||||
Public Event DoneAdd(result As Variant)
|
||||
'To fire this event, use RaiseEvent with the following syntax:
|
||||
'RaiseEvent DoneMult[(arg1, arg2, ... , argn)]
|
||||
Public Event DoneMult(result As Variant)
|
||||
|
||||
|
||||
Public Function Mult(in1 As Variant, in2 As Variant) As Variant
|
||||
Mult = in1 * in2
|
||||
RaiseEvent DoneMult(in1 * in2)
|
||||
End Function
|
||||
|
||||
Public Function Add(in1 As Variant, in2 As Variant) As Variant
|
||||
Add = in1 + in2
|
||||
RaiseEvent DoneAdd(in1 + in2)
|
||||
End Function
|
||||
|
||||
Public Function getNothing() As Variant
|
||||
Set getNothing = Nothing
|
||||
End Function
|
||||
|
||||
BIN
unittest/com/jacob/test/MathProj/MathTest.dll
Normal file
BIN
unittest/com/jacob/test/MathProj/MathTest.dll
Normal file
Binary file not shown.
BIN
unittest/com/jacob/test/MathProj/MathTest.exp
Normal file
BIN
unittest/com/jacob/test/MathProj/MathTest.exp
Normal file
Binary file not shown.
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");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
BIN
unittest/com/jacob/test/MathProj/MathTest.lib
Normal file
BIN
unittest/com/jacob/test/MathProj/MathTest.lib
Normal file
Binary file not shown.
35
unittest/com/jacob/test/MathProj/MathTest.vbp
Normal file
35
unittest/com/jacob/test/MathProj/MathTest.vbp
Normal file
@@ -0,0 +1,35 @@
|
||||
Type=OleDll
|
||||
Class=Math; Math.cls
|
||||
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINNT\System32\StdOle2.Tlb#OLE Automation
|
||||
Startup="(None)"
|
||||
HelpFile=""
|
||||
Title="MathTest"
|
||||
ExeName32="MathTest.dll"
|
||||
Command32=""
|
||||
Name="MathTest"
|
||||
HelpContextID="0"
|
||||
CompatibleMode="1"
|
||||
CompatibleEXE32="MathTest.dll"
|
||||
MajorVer=1
|
||||
MinorVer=0
|
||||
RevisionVer=0
|
||||
AutoIncrementVer=0
|
||||
ServerSupportFiles=0
|
||||
VersionCompanyName="Inventure America, Inc."
|
||||
CompilationType=0
|
||||
OptimizationType=0
|
||||
FavorPentiumPro(tm)=0
|
||||
CodeViewDebugInfo=0
|
||||
NoAliasing=0
|
||||
BoundsCheck=0
|
||||
OverflowCheck=0
|
||||
FlPointCheck=0
|
||||
FDIVCheck=0
|
||||
UnroundedFP=0
|
||||
StartMode=1
|
||||
Unattended=0
|
||||
Retained=0
|
||||
ThreadPerObject=0
|
||||
MaxNumberOfThreads=1
|
||||
ThreadingModel=1
|
||||
DebugStartupOption=0
|
||||
1
unittest/com/jacob/test/MathProj/MathTest.vbw
Normal file
1
unittest/com/jacob/test/MathProj/MathTest.vbw
Normal file
@@ -0,0 +1 @@
|
||||
Math = 75, 13, 656, 554,
|
||||
5
unittest/com/jacob/test/MathProj/README.txt
Normal file
5
unittest/com/jacob/test/MathProj/README.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
A Simple VB COM DLL that exposes two methods and raises events.
|
||||
|
||||
The dll must be registered with your system
|
||||
|
||||
Run --> regsvr32 <path>\com\jacob\test\MathProj\MathTest.dll
|
||||
Reference in New Issue
Block a user