Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changes to allow StructureFieldOrderTest to run on linux. Still needs fi... #187

Merged
merged 4 commits into from
Jan 25, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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