16 #ifndef __vtkTestingOutputWindow_h 17 #define __vtkTestingOutputWindow_h 21 #include "vtkObject.h" 22 #include "vtkOutputWindow.h" 56 virtual void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
58 virtual void DisplayText(
const char* text) VTK_OVERRIDE;
59 virtual void DisplayErrorText(
const char* text) VTK_OVERRIDE;
60 virtual void DisplayWarningText(
const char* text) VTK_OVERRIDE;
61 virtual void DisplayGenericWarningText(
const char* text) VTK_OVERRIDE;
62 virtual void DisplayDebugText(
const char* text) VTK_OVERRIDE;
65 virtual void ResetNumberOfLoggedMessages();
68 vtkGetMacro(NumberOfLoggedMessages,
int);
69 vtkSetMacro(NumberOfLoggedMessages,
int);
72 vtkGetMacro(NumberOfLoggedWarningMessages,
int);
73 vtkSetMacro(NumberOfLoggedWarningMessages,
int);
76 vtkGetMacro(NumberOfLoggedErrorMessages,
int);
77 vtkSetMacro(NumberOfLoggedErrorMessages,
int);
80 int GetNumberOfLoggedWarningErrorMessages();
99 #define TESTING_OUTPUT_INIT() vtkTestingOutputWindow::GetInstance(); 102 #define TESTING_OUTPUT_RESET() vtkTestingOutputWindow::GetInstance()->ResetNumberOfLoggedMessages(); 105 #define TESTING_OUTPUT_ASSERT_MESSAGES(expectedNumberOfMessages) \ 107 int actualNumberOfMessages = vtkTestingOutputWindow::GetInstance()->GetNumberOfLoggedMessages(); \ 108 if (actualNumberOfMessages != expectedNumberOfMessages) \ 110 std::cerr << "Assertion failed in " << __FILE__ << ":" << __LINE__ << " - expected " << expectedNumberOfMessages \ 111 << " messages, got " << actualNumberOfMessages << std::endl; \ 112 exit(EXIT_FAILURE); \ 117 #define TESTING_OUTPUT_ASSERT_WARNINGS(expectedNumberOfMessages) \ 119 int actualNumberOfMessages = vtkTestingOutputWindow::GetInstance()->GetNumberOfLoggedWarningMessages(); \ 120 if (actualNumberOfMessages != expectedNumberOfMessages) \ 122 std::cerr << "Assertion failed in " << __FILE__ << ":" << __LINE__ << " - expected " << expectedNumberOfMessages \ 123 << " warnings messages, got " << actualNumberOfMessages << std::endl; \ 124 exit(EXIT_FAILURE); \ 129 #define TESTING_OUTPUT_ASSERT_ERRORS(expectedNumberOfMessages) \ 131 int actualNumberOfMessages = vtkTestingOutputWindow::GetInstance()->GetNumberOfLoggedErrorMessages(); \ 132 if (actualNumberOfMessages != expectedNumberOfMessages) \ 134 std::cerr << "Assertion failed in " << __FILE__ << ":" << __LINE__ << " - expected " << expectedNumberOfMessages \ 135 << " error messages, got " << actualNumberOfMessages << std::endl; \ 136 exit(EXIT_FAILURE); \ 141 #define TESTING_OUTPUT_ASSERT_WARNINGS_ERRORS(expectedNumberOfMessages) \ 143 int actualNumberOfMessages = vtkTestingOutputWindow::GetInstance()->GetNumberOfLoggedWarningErrorMessages(); \ 144 if (actualNumberOfMessages != expectedNumberOfMessages) \ 146 std::cerr << "Assertion failed in " << __FILE__ << ":" << __LINE__ << " - expected " << expectedNumberOfMessages \ 147 << " error or warning messages, got " << actualNumberOfMessages << std::endl; \ 148 exit(EXIT_FAILURE); \ 153 #define TESTING_OUTPUT_ASSERT_WARNINGS_MINIMUM(expectedNumberOfMessages) \ 155 int actualNumberOfMessages = vtkTestingOutputWindow::GetInstance()->GetNumberOfLoggedWarningMessages(); \ 156 if (actualNumberOfMessages < expectedNumberOfMessages) \ 158 std::cerr << "Assertion failed in " << __FILE__ << ":" << __LINE__ << " - expected minimum " << expectedNumberOfMessages \ 159 << " warning messages, got " << actualNumberOfMessages << std::endl; \ 160 exit(EXIT_FAILURE); \ 165 #define TESTING_OUTPUT_ASSERT_ERRORS_MINIMUM(expectedNumberOfMessages) \ 167 int actualNumberOfMessages = vtkTestingOutputWindow::GetInstance()->GetNumberOfLoggedErrorMessages(); \ 168 if (actualNumberOfMessages < expectedNumberOfMessages) \ 170 std::cerr << "Assertion failed in " << __FILE__ << ":" << __LINE__ << " - expected minimum " << expectedNumberOfMessages \ 171 << " error messages, got " << actualNumberOfMessages << std::endl; \ 172 exit(EXIT_FAILURE); \ 177 #define TESTING_OUTPUT_ASSERT_WARNINGS_BEGIN() \ 180 TESTING_OUTPUT_ASSERT_WARNINGS_ERRORS(0); \ 181 vtkInfoWithoutObjectMacro("Expecting warning message(s)..."); \ 185 #define TESTING_OUTPUT_ASSERT_WARNINGS_END() \ 187 TESTING_OUTPUT_ASSERT_WARNINGS_MINIMUM(1); \ 188 vtkInfoWithoutObjectMacro("Expected warning message(s) successfully received"); \ 189 TESTING_OUTPUT_ASSERT_ERRORS(0); \ 190 TESTING_OUTPUT_RESET(); \ 194 #define TESTING_OUTPUT_ASSERT_ERRORS_BEGIN() \ 197 TESTING_OUTPUT_ASSERT_WARNINGS_ERRORS(0); \ 198 vtkInfoWithoutObjectMacro("Expecting warning or error message(s)..."); \ 202 #define TESTING_OUTPUT_ASSERT_ERRORS_END() \ 204 TESTING_OUTPUT_ASSERT_ERRORS_MINIMUM(1); \ 205 vtkInfoWithoutObjectMacro("Expected error message(s) successfully received"); \ 206 TESTING_OUTPUT_RESET(); \ 210 #define TESTING_OUTPUT_IGNORE_WARNINGS_ERRORS_BEGIN() \ 213 TESTING_OUTPUT_ASSERT_WARNINGS_ERRORS(0); \ 214 vtkInfoWithoutObjectMacro("Ignoring expected warning or error message(s)..."); \ 218 #define TESTING_OUTPUT_IGNORE_WARNINGS_ERRORS_END() \ 220 vtkInfoWithoutObjectMacro("Finished ignoring warning or error message"); \ 221 TESTING_OUTPUT_RESET(); \ VTK message output window class for automated testing.
int NumberOfLoggedErrorMessages
int NumberOfLoggedWarningMessages
int NumberOfLoggedMessages