Skip to content

Commit

Permalink
Add test for failing ParseDisplayName
Browse files Browse the repository at this point in the history
  • Loading branch information
widdisd authored and widdisd committed Aug 16, 2019
1 parent 5fee560 commit c531f13
Showing 1 changed file with 27 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,20 @@
*/

import com.sun.jna.Pointer;
import junit.framework.TestCase;

import com.sun.jna.platform.win32.*;
import com.sun.jna.platform.win32.Guid;
import com.sun.jna.platform.win32.Guid.REFIID;
import com.sun.jna.platform.win32.Ole32;
import com.sun.jna.platform.win32.ShTypes.STRRET;
import com.sun.jna.platform.win32.Shell32;
import com.sun.jna.platform.win32.ShlObj;
import com.sun.jna.platform.win32.Shlwapi;
import com.sun.jna.platform.win32.WinDef;
import com.sun.jna.platform.win32.WinNT;
import com.sun.jna.ptr.IntByReference;
import com.sun.jna.ptr.PointerByReference;

import junit.framework.TestCase;

public class IShellFolderTest extends TestCase {
static {
ClassLoader.getSystemClassLoader().setDefaultAssertionStatus(true);
Expand Down Expand Up @@ -102,4 +109,21 @@ public void testEnumObjects() throws Exception {
peidl.Release();
assertTrue(sawNames); // We should see at least one item with a name
}

public void testParseDisplayName() throws Exception {
String directory = System.getenv("WinDir");

IntByReference pchEaten = new IntByReference();
PointerByReference ppidl = new PointerByReference();
IntByReference pdwAttributes = new IntByReference();
PointerByReference desktopFolder = new PointerByReference();

WinNT.HRESULT hResult = Shell32.INSTANCE.SHGetDesktopFolder(desktopFolder);
assertEquals(COMUtils.S_OK, hResult);

IShellFolder shellFolder = IShellFolder.Converter.PointerToIShellFolder(desktopFolder);
hResult = shellFolder.ParseDisplayName(new WinDef.HWND(Pointer.NULL), Pointer.NULL, directory, pchEaten, ppidl,
pdwAttributes);
assertEquals(COMUtils.S_OK, hResult);
}
}

0 comments on commit c531f13

Please sign in to comment.