#pragma once #include #include #include "../xlnt.h" class ChartTestSuite : public CxxTest::TestSuite { public: ChartTestSuite() { } void setUp() { /* xlnt::workbook wb; auto ws = wb.get_active(); ws.set_title("data"); for(int i = 0; i < 10; i++) { ws.cell(i, 0) = i; auto chart = BarChart(); chart.title = "TITLE"; chart.add_serie(Serie(Reference(ws, (0, 0), (10, 0)))); chart._series[-1].color = Color.GREEN; cw = ChartWriter(chart); root = Element("test"); } */ } void test_write_title() { /* cw._write_title(root); TS_ASSERT_EQUALS(get_xml(root), "TITLE"); */ } void test_write_xaxis() { /* cw._write_axis(root, chart.x_axis, "c:catAx"); TS_ASSERT_EQUALS(get_xml(root), ""); */ } void test_write_yaxis() { /* cw._write_axis(root, chart.y_axis, "c:valAx"); TS_ASSERT_EQUALS(get_xml(root), ""); */ } void test_write_series() { //cw._write_series(root); //TS_ASSERT_EQUALS(get_xml(root), "\"data\"!$A$1:$A$11General0123456789None"); } void test_write_legend() { /*cw._write_legend(root); TS_ASSERT_EQUALS(get_xml(root), "");*/ } void test_no_write_legend() { /*xlnt::workbook wb; auto ws = wb.get_active(); ws.set_title("data"); for(int i = 0; i < 10; i++) { ws.cell(i, 0) = i; ws.cell(i, 1) = i; scatterchart = ScatterChart(); scatterchart.add_serie(Serie(Reference(ws, (0, 0), (10, 0)), ; xvalues = Reference(ws, (0, 1), (10, 1)))); cw = ChartWriter(scatterchart); root = Element("test"); scatterchart.show_legend = False; cw._write_legend(root); TS_ASSERT_EQUALS(get_xml(root), ""); }*/ } void test_write_print_settings() { /*cw._write_print_settings(root); TS_ASSERT_EQUALS(get_xml(root), "");*/ } void test_write_chart() { //cw._write_chart(root); //// Truncate floats because results differ with Python >= 3.2 and <= 3.1 //test_xml = sub("([0-9][.][0-9]{4})[0-9]*", "\\1", get_xml(root)); //TS_ASSERT_EQUALS(test_xml, "TITLE\"data\"!$A$1:$A$11General0123456789None"); } void setUp_scatter() { /*wb = Workbook(); ws = wb.get_active_sheet(); ws.title = "data"; for i in range(10) { ws.cell(row = i, column = 0).value = i; ws.cell(row = i, column = 1).value = i; scatterchart = ScatterChart(); scatterchart.add_serie(Serie(Reference(ws, (0, 0), (10, 0)), ; xvalues = Reference(ws, (0, 1), (10, 1)))); cw = ChartWriter(scatterchart); root = Element("test"); }*/ } void test_write_xaxis_scatter() { /*scatterchart.x_axis.title = "test x axis title"; cw._write_axis(root, scatterchart.x_axis, "c:valAx"); TS_ASSERT_EQUALS(get_xml(root), "test x axis title");*/ } void test_write_yaxis_scatter() { /*scatterchart.y_axis.title = "test y axis title"; cw._write_axis(root, scatterchart.y_axis, "c:valAx"); TS_ASSERT_EQUALS(get_xml(root), "test y axis title");*/ } void test_write_series_scatter() { /*cw._write_series(root); TS_ASSERT_EQUALS(get_xml(root), "\"data\"!$B$1:$B$11General0123456789None\"data\"!$A$1:$A$11General0123456789None");*/ } void test_write_legend_scatter() { /*cw._write_legend(root); TS_ASSERT_EQUALS(get_xml(root), "");*/ } void test_write_print_settings_scatter() { /*cw._write_print_settings(root); TS_ASSERT_EQUALS(get_xml(root), "");*/ } void test_write_chart_scatter() { //cw._write_chart(root); //// Truncate floats because results differ with Python >= 3.2 and <= 3.1 //test_xml = sub("([0-9][.][0-9]{4})[0-9]*", "\\1", get_xml(root)); //TS_ASSERT_EQUALS(test_xml, "; } };