diff --git a/run.sh b/run.sh index e0a131c8d6d7d2e7c40bc0ae7812c07402717b8b..0af9464b804cbfcf3cc08226342d8b99a0b009cd 100755 --- a/run.sh +++ b/run.sh @@ -26,8 +26,6 @@ if [ x"$hostname" == x"cifarm-mac-node.mpi-cbg.de" ]; then fi pwd -ls -ls test_data/csv_out_test.csv ./build/src/io diff --git a/src/Plot/Plot_unit_tests.hpp b/src/Plot/Plot_unit_tests.hpp index f7a2e448700f23225ef1e269780a3e53b2809033..37a742f4dfde5ab96a73c051099fa06b3d06283e 100644 --- a/src/Plot/Plot_unit_tests.hpp +++ b/src/Plot/Plot_unit_tests.hpp @@ -124,7 +124,7 @@ BOOST_AUTO_TEST_CASE( google_chart ) //! [Producing an Histogram graph] - bool test = compare("gc_out.html","gc_out_test.html"); + bool test = compare("gc_out.html","test_data/gc_out_test.html"); BOOST_REQUIRE_EQUAL(true,test); } @@ -173,7 +173,7 @@ BOOST_AUTO_TEST_CASE( google_chart2 ) cg.AddHistGraph(x,y,yn,options); cg.write("gc_out2.html"); - bool test = compare("gc_out2.html","gc_out2_test.html"); + bool test = compare("gc_out2.html","test_data/gc_out2_test.html"); BOOST_REQUIRE_EQUAL(true,test); } @@ -221,7 +221,7 @@ BOOST_AUTO_TEST_CASE( google_chart3 ) cg.AddHistGraph(x,y,yn,options); cg.write("gc_out3.html"); - bool test = compare("gc_out3.html","gc_out3_test.html"); + bool test = compare("gc_out3.html","test_data/gc_out3_test.html"); BOOST_REQUIRE_EQUAL(true,test); } @@ -262,7 +262,7 @@ BOOST_AUTO_TEST_CASE( google_chart4 ) cg.AddHistGraph(x,y,yn); cg.write("gc_out4.html"); - bool test = compare("gc_out4.html","gc_out4_test.html"); + bool test = compare("gc_out4.html","test_data/gc_out4_test.html"); BOOST_REQUIRE_EQUAL(true,test); } @@ -295,7 +295,7 @@ BOOST_AUTO_TEST_CASE( google_chart5 ) cg.AddHistGraph(x,y); cg.write("gc_out5.html"); - bool test = compare("gc_out5.html","gc_out5_test.html"); + bool test = compare("gc_out5.html","test_data/gc_out5_test.html"); BOOST_REQUIRE_EQUAL(true,test); } @@ -320,7 +320,7 @@ BOOST_AUTO_TEST_CASE( google_chart6 ) cg.AddHistGraph(y); cg.write("gc_out6.html"); - bool test = compare("gc_out6.html","gc_out6_test.html"); + bool test = compare("gc_out6.html","test_data/gc_out6_test.html"); BOOST_REQUIRE_EQUAL(true,test); } @@ -383,7 +383,7 @@ BOOST_AUTO_TEST_CASE( google_chart_with_inject_HTML ) //! [Producing a set of histograms graphs] - bool test = compare("gc_out7.html","gc_out7_test.html"); + bool test = compare("gc_out7.html","test_data/gc_out7_test.html"); BOOST_REQUIRE_EQUAL(true,test); } @@ -437,7 +437,7 @@ BOOST_AUTO_TEST_CASE( google_chart_number ) //! [Producing a set of histograms graphs] - bool test = compare("gc_num_plot.html","gc_num_plot_test.html"); + bool test = compare("gc_num_plot.html","test_data/gc_num_plot_test.html"); BOOST_REQUIRE_EQUAL(true,test); } @@ -503,7 +503,7 @@ BOOST_AUTO_TEST_CASE( google_chart_number_lines_different_x ) //! [Producing a set of histograms graphs] - bool test = compare("gc_num_ydif_plot.html","gc_num_ydif_plot_test.html"); + bool test = compare("gc_num_ydif_plot.html","test_data/gc_num_ydif_plot_test.html"); BOOST_REQUIRE_EQUAL(true,test); } @@ -570,7 +570,7 @@ BOOST_AUTO_TEST_CASE( google_chart_linear_plot ) //! [Producing lines graph with style] - bool test = compare("gc_plot_out.html","gc_plot_out_test.html"); + bool test = compare("gc_plot_out.html","test_data/gc_plot_out_test.html"); BOOST_REQUIRE_EQUAL(true,test); } @@ -619,7 +619,7 @@ BOOST_AUTO_TEST_CASE( google_chart_linear_plot2 ) //! [Producing lines] - bool test = compare("gc_plot2_out.html","gc_plot2_out_test.html"); + bool test = compare("gc_plot2_out.html","test_data/gc_plot2_out_test.html"); BOOST_REQUIRE_EQUAL(true,test); } diff --git a/test_data/gc_num_plot_test.html b/test_data/gc_num_plot_test.html new file mode 100644 index 0000000000000000000000000000000000000000..455f7c46e1ee67ad0c4a5a38faad543bd4917c38 --- /dev/null +++ b/test_data/gc_num_plot_test.html @@ -0,0 +1,50 @@ +<html> + <head> + <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> + <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> + <script type="text/javascript"> + google.charts.load('current', {'packages':['corechart']}); + google.charts.setOnLoadCallback(drawVisualization); + +function exportToSVG(i) +{ +var e = document.getElementById('chart_div'+i); +var svg = e.getElementsByTagName('svg')[0].parentNode.innerHTML; +var pos = svg.lastIndexOf("</svg>"); +pos += 6; +svg = svg.substring(0,4) + " xmlns='http://www.w3.org/2000/svg' xmlns:xlink= 'http://www.w3.org/1999/xlink' " + svg.substring(4,pos); +svgData = 'data:image/svg+xml;charset=utf-8,' + encodeURIComponent(svg); +$(this).attr({'href': svgData,'target': '_blank'}); +} + + function drawVisualization() { +var data0 = new google.visualization.DataTable(); +data0.addColumn('number','X Axis'); +data0.addColumn('number','dataset1'); +data0.addColumn('number','dataset2'); +data0.addColumn('number','dataset3'); +data0.addColumn('number','dataset4'); +data0.addRows([ +[0.1,2,3,5,6], +[0.2,5,6,1,6], +[0.3,2,1,6,9], +[0.4,1,6,3,2], +[0.5,3,3,0,6], +[0.6,2,1,4,6], +]); +var options0= { +title : 'Example', +vAxis: {title: 'Y Axis'}, +hAxis: {title: 'X Axis'}, +curveType: 'function', +lineWidth: 4, +intervals: { 'style':'area' }}; +$("#export_svg0").on("click", function (event) {exportToSVG.apply(this,[0]);}); +var chart = new google.visualization.ComboChart(document.getElementById('chart_div0')); +chart.draw(data0, options0); +}</script> +</head> +<body> +<a href="#" download="graph1.svg" id="export_svg0"><button>Export data into svg</button></a><div id="chart_div0" style="width: 900px; height: 500px;"></div> +</body> +</html> diff --git a/gc_num_ydif_plot_test.html b/test_data/gc_num_ydif_plot_test.html similarity index 100% rename from gc_num_ydif_plot_test.html rename to test_data/gc_num_ydif_plot_test.html diff --git a/gc_out2_test.html b/test_data/gc_out2_test.html similarity index 100% rename from gc_out2_test.html rename to test_data/gc_out2_test.html diff --git a/gc_out3_test.html b/test_data/gc_out3_test.html similarity index 100% rename from gc_out3_test.html rename to test_data/gc_out3_test.html diff --git a/gc_out4_test.html b/test_data/gc_out4_test.html similarity index 100% rename from gc_out4_test.html rename to test_data/gc_out4_test.html diff --git a/gc_out5_test.html b/test_data/gc_out5_test.html similarity index 100% rename from gc_out5_test.html rename to test_data/gc_out5_test.html diff --git a/gc_out6_test.html b/test_data/gc_out6_test.html similarity index 100% rename from gc_out6_test.html rename to test_data/gc_out6_test.html diff --git a/gc_out7_test.html b/test_data/gc_out7_test.html similarity index 100% rename from gc_out7_test.html rename to test_data/gc_out7_test.html diff --git a/gc_out_test.html b/test_data/gc_out_test.html similarity index 100% rename from gc_out_test.html rename to test_data/gc_out_test.html diff --git a/gc_plot2_out_test.html b/test_data/gc_plot2_out_test.html similarity index 100% rename from gc_plot2_out_test.html rename to test_data/gc_plot2_out_test.html diff --git a/gc_plot_out_test.html b/test_data/gc_plot_out_test.html similarity index 100% rename from gc_plot_out_test.html rename to test_data/gc_plot_out_test.html