diff --git a/contrib/platform/src/com/sun/jna/platform/unix/X11.java b/contrib/platform/src/com/sun/jna/platform/unix/X11.java index 8190b4d8c3..86fcc537b0 100644 --- a/contrib/platform/src/com/sun/jna/platform/unix/X11.java +++ b/contrib/platform/src/com/sun/jna/platform/unix/X11.java @@ -286,8 +286,14 @@ protected List getFieldOrder() { } class PictFormat extends XID { private static final long serialVersionUID = 1L; + public static final PictFormat None = null; public PictFormat(long value) { super(value); } public PictFormat() { this(0); } + public Object fromNative(Object nativeValue, FromNativeContext context) { + if (isNone(nativeValue)) + return None; + return new PictFormat(((Number)nativeValue).longValue()); + } } class XRenderPictFormat extends Structure { public PictFormat id; diff --git a/contrib/platform/test/com/sun/jna/platform/unix/X11Test.java b/contrib/platform/test/com/sun/jna/platform/unix/X11Test.java new file mode 100644 index 0000000000..3616898f95 --- /dev/null +++ b/contrib/platform/test/com/sun/jna/platform/unix/X11Test.java @@ -0,0 +1,36 @@ +/* Copyright (c) 2015 Timothy Wall, All Rights Reserved + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + *
+ * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + */ +package com.sun.jna.platform.unix; + +import junit.framework.TestCase; + +/** + * Exercise the {@link X11} class. + * + * @author twalljava@java.net + */ +// @SuppressWarnings("unused") +public class X11Test extends TestCase { + + public void testXrender() { + X11.Xrender.XRenderPictFormat s = new X11.Xrender.XRenderPictFormat(); + s.getPointer().setInt(0, 25); + s.read(); + } + + public static void main(java.lang.String[] argList) { + junit.textui.TestRunner.run(X11Test.class); + } +} + +