Skip to content
Closed
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
8 changes: 4 additions & 4 deletions graphics/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ if (CMAKE_SYSTEM_NAME MATCHES Darwin)
# Folders for generated files
set(BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR})
set(JSON_PRO_DIR ${BUILD_DIR}/json_pro)
set(SVG_PRO_DIR ${BUILD_DIR}/svg_pro)
set(NEW_SVG_PRO_DIR ${BUILD_DIR}/new_svg_pro)
set(OLD_SVG_PRO_DIR ${BUILD_DIR}/old_svg_pro)
set(PDF_PRO_DIR ${BUILD_DIR}/pdf_pro)

# Create the generated directory
file(MAKE_DIRECTORY ${JSON_PRO_DIR})
file(MAKE_DIRECTORY ${SVG_PRO_DIR})
file(MAKE_DIRECTORY ${NEW_SVG_PRO_DIR})
file(MAKE_DIRECTORY ${OLD_SVG_PRO_DIR})
file(MAKE_DIRECTORY ${PDF_PRO_DIR})

# Decompress and copy over all references
foreach(FOLDER json_ref old_svg_ref pdf_ref svg_ref)
foreach(FOLDER json_ref old_svg_ref pdf_ref new_svg_ref)
file(GLOB ARCHIVES ${FOLDER}/*zip )
foreach(ARCHIVE ${ARCHIVES} )
file(ARCHIVE_EXTRACT INPUT ${ARCHIVE} DESTINATION ${FOLDER})
Expand Down Expand Up @@ -179,7 +179,7 @@ foreach(TEST_DESCRIPTION ${TEST_DESCRIPTIONS})
# EXEC node Test_JsRoot.js ${macro} ${BUILD_DIR})

elseif(${test_type} STREQUAL "a")
foreach (X "j" "o" "p")
foreach (X "j" "o" "p" "s")
ROOTTEST_ADD_TEST(${macro}_${X}
MACRO testGraphics.C
MACROARG \"${macro}\",\"${X}\",\"${macro_folder}\",\"${BUILD_DIR}\")
Expand Down
51 changes: 51 additions & 0 deletions graphics/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Recipe for Generating New Reference Files
This guide will help you update and generate new reference JSON, SVG and PDF files required for testing and debugging. Follow the steps below to ensure you are working with the most recent reference files.

IMPORTANT: Reference JSON's are used to generate new SVG's (headless chrome browser). It is important to debug always both test and in case of a need of new references files to generate new ones for both. Therefore it is necessary to first update the json files and then the new svg files.

## 1. Setting up
### 1. Create and Prepare Directories
Start by creating a directory for testing and cloning the necessary repositories.

mkdir myTesting
cd myTesting
git clone https://github.com/root-project/root.git
git clone https://github.com/root-project/roottest.git

### 2. Build Configuration
Create a build directory, configure the build to include testing and roottest options, and build the project.

mkdir build
cd build
cmake -Dtesting=ON -Droottest=ON ../root
cmake --build . -j8

## 2. Running Tests
To update or debug tests, run the specific tests you are interested in. Replace macroname and testtype with the actual names used in your tests.

ctest -R roottest-graphics-macroname_testtype

## 3. Updating Reference Files
### 1. Navigate to the Generated Files Directory
Change to the directory where the new reference files are located. Replace folder_pro with the actual folder name.

cd /path/to/build/roottest/graphics/folder_pro

### 2. Move and Rename Files
Move and rename the files from the _pro suffix to the appropriate reference folder. Replace folder_ref with the actual folder name.

for file in *_pro*; do
mv "$file" "/path/to/roottest/graphics/folder_ref/${file/_pro/}";
done

### 3. Zip the Updated Reference Files
Change to the reference folder and compress the updated files into zip archives.

cd /path/to/roottest/graphics/ref_folder
ls *.fileformat | awk '{print "zip -m " $1 ".zip " $1}' | sh (replace fileformat)

Replace fileformat with the actual file extension of your reference files (e.g., svg, pdf, json).




110 changes: 0 additions & 110 deletions graphics/Test_JsRoot.js

This file was deleted.

Binary file added graphics/new_svg_ref/analyze.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/annotation3d.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/approx.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/archi.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/arrows.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/atlasexample.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/basic3d.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/breitwigner.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/candledecay.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/candleplot.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/candleplotstack.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/candleplotwhiskers.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/candlescaled.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/canvas.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/chi2test.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/compile.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/crown.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/crystalball.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/dynamicslice.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/ellipse.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/eval.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/event.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/exclusiongraph.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/exclusiongraph2.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/feynman.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/fibonacci.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/fillhistosauto2p.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/fillrandom.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/first.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/formula1.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/framework.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/gammafun.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/gaussian_ratio_plot.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/gaxis.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/gaxis3.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/gerrors.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/gerrors2.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/gmultierrors.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/graph.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/graph2derrorsfit.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/graphapply.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/graphpolar.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/graphpolar2.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/graphpolar3.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/graphreverse.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/graphshade.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/greyscale.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/h2_cut.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/h2proj.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/histpalettecolor.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/hksimple.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/hlabels1.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/hlgraph1.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/hlhisto1.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/hlhisto2.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/hlquantiles.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/hstack.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/labels1.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/labels2.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/latex.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/latex2.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/latex3.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/latex4.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/latex5.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/legendautoplaced.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/logscales.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/markerwarning.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/mass_spectrum.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/mathbeta.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/mathcorecdf.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/mathcorestatfunc.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/mathgammanormal.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/mathlaplace.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/mathstudent.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/movepalette.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/multicolor.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/multigraph.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/normaldist.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/normalizehistogram.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/pavetext.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/piechart.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/quantiles.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/quarks.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/ratioplot1.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/ratioplot2.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/ratioplot3.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/ratioplot4.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/ratioplot5.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/ratioplot6.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/ratioplotold.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/rebin.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/reverseaxis.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/scatter.svg.zip
Binary file not shown.
Binary file not shown.
Binary file added graphics/new_svg_ref/surfaces.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/testsmooth.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/th2polyboxes.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/th2polyeurope.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/th2polyhoneycomb.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/th2polyusa.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/timeonaxis.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/timeonaxis2.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/timeonaxis3.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/tmathtext.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/tmathtext2.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/transparency.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/triangles.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/twoscales.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/vavilov.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/waves.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/xyplot.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/zdemo.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/zones.svg.zip
Binary file not shown.
Binary file added graphics/new_svg_ref/zoomhistogram.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/AtlasExample.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/BreitWigner.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/CrystalBall.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/DynamicSlice.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/Fibonacci.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/GammaFun.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/NormalizeHistogram.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/TSVDUnfoldExample.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/ZoomHistogram.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/analyze.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/annotation3d.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/approx.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/archi.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/arrows.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/basic3d.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/candledecay.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/candleplot.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/candleplotstack.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/candleplotwhiskers.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/candlescaled.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/canvas.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/chi2test.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/compile.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/crown.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/ellipse.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/eval.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/event.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/exclusiongraph.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/exclusiongraph2.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/feynman.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/fillhistosauto2p.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/fillrandom.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/first.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/formula1.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/framework.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/gaussian_ratio_plot.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/gaxis.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/gaxis3.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/gerrors.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/gerrors2.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/gmultierrors.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/graph.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/graph2derrorsfit.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/graphApply.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/graphShade.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/graphpolar.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/graphpolar2.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/graphpolar3.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/graphreverse.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/greyscale.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/h2_cut.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/h2proj.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/histpalettecolor.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/hksimple.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/hlGraph1.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/hlHisto1.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/hlHisto2.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/hlHisto4.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/hlabels1.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/hlquantiles.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/hstack.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/labels1.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/labels2.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/latex.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/latex2.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/latex3.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/latex4.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/latex5.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/legendautoplaced.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/logscales.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/markerwarning.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/mass_spectrum.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/mathBeta.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/mathGammaNormal.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/mathLaplace.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/mathStudent.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/mathcoreCDF.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/mathcoreStatFunc.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/movepalette.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/multicolor.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/multigraph.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/normalDist.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/pavetext.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/piechart.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/quantiles.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/quarks.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/ratioplot1.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/ratioplot2.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/ratioplot3.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/ratioplot4.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/ratioplot5.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/ratioplot6.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/ratioplotOld.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/rebin.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/reverseaxis.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/scatter.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/schroedinger_hydrogen.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/statsEditing.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/surfaces.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/testSmooth.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/th2polyBoxes.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/th2polyEurope.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/th2polyHoneycomb.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/th2polyUSA.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/timeonaxis.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/timeonaxis2.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/timeonaxis3.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/tmathtext.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/tmathtext2.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/transpad.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/transparency.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/triangles.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/twoscales.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/vavilov.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/waves.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/xyplot.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/zdemo.svg.zip
Binary file not shown.
Binary file removed graphics/svg_ref/zones.svg.zip
Binary file not shown.
65 changes: 56 additions & 9 deletions graphics/testGraphics.C
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "TWebCanvas.h"
#include "TLatex.h"
#include <TSystem.h>
#include<TBufferText.h>

#include <algorithm>
#include <cstdio>
Expand Down Expand Up @@ -165,7 +166,7 @@ int test_json(TCanvas* c1, const std::string& macroName, const std::string& buil
return 0;
}

//---------------------SVG-----------------------------------------------------------------
//---------------------old SVG-------------------------------------------------------------
// Function to remove or normalize specific parts of the SVG content
std::string preprocessSVGContent(const std::string& svgContent) {
std::string result = svgContent;
Expand All @@ -181,7 +182,7 @@ std::string preprocessSVGContent(const std::string& svgContent) {
return result;
}

// Function to compare two SVG files (old graphics)
// Function to compare two old SVG files (old graphics)
bool compareSVGFiles(const std::string& filePath1, const std::string& filePath2) {
try {
std::string content1 = readFileToString(filePath1);
Expand All @@ -205,7 +206,7 @@ bool compareSVGFiles(const std::string& filePath1, const std::string& filePath2)
}
}

int test_svg(TCanvas* c1, const std::string& macroName, const std::string& builddir) {
int test_old_svg(TCanvas* c1, const std::string& macroName, const std::string& builddir) {
// Paths to the reference and generated SVG files
std::string refFilePath = "./old_svg_ref/" + macroName + ".svg";
std::string genFilePath = builddir + "/old_svg_pro/" + macroName + "_pro.svg";
Expand All @@ -223,9 +224,9 @@ int test_svg(TCanvas* c1, const std::string& macroName, const std::string& build

// Compare the generated SVG file with the reference SVG file
if (compareSVGFiles(refFilePath, genFilePath)) {
std::cout << "SVG test passed for " << macroName << std::endl;
std::cout << "Old SVG test passed for " << macroName << std::endl;
} else {
std::cout << "SVG test failed for " << macroName << std::endl;
std::cout << "Old SVG test failed for " << macroName << std::endl;
return 1;
}
return 0;
Expand Down Expand Up @@ -273,10 +274,10 @@ bool comparePDFFiles(const std::string& filePath1, const std::string& filePath2)
}
}

int test_pdf(TCanvas* c1, const std::string& macroName, const std::string& buildir) {
// Paths to the reference and generated SVG files
int test_pdf(TCanvas* c1, const std::string& macroName, const std::string& builddir) {
// Paths to the reference and generated PDF files
std::string refFilePath = "./pdf_ref/" + macroName + ".pdf";
std::string genFilePath = buildir + "/pdf_pro/" + macroName + "_pro.pdf";
std::string genFilePath = builddir + "/pdf_pro/" + macroName + "_pro.pdf";

// Check if the reference file exists
FileStat_t fstat;
Expand All @@ -298,6 +299,44 @@ int test_pdf(TCanvas* c1, const std::string& macroName, const std::string& build
}
return 0;
}
//---------------------new SVG-------------------------------------------------------------
int test_new_svg(const std::string& macroName, const std::string& builddir){
// Paths to the reference and generated new SVG files
std::string refFilePath = "./new_svg_ref/" + macroName + ".svg";
std::string genFilePath = builddir + "/new_svg_pro/" + macroName + "_pro.svg";

// path to refernces json to generated new svg
std::string refJsonFilePath = "./json_ref/" + macroName + ".json";

// Read the JSON file
std::ifstream refJsonFile(refJsonFilePath);
if (!refJsonFile.is_open()) {
std::cerr << "Could not open the JSON file: " << refJsonFilePath << std::endl;
return 1;
}
std::string ref_json((std::istreambuf_iterator<char>(refJsonFile)), std::istreambuf_iterator<char>());
refJsonFile.close();

// Check if the reference file exists
FileStat_t fstat;
if (1 == gSystem->GetPathInfo(refFilePath.c_str(), fstat)) {
std::cout << "Reference file not found. Saving generated file as reference: " << macroName << std::endl;
ROOT::RWebDisplayHandle::ProduceImage(refFilePath, ref_json, 1200, 800);
return 1;
} else {
// Save the generated SVG file
ROOT::RWebDisplayHandle::ProduceImage(genFilePath, ref_json, 1200, 800);
}

// Compare the generated PDF file with the reference PDF file
if (compareSVGFiles(refFilePath, genFilePath)) {
std::cout << "New SVG test passed for " << macroName << std::endl;
} else {
std::cout << "New SVG failed for " << macroName << std::endl;
return 1;
}
return 0;
}

// TEST ROOT MACRO -------------------------------------------------------------------------------
int testGraphics(const std::string& macroName, const std::string& test_type, const std::string& macro_folder, const std::string& builddir) {
Expand All @@ -318,6 +357,9 @@ int testGraphics(const std::string& macroName, const std::string& test_type, con
gStyle->SetStatTextColor(1); // Text color of stat box
gStyle->SetStatBorderSize(1); // Border size of stat box

// Here one could set the precison
// TBufferText::SetFloatFormat("%.2f");
// TBufferText::SetDoubleFormat("%.2f");

// Call the macro to generate the canvas
std::string command = ".x " + macroPath;
Expand All @@ -335,18 +377,23 @@ int testGraphics(const std::string& macroName, const std::string& test_type, con
// j === test the JSON creation
// o === test the SVG creation in ROOT (old graphics with --web=off)
// p == test the PDF creation in ROOT (old graphics with --web=off)
// s == test the SVG creation in ROOT (new graphics with web=chrome)

if (test_type == "j") {
return test_json(c1, macroName, builddir);
}
if (test_type == "o") {
gROOT->SetWebDisplay("off");
return test_svg(c1, macroName, builddir);
return test_old_svg(c1, macroName, builddir);
}
if (test_type == "p") {
gROOT->SetWebDisplay("off");
return test_pdf(c1, macroName, builddir);
}
if (test_type == 's'){
gROOT->SetWebDisplay("chrome");
return test_new_svg(macroName, builddir);
}
std::cerr << "Unrecognised test type '" << test_type << "'" << std::endl;
return 1;
}
Expand Down