Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ if(opengl AND TARGET TreeViewer)
ROOT_ADD_TEST(test-stressgraphics-interpreted
COMMAND ${root_exe} -b --web=off -q -l ${CMAKE_CURRENT_SOURCE_DIR}/stressGraphics.cxx
FAILREGEX "FAILED|Error in"
DEPENDS test-stressgraphics)
DEPENDS test-stressgraphics
LABELS longtest)
ROOT_ADD_TEST(test-stressgraphics-svg
COMMAND stressGraphics -b --web=off -p=svg --svg=${CMAKE_CURRENT_SOURCE_DIR}/svg_ref/
FAILREGEX "FAILED|Error in"
Expand Down
45 changes: 28 additions & 17 deletions test/stressGraphics.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <iomanip>
#include <fstream>
#include <ctime>
#include <sstream>
#include <string>
#include <vector>

Expand Down Expand Up @@ -277,6 +278,7 @@ Int_t StatusPrint(const TString &filename, const TString &title, Int_t res, Int_
std::cout << " Result = " << res << "\n";
std::cout << " Reference = " << ref << "\n";
std::cout << " Error = " << TMath::Abs(res - ref) << " (was " << err << ")\n";
std::cout << " File = " << filename << "\n";
gTestsFailed++;
return 1;
}
Expand Down Expand Up @@ -355,9 +357,19 @@ Int_t CompareSVGFiles(const TString &filename1, const TString &filename2, int te
return 0;
}

std::stringstream diffOld;
std::stringstream diffNew;
auto flushDiff = [&]() {
if (diffOld.tellp() != std::streampos(0)) {
std::cout << diffOld.str() << diffNew.str() << "\n";
diffOld.str("");
diffNew.str("");
}
};

std::string line1, line2;

int cnt = 0, diffcnt = 0, finediffcnt = 0;
int cnt = 0, diffcnt = 0, finediffcnt = 0, lastError = -1;

while (std::getline(f1, line1) && std::getline(f2, line2)) {
++cnt;
Expand All @@ -369,24 +381,23 @@ Int_t CompareSVGFiles(const TString &filename1, const TString &filename2, int te
if (!gSvgCompact && (cnt == 8))
continue;

// ignore difference in file name, only for debugging
// if (gSvgCompact && (cnt == 4))
// continue;
if (lastError + 1 != cnt) {
flushDiff();
diffOld << "--- " << filename1 << "\n" << "+++ " << filename2 << "\n@@@ " << cnt << "\n";
}
lastError = cnt;
diffOld << "- " << line1 << "\n";
diffNew << "+ " << line2 << "\n";

printf("Diff in line %d", cnt);
if (line1.length() != line2.length())
printf(" len1: %d len2: %d\n", (int) line1.length(), (int) line2.length());
else
printf("\n");
printf("Ref: %s\n", line1.substr(0, 200).c_str());
printf("New: %s\n", line2.substr(0, 200).c_str());
if ((testsvg == kFineSvgTest) && SpecialCompareOfSVGLines(line1, line2)) {
if (finediffcnt++ > 5)
return 0;
} else if (++diffcnt > 5)
return 0;
break;
}

flushDiff();

if (diffcnt > 0)
return 0;

Expand Down Expand Up @@ -633,8 +644,8 @@ void print_reports()
StatusPrint(e.pngfile, "PNG output", FileSize(e.pngfile), ref->pngref, ref->pngerr);

if (e.execute_ccode) {
Int_t ret_code = StatusPrint(e.ps2file, "C file result",
e.IPS ? FileSize(e.ps2file) : AnalysePS(e.ps2file), ref->ps2ref, ref->ps2err);
Int_t ret_code = StatusPrint(e.ps2file, ".C -> .PS file result",
e.IPS ? FileSize(e.ps2file) : AnalysePS(e.ps2file), ref->ps2ref, ref->ps2err);

#ifndef __CLING__
if (!gOptionK && !ret_code)
Expand Down Expand Up @@ -2005,7 +2016,7 @@ void th2_cut()
Float_t y[6] = { 2, 0, -2, -2, 0, 2 };
TCutG *cut = new TCutG("cut", 6, x, y);

TH1 *hpxpy = (TH1*)gHsimple->Get("hpxpy");
TH1 *hpxpy = (TH1 *)gHsimple->Get("hpxpy")->Clone("th2_cut");

hpxpy->Draw("col [cut]");
cut->Draw("l");
Expand Down Expand Up @@ -3817,7 +3828,7 @@ void clonepad()
{
TCanvas *C = StartTest(700,500);

TH1 *hpxpy = (TH1*)gHsimple->Get("hpxpy");
TH1 *hpxpy = (TH1 *)gHsimple->Get("hpxpy")->Clone("hpxpy_clonepad");
hpxpy->Draw();
TCanvas *C2 = (TCanvas*)C->DrawClone();

Expand Down Expand Up @@ -4704,7 +4715,7 @@ int main(int argc, char *argv[])

stressGraphics(verbose, generate, keep);

return 0;
return gTestsFailed != 0;
}
#endif

4 changes: 2 additions & 2 deletions test/stressGraphics.ref
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
th1_palette 17056 100 32429 100 29162 12000 35018 15000 17487 300
thstack1 30815 100 28522 100 46061 15000 23026 10000 31035 100
th2_cut 14774 600 16179 300 19511 5000 11533 4000 16039 600
th2_candle 113353 1000 71394 500 136880 40000 51345 20000 115314 1000
th2_violin 73316 500 84161 500 85037 20000 34733 15000 73223 500
th2_candle 102431 1000 71394 500 136880 40000 51345 20000 115314 1000
th2_violin 67738 500 84161 500 85037 20000 34733 15000 73223 500
th2_axlabels 4878 600 14375 100 17419 5000 11709 1800 5770 600
th2_stats 27107 300 19227 300 30587 14000 16531 7000 27039 500
tellipse 4131 40 15272 100 34038 2500 12258 1400 4162 40
Expand Down
4 changes: 2 additions & 2 deletions test/stressGraphics_builtinzlib.ref
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
th1_palette 17056 100 32200 500 29162 12000 35018 15000 17487 300
thstack1 30815 100 28300 500 46061 15000 23026 10000 31035 100
th2_cut 14774 600 16179 300 19511 5000 11533 4000 16039 600
th2_candle 113353 1000 71394 500 136880 40000 51345 20000 115314 1000
th2_violin 73316 500 84161 500 85037 20000 34733 15000 73223 500
th2_candle 102431 1000 71394 500 136880 40000 51345 20000 115314 1000
th2_violin 67738 500 84161 500 85037 20000 34733 15000 73223 500
th2_axlabels 4878 600 14375 100 17419 5000 11709 1800 5770 600
th2_stats 27107 300 19227 300 30587 14000 16531 7000 27039 500
tellipse 4130 40 15193 50 34790 2500 12156 1400 4161 40
Expand Down
4 changes: 2 additions & 2 deletions test/svg_ref/clonepad.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading