Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 if (oldcoutbuf) {
00039 cout.rdbuf(oldcoutbuf);
00040 redirectstream.close();
00041 }
00042
00043 if (result == 0) {
00044 if (!regression_tests.empty() && verbose.getValue() > 0) {
00045 cout << "Performing regression tests" << endl;
00046 }
00047 for (size_t i = 0; i < regression_tests.size(); i++) {
00048 const char* test_image_file = regression_tests[i].test_image_file.c_str();
00049 const char* baseline_image_file = regression_tests[i].baseline_image_file.c_str();
00050 vector<string> baseline_image_files = get_baseline_filenames(baseline_image_file);
00051 string bestmatch = baseline_image_file;
00052 int beststatus = numeric_limits<int>::max();
00053 if (baseline_image_files.empty()) {
00054 bestmatch += " not found";
00055 cerr << "No baseline images found given file path " << baseline_image_file << "!" << endl;
00056 } else {
00057 for (size_t j = 0; j < baseline_image_files.size(); j++) {
00058 int status = image_regression_test(
00059 test_image_file,
00060 baseline_image_files[j].c_str(),
00061 regression_tests[i].intensity_tolerance,
00062 regression_tests[i].max_number_of_differences,
00063 regression_tests[i].tolerance_radius);
00064 if (status < beststatus) {
00065 bestmatch = baseline_image_files[j];
00066 beststatus = status;
00067 }
00068 if (beststatus == 0) {
00069
00070 break;
00071 }
00072 }
00073
00074 if (beststatus != 0) {
00075 image_regression_test(
00076 test_image_file,
00077 baseline_image_files[0].c_str(),
00078 regression_tests[i].intensity_tolerance,
00079 regression_tests[i].max_number_of_differences,
00080 regression_tests[i].tolerance_radius,
00081 1);
00082 }
00083 }
00084
00085 cout << "<DartMeasurement name=\"BaselineImageName\" type=\"text/string\">";
00086 cout << get_file_name(bestmatch);
00087 cout << "</DartMeasurement>" << std::endl;
00088 result += beststatus;
00089 }
00090
00091 if (clean_cwd_after_test.getValue()) {
00092 clear_directory(get_working_directory().c_str());
00093 }
00094 }
00095
00096
00097 } catch (const exception& e) {
00098 cerr << "Test driver caught an exception:\n";
00099 cerr << e.what() << "\n";
00100 result = -1;
00101 } catch (...) {
00102 cerr << "Test driver caught an unknown exception!!!\n";
00103 result = -1;
00104 }
00105