From c531f13bab81f4e350d021efc7b420d05be94bea Mon Sep 17 00:00:00 2001 From: widdisd Date: Fri, 16 Aug 2019 15:06:27 -0700 Subject: [PATCH] Add test for failing ParseDisplayName --- .../platform/win32/COM/IShellFolderTest.java | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/contrib/platform/test/com/sun/jna/platform/win32/COM/IShellFolderTest.java b/contrib/platform/test/com/sun/jna/platform/win32/COM/IShellFolderTest.java index 99df41ea25..860fb30bc3 100644 --- a/contrib/platform/test/com/sun/jna/platform/win32/COM/IShellFolderTest.java +++ b/contrib/platform/test/com/sun/jna/platform/win32/COM/IShellFolderTest.java @@ -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); @@ -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); + } } \ No newline at end of file