-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#41 Fix for SafeArray(String) constructor
#111 m_pDispatch is not 0 if not attached Should really be mixing two fixes in the same commit but that's the way it goes
- Loading branch information
clay_shooter
committed
Jul 24, 2013
1 parent
db89245
commit eeefefd
Showing
5 changed files
with
53 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
jacob/unittest/com/jacob/test/safearray/SafeArrayStringConstructorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.jacob.test.safearray; | ||
|
||
import com.jacob.com.SafeArray; | ||
import com.jacob.test.BaseTestCase; | ||
|
||
/** | ||
* Test case provided #41 Fix for SafeArray(String) constructor | ||
* | ||
* In the current release of Jacob, SafeArray.java contains a constructor which | ||
* takes a string as a single argument. The documentation claims that this | ||
* method converts a string to a VT_UI1 array. Using this method as written | ||
* always causes a ComFailException, because it attempts to create a SafeArray | ||
* from Java chars, which are 16-bit unsigned integers (which would be VT_UI2). | ||
*/ | ||
public class SafeArrayStringConstructorTest extends BaseTestCase { | ||
public void testStringConstructor() { | ||
// The line below will throw ComFailException using jacob 1.17-M2 | ||
// without the patch. | ||
SafeArray safeArrayFromString = new SafeArray("This is a string."); | ||
String convertBack = safeArrayFromString.asString(); | ||
assertEquals("This is a string.", convertBack); | ||
} | ||
|
||
} |