Add director_nested_class testcase

Java nested director class test for fix in e7db081d5e
This commit is contained in:
William S Fulton 2014-11-07 19:45:20 +00:00
commit bca042a7dd
2 changed files with 46 additions and 0 deletions

View file

@ -0,0 +1,16 @@
%module(directors="1") director_nested_class
%feature("director") DirectorOuter::DirectorInner;
%inline %{
struct DirectorOuter {
struct DirectorInner {
virtual ~DirectorInner() {}
virtual int vmethod(int input) const = 0;
};
static int callMethod(const DirectorInner &di, int value) {
return di.vmethod(value);
}
};
%}

View file

@ -0,0 +1,30 @@
import director_nested_class.*;
public class director_nested_class_runme {
static {
try {
System.loadLibrary("director_nested_class");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
System.exit(1);
}
}
public static void main(String argv[]) {
director_nested_class_Derived d = new director_nested_class_Derived();
if (DirectorOuter.callMethod(d, 999) != 9990) {
throw new RuntimeException("callMethod(999) failed");
}
}
}
class director_nested_class_Derived extends DirectorOuter.DirectorInner {
public int vmethod(int input) {
return input * 10;
}
}