File: vtkTesting2.java

package info (click to toggle)
paraview 3.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 124,600 kB
  • ctags: 133,728
  • sloc: cpp: 958,817; ansic: 509,658; tcl: 45,787; xml: 23,401; python: 19,574; perl: 3,112; yacc: 1,787; java: 1,517; sh: 665; asm: 471; lex: 400; makefile: 168; objc: 28
file content (117 lines) | stat: -rw-r--r-- 3,202 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
package vtk;
import java.io.File;

import java.util.Properties;

public class vtkTesting2
{
  public static final int FAILED        = 0;
  public static final int PASSED        = 1;
  public static final int NOT_RUN       = 2;
  public static final int DO_INTERACTOR = 3;

  private static int LoadLib(String lib, boolean verbose)
    {
    try
      {
      if ( verbose )
        {
        System.out.println("Try to load: " + lib);
        }
      Runtime.getRuntime().load(lib);
      }
    catch (UnsatisfiedLinkError e)
      {
      if ( verbose )
        {
        System.out.println("Failed to load: " + lib);
        }
      return 0;
      }
    if ( verbose )
      {
      System.out.println("Successfully loaded: " + lib);
      }
    return 1;
    }

  private static void LoadLibrary(String path, String library, boolean verbose)
    {
    String lname = System.mapLibraryName(library);
    String sep = System.getProperty("file.separator");
    String libname = path + sep + lname;
    String releaselibname = path + sep + "Release" + sep + lname;
    String debuglibname = path + sep + "Debug" + sep + lname;
    if ( vtkTesting2.LoadLib(library, verbose) != 1 &&
      vtkTesting2.LoadLib(libname, verbose) != 1 &&
      vtkTesting2.LoadLib(releaselibname, verbose) != 1 &&
      vtkTesting2.LoadLib(debuglibname, verbose) != 1 )
      {
      System.out.println("Problem loading apropriate library");
      }
    }

  public static void Initialize(String[] args)
    {
    vtkTesting2.Initialize(args, false);
    }

  public static void Initialize(String[] args, boolean verbose)
    {
    String lpath = vtkSettings.GetVTKLibraryDir();
    if ( lpath != null )
      {
      String path_separator = System.getProperty("path.separator");
      String s = System.getProperty("java.library.path");
      s = s + path_separator + lpath;
      System.setProperty("java.library.path", s);
      }
    String lname = System.mapLibraryName("vtkCommonJava");
    String[] kits = vtkSettings.GetKits();
    int cc;
    for ( cc = 0; cc < kits.length; cc ++ )
      {
      vtkTesting2.LoadLibrary(lpath, "vtk" + kits[cc] + "Java", verbose); 
      }
    vtkTesting2.Tester = new vtk.vtkTesting();
    for ( cc = 0; cc < args.length; cc ++ )
      {
      vtkTesting2.Tester.AddArgument(args[cc]);
      }
    }

  public static boolean IsInteractive()
    {
    if ( vtkTesting2.Tester.IsInteractiveModeSpecified() == 0 )
      {
      return false;
      }
    return true;
    }

  public static void Exit(int retVal)
    {
    if ( retVal == vtkTesting2.FAILED || retVal == vtkTesting2.NOT_RUN )
      {
      System.out.println("Test failed or was not run");
      System.exit(1);
      }
    System.out.println("Test passed");
    System.exit(0);
    }

  public static int RegressionTest( vtkRenderWindow renWin, int threshold )
    {
    vtkTesting2.Tester.SetRenderWindow(renWin);

    if (vtkTesting2.Tester.RegressionTest(threshold) == vtkTesting2.PASSED ) 
      {
      return vtkTesting2.PASSED;
      } 
    System.out.println("Image difference: " + vtkTesting2.Tester.GetImageDifference());
    return vtkTesting2.FAILED;
    }


  private static vtkTesting Tester = null;
}