vtkTestingRenderingDriver.cmake 2.27 KB
Newer Older
1 2 3
SET(CMAKE_TESTDRIVER_BEFORE_TESTMAIN
"
    // Set defaults
4
    vtkTestingInteractor::ValidBaseline = \"Use_-V_for_Baseline\";
5
    vtkTestingInteractor::TempDirectory =
6
      std::string(\"${_vtk_build_TEST_OUTPUT_DIRECTORY}\");
7
    vtkTestingInteractor::DataDirectory = std::string(\"Use_-D_for_Data\");
8 9 10 11

    int interactive = 0;
    for (int ii = 0; ii < ac; ++ii)
      {
12
      if (strcmp(av[ii], \"-I\") == 0)
13 14 15 16
        {
        interactive = 1;
        continue;
        }
17
      if (ii < ac-1 && strcmp(av[ii], \"-V\") == 0)
18
        {
19
        vtkTestingInteractor::ValidBaseline = std::string(av[++ii]);
20 21
        continue;
        }
22
      if (ii < ac-1 && strcmp(av[ii], \"-T\") == 0)
23
        {
24
        vtkTestingInteractor::TempDirectory = std::string(av[++ii]);
25 26
        continue;
        }
27
      if (ii < ac-1 && strcmp(av[ii], \"-D\") == 0)
28
        {
29
        vtkTestingInteractor::DataDirectory = std::string(av[++ii]);
30 31
        continue;
        }
32
      if (ii < ac-1 && strcmp(av[ii], \"-E\") == 0)
33 34
        {
        vtkTestingInteractor::ErrorThreshold =
35
            static_cast<double>(atof(av[++ii]));
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
        continue;
        }
      }
    vtkSmartPointer<vtkTestingObjectFactory> factory = vtkSmartPointer<vtkTestingObjectFactory>::New();
    if (!interactive)
      {
      // Disable any other overrides before registering our factory.
      vtkObjectFactoryCollection *collection = vtkObjectFactory::GetRegisteredFactories();
      collection->InitTraversal();
      vtkObjectFactory *f = collection->GetNextItem();
      while (f)
        {
        f->Disable(\"vtkRenderWindowInteractor\");
        f = collection->GetNextItem();
        }
      vtkObjectFactory::RegisterFactory(factory);
      }
"
)

SET(CMAKE_TESTDRIVER_AFTER_TESTMAIN
"
58 59 60 61 62 63 64
   if (result == VTK_SKIP_RETURN_CODE)
     {
     printf(\"Unsupported runtime configuration: Test returned \"
            \"VTK_SKIP_RETURN_CODE. Skipping test.\\n\");
     return result;
     }

65 66 67 68
   if (!interactive)
     {
     if (vtkTestingInteractor::TestReturnStatus != -1)
        {
69
        if (vtkTestingInteractor::TestReturnStatus != vtkTesting::PASSED)
70 71 72 73 74 75 76 77 78 79 80 81
          {
          result = EXIT_FAILURE;
          }
        else
          {
          result = EXIT_SUCCESS;
          }
        }
      vtkObjectFactory::UnRegisterFactory(factory);
      }
"
)