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:
@@ -1,4 +1,4 @@
|
|||||||
package com.jacob.samples.test;
|
package com.jacob.samples.outlook;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JACOB Outlook sample contributed by
|
* JACOB Outlook sample contributed by
|
||||||
1
unittest/com/jacob/com/README.txt
Normal file
1
unittest/com/jacob/com/README.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
This package exists in case folks need to test the Jacob COM objects and need access to protected methods
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.jacob.samples.test.MathProj;
|
package com.jacob.test.MathProj;
|
||||||
|
|
||||||
import com.jacob.activeX.ActiveXComponent;
|
import com.jacob.activeX.ActiveXComponent;
|
||||||
import com.jacob.com.*;
|
import com.jacob.com.*;
|
||||||
@@ -2,4 +2,4 @@ A Simple VB COM DLL that exposes two methods and raises events.
|
|||||||
|
|
||||||
The dll must be registered with your system
|
The dll must be registered with your system
|
||||||
|
|
||||||
Run --> regsvr32 <path>\com\jacob\samples\test\MathProj\MathTest.dll
|
Run --> regsvr32 <path>\com\jacob\test\MathProj\MathTest.dll
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.jacob.samples.test.atl;
|
package com.jacob.test.atl;
|
||||||
|
|
||||||
import com.jacob.com.*;
|
import com.jacob.com.*;
|
||||||
import com.jacob.activeX.*;
|
import com.jacob.activeX.*;
|
||||||
@@ -1,7 +1,11 @@
|
|||||||
package com.jacob.com;
|
package com.jacob.test.events;
|
||||||
|
|
||||||
import com.jacob.activeX.ActiveXComponent;
|
import com.jacob.activeX.ActiveXComponent;
|
||||||
|
import com.jacob.com.ComException;
|
||||||
|
import com.jacob.com.Dispatch;
|
||||||
import com.jacob.com.DispatchEvents;
|
import com.jacob.com.DispatchEvents;
|
||||||
|
import com.jacob.com.InvocationProxy;
|
||||||
|
import com.jacob.com.Variant;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This test was lifted from a forum posting and shows how you can't listen to
|
* This test was lifted from a forum posting and shows how you can't listen to
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
package com.jacob.samples.test;
|
package com.jacob.test.events;
|
||||||
|
|
||||||
import com.jacob.com.*;
|
import com.jacob.com.*;
|
||||||
import com.jacob.activeX.*;
|
import com.jacob.activeX.*;
|
||||||
/**
|
/**
|
||||||
|
* It looks like this test is broken again on the cleanup
|
||||||
|
*
|
||||||
* This demonstrates the new event handling code in jacob 1.7
|
* This demonstrates the new event handling code in jacob 1.7
|
||||||
* This example will open up IE and print out some of the events
|
* This example will open up IE and print out some of the events
|
||||||
* it listens to as it havigates to web sites.
|
* it listens to as it havigates to web sites.
|
||||||
@@ -48,7 +50,8 @@ class IETestThread extends Thread
|
|||||||
|
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
int delay = 5000; // msec
|
// this used to be 5 seconds but sourceforge is slow
|
||||||
|
int delay = 10000; // msec
|
||||||
// paired with statement below that blows up
|
// paired with statement below that blows up
|
||||||
ComThread.InitMTA();
|
ComThread.InitMTA();
|
||||||
ActiveXComponent ie = new ActiveXComponent("InternetExplorer.Application");
|
ActiveXComponent ie = new ActiveXComponent("InternetExplorer.Application");
|
||||||
@@ -63,7 +66,7 @@ class IETestThread extends Thread
|
|||||||
Variant optional = new Variant();
|
Variant optional = new Variant();
|
||||||
optional.noParam();
|
optional.noParam();
|
||||||
|
|
||||||
Dispatch.call(ie, "Navigate", new Variant("http://www.danadler.com/jacob"));
|
Dispatch.call(ie, "Navigate", new Variant("http://sourceforge.net/projects/jacob-project"));
|
||||||
try { Thread.sleep(delay); } catch (Exception e) {}
|
try { Thread.sleep(delay); } catch (Exception e) {}
|
||||||
Dispatch.call(ie, "Navigate", new Variant("http://groups.yahoo.com/group/jacob-project"));
|
Dispatch.call(ie, "Navigate", new Variant("http://groups.yahoo.com/group/jacob-project"));
|
||||||
try { Thread.sleep(delay); } catch (Exception e) {}
|
try { Thread.sleep(delay); } catch (Exception e) {}
|
||||||
@@ -1,12 +1,17 @@
|
|||||||
package com.jacob.com;
|
package com.jacob.test.events;
|
||||||
|
|
||||||
import com.jacob.activeX.ActiveXComponent;
|
import com.jacob.activeX.ActiveXComponent;
|
||||||
import com.jacob.com.ComException;
|
import com.jacob.com.ComException;
|
||||||
import com.jacob.com.DispatchEvents;
|
import com.jacob.com.DispatchEvents;
|
||||||
|
import com.jacob.com.InvocationProxy;
|
||||||
|
import com.jacob.com.Variant;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This test was lifted from a forum posting and shows how you can't listen to
|
* This test was lifted from a forum posting and shows how you can't listen to
|
||||||
* Excel events (added post 1.9.1 Eclipse Settings.) This also uses the 1.9.1
|
* Excel events (added post 1.9.1 Eclipse Settings.)
|
||||||
|
* That test was modified make this a MSWord event listener to demonstrate
|
||||||
|
* that the InvocationProxy code works with MS Word Events
|
||||||
|
* This also uses the 1.10
|
||||||
* InvocationProxy to receive the events.
|
* InvocationProxy to receive the events.
|
||||||
* <p> supported command line options with default values are
|
* <p> supported command line options with default values are
|
||||||
* -Djava.library.path=d:/jacob/release -Dcom.jacob.autogc=false
|
* -Djava.library.path=d:/jacob/release -Dcom.jacob.autogc=false
|
||||||
@@ -15,7 +20,7 @@ import com.jacob.com.DispatchEvents;
|
|||||||
public class WordEventTest extends InvocationProxy {
|
public class WordEventTest extends InvocationProxy {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* load up excel, register for events and make stuff happen
|
* load up word, register for events and make stuff happen
|
||||||
* @param args
|
* @param args
|
||||||
*/
|
*/
|
||||||
public static void main(String args[]) {
|
public static void main(String args[]) {
|
||||||
@@ -57,6 +62,10 @@ public class WordEventTest extends InvocationProxy {
|
|||||||
+ cfe.getMessage());
|
+ cfe.getMessage());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
System.out.println(
|
||||||
|
"Someone needs to add some MSWord commands to this to " +
|
||||||
|
"make some on screen stuff happens so the tester " +
|
||||||
|
"thinks we tested something");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1,7 +1,12 @@
|
|||||||
package com.jacob.samples.test.powerpoint;
|
package com.jacob.test.powerpoint;
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* $Id: PowerpointTest.java,v 1.2 2005/07/07 01:19:06 clay_shooter Exp $
|
* $Id$
|
||||||
|
*
|
||||||
|
* This is really more of a multi threaded tester
|
||||||
|
*
|
||||||
|
* run with
|
||||||
|
* -Djava.library.path=d:/jacob/release -Dcom.jacob.autogc=false -Dcom.jacob.debug=false
|
||||||
*/
|
*/
|
||||||
import com.jacob.activeX.ActiveXComponent;
|
import com.jacob.activeX.ActiveXComponent;
|
||||||
import com.jacob.com.ComThread;
|
import com.jacob.com.ComThread;
|
||||||
@@ -19,7 +24,7 @@ public class PowerpointTest extends Thread {
|
|||||||
protected static final int NUM_ITERATIONS = 50;
|
protected static final int NUM_ITERATIONS = 50;
|
||||||
|
|
||||||
private static String POWERPOINT_TEST_PATH =
|
private static String POWERPOINT_TEST_PATH =
|
||||||
"D:\\jacob\\samples\\com\\jacob\\samples\\test\\powerpoint\\test";
|
"D:\\jacob\\samples\\com\\jacob\\test\\powerpoint";
|
||||||
//"c:\\PowerpointTest\test";
|
//"c:\\PowerpointTest\test";
|
||||||
|
|
||||||
private int threadID;
|
private int threadID;
|
||||||
@@ -44,7 +49,7 @@ public class PowerpointTest extends Thread {
|
|||||||
Dispatch comPresentations = Dispatch.get(comPowerpoint,"Presentations").toDispatch();
|
Dispatch comPresentations = Dispatch.get(comPowerpoint,"Presentations").toDispatch();
|
||||||
Dispatch comPresentation = Dispatch.call(comPresentations,
|
Dispatch comPresentation = Dispatch.call(comPresentations,
|
||||||
"Open",
|
"Open",
|
||||||
POWERPOINT_TEST_PATH+threadID+".ppt",
|
POWERPOINT_TEST_PATH+"\\test"+threadID+".ppt",
|
||||||
new Integer(0),
|
new Integer(0),
|
||||||
new Integer(0),
|
new Integer(0),
|
||||||
new Integer(0)).toDispatch();
|
new Integer(0)).toDispatch();
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.jacob.samples.test;
|
package com.jacob.test.safearray;
|
||||||
|
|
||||||
import com.jacob.com.*;
|
import com.jacob.com.*;
|
||||||
|
|
||||||
class test
|
class SafeArrayContents
|
||||||
{
|
{
|
||||||
|
|
||||||
public static void printArray(boolean a[])
|
public static void printArray(boolean a[])
|
||||||
@@ -1,4 +1,8 @@
|
|||||||
package com.jacob.com;
|
package com.jacob.test.safearray;
|
||||||
|
|
||||||
|
import com.jacob.com.ComThread;
|
||||||
|
import com.jacob.com.SafeArray;
|
||||||
|
import com.jacob.com.Variant;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* run with -Djava.library.path=d:/jacob/release -Dcom.jacob.autogc=false -Dcom.jacob.debug=false
|
* run with -Djava.library.path=d:/jacob/release -Dcom.jacob.autogc=false -Dcom.jacob.debug=false
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.jacob.samples.test;
|
package com.jacob.test.safearray;
|
||||||
|
|
||||||
import com.jacob.com.*;
|
import com.jacob.com.*;
|
||||||
import com.jacob.activeX.*;
|
import com.jacob.activeX.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.jacob.samples.test;
|
package com.jacob.test.safearray;
|
||||||
|
|
||||||
import com.jacob.com.*;
|
import com.jacob.com.*;
|
||||||
import com.jacob.activeX.*;
|
import com.jacob.activeX.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.jacob.samples.test;
|
package com.jacob.test.safearray;
|
||||||
|
|
||||||
import com.jacob.com.*;
|
import com.jacob.com.*;
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.jacob.samples.test;
|
package com.jacob.test.vbscript;
|
||||||
|
|
||||||
import com.jacob.com.*;
|
import com.jacob.com.*;
|
||||||
import com.jacob.activeX.*;
|
import com.jacob.activeX.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.jacob.samples.test;
|
package com.jacob.test.vbscript;
|
||||||
|
|
||||||
import com.jacob.com.*;
|
import com.jacob.com.*;
|
||||||
import com.jacob.activeX.*;
|
import com.jacob.activeX.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.jacob.samples.test;
|
package com.jacob.test.vbscript;
|
||||||
|
|
||||||
import com.jacob.com.*;
|
import com.jacob.com.*;
|
||||||
import com.jacob.activeX.*;
|
import com.jacob.activeX.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.jacob.samples.test;
|
package com.jacob.test.vbscript;
|
||||||
|
|
||||||
import com.jacob.com.*;
|
import com.jacob.com.*;
|
||||||
import com.jacob.activeX.*;
|
import com.jacob.activeX.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.jacob.samples.test;
|
package com.jacob.test.vbscript;
|
||||||
|
|
||||||
import com.jacob.com.*;
|
import com.jacob.com.*;
|
||||||
import com.jacob.activeX.*;
|
import com.jacob.activeX.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.jacob.samples.test;
|
package com.jacob.test.vbscript;
|
||||||
|
|
||||||
import com.jacob.com.*;
|
import com.jacob.com.*;
|
||||||
import com.jacob.activeX.*;
|
import com.jacob.activeX.*;
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
package com.jacob.samples.test;
|
package com.jacob.test.vbscript;
|
||||||
|
|
||||||
import com.jacob.com.Variant;
|
import com.jacob.com.Variant;
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.jacob.samples.test;
|
package com.jacob.test.vbscript;
|
||||||
|
|
||||||
import com.jacob.com.*;
|
import com.jacob.com.*;
|
||||||
import com.jacob.activeX.*;
|
import com.jacob.activeX.*;
|
||||||
28
unittest/com/jacob/test/windowsmedia/WMPlayer.java
Normal file
28
unittest/com/jacob/test/windowsmedia/WMPlayer.java
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
package com.jacob.test.windowsmedia;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* partial test program from the sourceforge bug report 1453161
|
||||||
|
* that says you get a random "can't map name to dispid" when
|
||||||
|
* getting the URL from the player
|
||||||
|
*
|
||||||
|
* I run with options
|
||||||
|
* -Djava.library.path=d:/jacob/release -Dcom.jacob.autogc=false -Dcom.jacob.debug=true
|
||||||
|
*/
|
||||||
|
import com.jacob.activeX.*;
|
||||||
|
|
||||||
|
public class WMPlayer {
|
||||||
|
|
||||||
|
public static void main(String[] args){
|
||||||
|
ActiveXComponent wmp = null;
|
||||||
|
wmp = new ActiveXComponent("WMPlayer.OCX");
|
||||||
|
|
||||||
|
// the sourceforge posting didn't post all the code so this is all we have
|
||||||
|
// we need some other information on how to set the document
|
||||||
|
// so that we have a url to open
|
||||||
|
for ( int i= 0 ; i < 1000 ; i++){
|
||||||
|
System.out.println("the wmp url is "+ wmp.getProperty("URL").toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1 +1,3 @@
|
|||||||
This directory will eventually contain the junit automated tests.
|
This directory contains junit tests and other/older tests for
|
||||||
|
specific functions. Sometimes tests in this directory migrate
|
||||||
|
to the samples directory as they are updated to show more functionality.
|
||||||
Reference in New Issue
Block a user