Skip to content

Commit

Permalink
Merge pull request #187 from bhamail/test-getFieldOrder
Browse files Browse the repository at this point in the history
Test runs under linux and Structure fixes all pass, so I will commit this. build.xml changes still need cleanup. Please holler with any other suggestions.
  • Loading branch information
bhamail committed Jan 25, 2013
2 parents f721075 + f0ae20f commit 3d051ec
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 8 deletions.
19 changes: 19 additions & 0 deletions contrib/platform/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@
<condition property="tests.platform" value="test-osx">
<os family="mac"/>
</condition>
<condition property="tests.platform" value="test-linux">
<os family="unix"/>
</condition>
<target name="test" depends="init,compile-test" description="Run unit tests." if="tests.platform">
<antcall target="${tests.platform}" />
</target>
Expand All @@ -86,4 +89,20 @@
<echo>No platform tests yet for OSX</echo>
</target>
<target name="test-win32" depends="-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" />

<target name="test-linux" depends="-pre-test-run-single" >
<!-- @todo How to ensure sys prop: jna.nosys=true is seen in tests? -->
<!--<property name="test.includes" value="com/sun/jna/platform/**/*.java"/>-->
<property name="test.includes" value="com/sun/jna/platform/StructureFieldOrderTest.java"/>

<property name="javac.includes" value="**/*"/>

<antcall target="test-single"/>

<!--
<antcall target="test-report"/>
<antcall target="-post-test-run"/>
<antcall target="-test-browse"/>
-->
</target>
</project>
14 changes: 7 additions & 7 deletions contrib/platform/src/com/sun/jna/platform/unix/X11.java
Original file line number Diff line number Diff line change
Expand Up @@ -1610,7 +1610,7 @@ class XUnmapEvent extends Structure {
public Window window;
public int from_configure;
protected List getFieldOrder() {
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "from_configure" });
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "event", "window", "from_configure" });
}
}

Expand All @@ -1623,7 +1623,7 @@ class XMapEvent extends Structure {
public Window window;
public int override_redirect; // boolean, is override set...
protected List getFieldOrder() {
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "override_redirect" });
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "event", "window", "override_redirect" });
}
}

Expand All @@ -1635,7 +1635,7 @@ class XMapRequestEvent extends Structure {
public Window parent;
public Window window;
protected List getFieldOrder() {
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window" });
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "parent", "window" });
}
}

Expand All @@ -1650,7 +1650,7 @@ class XReparentEvent extends Structure {
public int x, y;
public int override_redirect;
protected List getFieldOrder() {
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "x", "y", "override_redirect" });
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "event", "window", "parent", "x", "y", "override_redirect" });
}
}

Expand All @@ -1667,7 +1667,7 @@ class XConfigureEvent extends Structure {
public Window above;
public int override_redirect;
protected List getFieldOrder() {
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "x", "y", "width", "height", "border_width", "above", "override_redirect" });
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "event", "window", "x", "y", "width", "height", "border_width", "above", "override_redirect" });
}
}

Expand All @@ -1680,7 +1680,7 @@ class XGravityEvent extends Structure {
public Window window;
public int x, y;
protected List getFieldOrder() {
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "x", "y" });
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "event", "window", "x", "y" });
}
}

Expand Down Expand Up @@ -1710,7 +1710,7 @@ class XConfigureRequestEvent extends Structure {
public int detail; // Above, Below, TopIf, BottomIf, Opposite
public NativeLong value_mask;
protected List getFieldOrder() {
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "x", "y", "width", "height", "above", "detail", "value_mask" });
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "parent", "window", "x", "y", "width", "height", "border_width", "above", "detail", "value_mask" });
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,32 @@

public class StructureFieldOrderTest extends TestCase {

private String origPropJNANoSys;

protected void setUp() {
origPropJNANoSys = System.getProperty("jna.nosys");
System.setProperty("jna.nosys", "true"); // would be set by ant script, set here for IDE usage
}

protected void tearDown() {
if (origPropJNANoSys == null) {
System.getProperties().remove("jna.nosys");
} else {
System.setProperty("jna.nosys", origPropJNANoSys);
}
}


public void testMethodGetFieldOrder() {
final List<String> ignoreConstructorError = new ArrayList<String>();

if (Platform.isWindows()) {
ignoreConstructorError.add(X11.class.getName() + "$");
} else {
ignoreConstructorError.add(com.sun.jna.platform.win32.Winspool.PRINTER_INFO_1.class.getName());
ignoreConstructorError.add(com.sun.jna.platform.win32.Winspool.PRINTER_INFO_4.class.getName());
ignoreConstructorError.add(com.sun.jna.platform.win32.SetupApi.SP_DEVICE_INTERFACE_DATA.class.getName());
ignoreConstructorError.add(com.sun.jna.platform.win32.SetupApi.SP_DEVINFO_DATA.class.getName());
}

ignoreConstructorError.add(DBT.DEV_BROADCAST_HANDLE.class.getName()); // manually validated by wolftobias
Expand All @@ -47,7 +68,7 @@ public void testMethodGetFieldOrderSingleClass() {
ignoreConstructorError.add(X11.class.getName() + "$");
}
StructureFieldOrderInspector.checkMethodGetFieldOrder(LMAccess.GROUP_INFO_3.class, ignoreConstructorError);
StructureFieldOrderInspector.checkMethodGetFieldOrder(com.sun.jna.platform.win32.SetupApi.SP_DEVICE_INTERFACE_DATA.class, ignoreConstructorError);
}
//*/

Expand Down

0 comments on commit 3d051ec

Please sign in to comment.