Commit 959c9166 authored by Paul Asmuth's avatar Paul Asmuth
Browse files

compare all the fixtures in query test :)

parent 67a49279
Loading
Loading
Loading
Loading
+17 −15
Original line number Diff line number Diff line
@@ -37,20 +37,16 @@ static Parser parseTestQuery(const char* query) {

static void compareChart(
    fnordmetric::ui::Canvas* chart,
    const std::string& file_path) {
  std::string output_str;
  fnordmetric::util::StringOutputStream output_stream(&output_str);
  fnordmetric::ui::SVGTarget target(&output_stream);
  chart->render(&target);
    const std::string& file_name) {
  auto output_stream = fnordmetric::util::FileOutputStream::openFile(
      "build/tests/tmp/" + file_name);

  std::string input_str;
  auto input_stream = fnordmetric::util::FileInputStream::openFile(file_path);
  input_stream->readUntilEOF(&input_str);
  fnordmetric::ui::SVGTarget target(output_stream.get());
  chart->render(&target);

  if (input_str != output_str) {
    RAISE(fnordmetric::util::RuntimeException,
        "chart does not match '%s'", file_path.c_str());
  }
  EXPECT_FILES_EQ(
    "test/fixtures/" + file_name,
    "build/tests/tmp/" + file_name);
}

class TestTableRef : public TableRef {
@@ -829,7 +825,10 @@ TEST_CASE(QueryTest, TestSimpleDrawQuery, [] () {

  query.execute();
  auto chart = query.getChart(0);
  //chart->renderSVG();

  compareChart(
      chart,
      "QueryTest_TestSimpleDrawQuery_out.svg.html");
});

TEST_CASE(QueryTest, TestDerivedSeriesDrawQuery, [] () {
@@ -849,7 +848,10 @@ TEST_CASE(QueryTest, TestDerivedSeriesDrawQuery, [] () {

  query.execute();
  auto chart = query.getChart(0);
  chart->renderSVG();

  compareChart(
      chart,
      "QueryTest_TestDerivedSeriesDrawQuery_out.svg.html");
});

TEST_CASE(QueryTest, TestSimpleSelectFromCSV, [] () {
@@ -981,7 +983,7 @@ TEST_CASE(QueryTest, SimpleEndToEndTest, [] () {

  compareChart(
      chart,
      "build/tests/tmp/QueryTest_SimpleEndToEndTest_out.svg.html");
      "QueryTest_SimpleEndToEndTest_out.svg.html");
});


+225 −0
Original line number Diff line number Diff line
<svg width='1024' height='500' class='chart bar horizontal'>
  <style type='text/css'>
  <![CDATA[
  .chart text {
    font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
    font: 10pt sans-serif;
  }

  .axis .stroke {
    stroke: rgb(0,0,0);
    stroke-width: 1px;
  }

  .axis .tick {
    stroke: rgb(0,0,0);
    stroke-width: 1px;
  }

  .axis .label, .axis .title {
    fill: #000;
  }

  .axis .label {
    font-size: 9pt;
  }

  .axis .title {
    font-size: 11pt;
  }

  .chart .line {
    fill: none;
    stroke: #000;
  }

  .chart .area {
    opacity: 0.8;
  }

  .chart .bar,
  .chart .point,
  .chart .area {
    fill: #000;
  }

  .chart .bar.color6,
  .chart .point.color6,
  .chart .area.color6 {
    fill: #db843d;
  }

  .chart .lines .line.color6 {
    strok: #db843d;
  }

  .chart .bar.color5,
  .chart .point.color5,
  .chart .area.color5 {
    fill: #3d96ae;
  }

  .chart .lines .line.color5 {
    stroke: #3d96ae;
  }

  .chart .bar.color4,
  .chart .point.color4,
  .chart .area.color4 {
    fill: #80699b;
  }

  .chart .line.color4 {
    stroke: #80699b;
  }

  .chart .bar.color3,
  .chart .point.color3,
  .chart .area.color3 {
    fill: #89a54e;
  }

  .chart .line.color3 {
    stroke: #89a54e;
  }

  .chart .bar.color2,
  .chart .point.color2,
  .chart .area.color2 {
    fill: #aa4643;
  }

  .chart .line.color2 {
    stroke: #aa4643;
  }

  .chart .bar.color1,
  .chart .point.color1,
  .chart .area.color1 {
    fill: #4572a7;
  }

  .chart .line.color1 {
    stroke: #4572a7;
  }

  .chart.bar.vertical .axis.left .stroke,
  .chart.bar.vertical .axis.left .tick,
  .chart.bar.vertical .axis.right .stroke,
  .chart.bar.vertical .axis.right .tick {
    display: none;
  }
  ]]>
  </style>
  <g class='axis bottom'>
    <text x='55.000000' y='470.000000' style='text-anchor:middle; dominant-baseline:text-before-edge;' class='label' >0</text>
    <text x='243.800000' y='470.000000' style='text-anchor:middle; dominant-baseline:text-before-edge;' class='label' >3696.0k</text>
    <text x='432.600000' y='470.000000' style='text-anchor:middle; dominant-baseline:text-before-edge;' class='label' >7392.0k</text>
    <text x='621.400000' y='470.000000' style='text-anchor:middle; dominant-baseline:text-before-edge;' class='label' >11088.0k</text>
    <text x='810.200000' y='470.000000' style='text-anchor:middle; dominant-baseline:text-before-edge;' class='label' >14784.0k</text>
    <text x='999.000000' y='470.000000' style='text-anchor:middle; dominant-baseline:text-before-edge;' class='label' >18480.0k</text>
    <line x1='55.000000' y1='460.000000' x2='55.000000' y2='455.000000' class='tick' />
    <line x1='243.800000' y1='460.000000' x2='243.800000' y2='455.000000' class='tick' />
    <line x1='432.600000' y1='460.000000' x2='432.600000' y2='455.000000' class='tick' />
    <line x1='621.400000' y1='460.000000' x2='621.400000' y2='455.000000' class='tick' />
    <line x1='810.200000' y1='460.000000' x2='810.200000' y2='455.000000' class='tick' />
    <line x1='999.000000' y1='460.000000' x2='999.000000' y2='455.000000' class='tick' />
    <line x1='55.000000' y1='460.000000' x2='999.000000' y2='460.000000' class='stroke' />
  </g>
  <g class='axis left'>
    <text x='45.000000' y='451.189222' style='text-anchor:end; dominant-baseline:middle;' class='label' >ARE</text>
    <text x='45.000000' y='436.521000' style='text-anchor:end; dominant-baseline:middle;' class='label' >THA</text>
    <text x='45.000000' y='421.852778' style='text-anchor:end; dominant-baseline:middle;' class='label' >AUT</text>
    <text x='45.000000' y='407.184556' style='text-anchor:end; dominant-baseline:middle;' class='label' >VEN</text>
    <text x='45.000000' y='392.516333' style='text-anchor:end; dominant-baseline:middle;' class='label' >BEL</text>
    <text x='45.000000' y='377.848111' style='text-anchor:end; dominant-baseline:middle;' class='label' >NOR</text>
    <text x='45.000000' y='363.179889' style='text-anchor:end; dominant-baseline:middle;' class='label' >POL</text>
    <text x='45.000000' y='348.511667' style='text-anchor:end; dominant-baseline:middle;' class='label' >NGA</text>
    <text x='45.000000' y='333.843444' style='text-anchor:end; dominant-baseline:middle;' class='label' >SWE</text>
    <text x='45.000000' y='319.175222' style='text-anchor:end; dominant-baseline:middle;' class='label' >ARG</text>
    <text x='45.000000' y='304.507000' style='text-anchor:end; dominant-baseline:middle;' class='label' >CHE</text>
    <text x='45.000000' y='289.838778' style='text-anchor:end; dominant-baseline:middle;' class='label' >SAU</text>
    <text x='45.000000' y='275.170556' style='text-anchor:end; dominant-baseline:middle;' class='label' >NLD</text>
    <text x='45.000000' y='260.502333' style='text-anchor:end; dominant-baseline:middle;' class='label' >TUR</text>
    <text x='45.000000' y='245.834111' style='text-anchor:end; dominant-baseline:middle;' class='label' >IDN</text>
    <text x='45.000000' y='231.165889' style='text-anchor:end; dominant-baseline:middle;' class='label' >MEX</text>
    <text x='45.000000' y='216.497667' style='text-anchor:end; dominant-baseline:middle;' class='label' >KOR</text>
    <text x='45.000000' y='201.829444' style='text-anchor:end; dominant-baseline:middle;' class='label' >ESP</text>
    <text x='45.000000' y='187.161222' style='text-anchor:end; dominant-baseline:middle;' class='label' >AUS</text>
    <text x='45.000000' y='172.493000' style='text-anchor:end; dominant-baseline:middle;' class='label' >CAN</text>
    <text x='45.000000' y='157.824778' style='text-anchor:end; dominant-baseline:middle;' class='label' >IND</text>
    <text x='45.000000' y='143.156556' style='text-anchor:end; dominant-baseline:middle;' class='label' >ITA</text>
    <text x='45.000000' y='128.488333' style='text-anchor:end; dominant-baseline:middle;' class='label' >RUS</text>
    <text x='45.000000' y='113.820111' style='text-anchor:end; dominant-baseline:middle;' class='label' >BRA</text>
    <text x='45.000000' y='99.151889' style='text-anchor:end; dominant-baseline:middle;' class='label' >GBR</text>
    <text x='45.000000' y='84.483667' style='text-anchor:end; dominant-baseline:middle;' class='label' >FRA</text>
    <text x='45.000000' y='69.815444' style='text-anchor:end; dominant-baseline:middle;' class='label' >DEU</text>
    <text x='45.000000' y='55.147222' style='text-anchor:end; dominant-baseline:middle;' class='label' >JPN</text>
    <text x='45.000000' y='40.479000' style='text-anchor:end; dominant-baseline:middle;' class='label' >CHN</text>
    <text x='45.000000' y='25.810778' style='text-anchor:end; dominant-baseline:middle;' class='label' >USA</text>
    <line x1='55.000000' y1='460.000000' x2='60.000000' y2='460.000000' class='tick' />
    <line x1='55.000000' y1='443.855111' x2='60.000000' y2='443.855111' class='tick' />
    <line x1='55.000000' y1='429.186889' x2='60.000000' y2='429.186889' class='tick' />
    <line x1='55.000000' y1='414.518667' x2='60.000000' y2='414.518667' class='tick' />
    <line x1='55.000000' y1='399.850444' x2='60.000000' y2='399.850444' class='tick' />
    <line x1='55.000000' y1='385.182222' x2='60.000000' y2='385.182222' class='tick' />
    <line x1='55.000000' y1='370.514000' x2='60.000000' y2='370.514000' class='tick' />
    <line x1='55.000000' y1='355.845778' x2='60.000000' y2='355.845778' class='tick' />
    <line x1='55.000000' y1='341.177556' x2='60.000000' y2='341.177556' class='tick' />
    <line x1='55.000000' y1='326.509333' x2='60.000000' y2='326.509333' class='tick' />
    <line x1='55.000000' y1='311.841111' x2='60.000000' y2='311.841111' class='tick' />
    <line x1='55.000000' y1='297.172889' x2='60.000000' y2='297.172889' class='tick' />
    <line x1='55.000000' y1='282.504667' x2='60.000000' y2='282.504667' class='tick' />
    <line x1='55.000000' y1='267.836444' x2='60.000000' y2='267.836444' class='tick' />
    <line x1='55.000000' y1='253.168222' x2='60.000000' y2='253.168222' class='tick' />
    <line x1='55.000000' y1='238.500000' x2='60.000000' y2='238.500000' class='tick' />
    <line x1='55.000000' y1='223.831778' x2='60.000000' y2='223.831778' class='tick' />
    <line x1='55.000000' y1='209.163556' x2='60.000000' y2='209.163556' class='tick' />
    <line x1='55.000000' y1='194.495333' x2='60.000000' y2='194.495333' class='tick' />
    <line x1='55.000000' y1='179.827111' x2='60.000000' y2='179.827111' class='tick' />
    <line x1='55.000000' y1='165.158889' x2='60.000000' y2='165.158889' class='tick' />
    <line x1='55.000000' y1='150.490667' x2='60.000000' y2='150.490667' class='tick' />
    <line x1='55.000000' y1='135.822444' x2='60.000000' y2='135.822444' class='tick' />
    <line x1='55.000000' y1='121.154222' x2='60.000000' y2='121.154222' class='tick' />
    <line x1='55.000000' y1='106.486000' x2='60.000000' y2='106.486000' class='tick' />
    <line x1='55.000000' y1='91.817778' x2='60.000000' y2='91.817778' class='tick' />
    <line x1='55.000000' y1='77.149556' x2='60.000000' y2='77.149556' class='tick' />
    <line x1='55.000000' y1='62.481333' x2='60.000000' y2='62.481333' class='tick' />
    <line x1='55.000000' y1='47.813111' x2='60.000000' y2='47.813111' class='tick' />
    <line x1='55.000000' y1='33.144889' x2='60.000000' y2='33.144889' class='tick' />
    <line x1='55.000000' y1='17.000000' x2='60.000000' y2='17.000000' class='tick' />
    <line x1='55.000000' y1='17.000000' x2='55.000000' y2='460.000000' class='stroke' />
  </g>
  <g class='bars horizontal'>
    <rect x='55.000000' y='19.800000' width='858.181818' height='11.106667' class='bar color1'></rect>
    <rect x='55.000000' y='33.706667' width='472.013792' height='11.106667' class='bar color1'></rect>
    <rect x='55.000000' y='47.613333' width='250.381186' height='11.106667' class='bar color1'></rect>
    <rect x='55.000000' y='61.520000' width='185.674941' height='11.106667' class='bar color1'></rect>
    <rect x='55.000000' y='75.426667' width='139.707352' height='11.106667' class='bar color1'></rect>
    <rect x='55.000000' y='89.333333' width='128.842770' height='11.106667' class='bar color1'></rect>
    <rect x='55.000000' y='103.240000' width='114.714032' height='11.106667' class='bar color1'></rect>
    <rect x='55.000000' y='117.146667' width='107.108089' height='11.106667' class='bar color1'></rect>
    <rect x='55.000000' y='131.053333' width='105.807024' height='11.106667' class='bar color1'></rect>
    <rect x='55.000000' y='144.960000' width='95.871016' height='11.106667' class='bar color1'></rect>
    <rect x='55.000000' y='158.866667' width='93.230012' height='11.106667' class='bar color1'></rect>
    <rect x='55.000000' y='172.773333' width='79.718808' height='11.106667' class='bar color1'></rect>
    <rect x='55.000000' y='186.680000' width='69.383132' height='11.106667' class='bar color1'></rect>
    <rect x='55.000000' y='200.586667' width='66.639555' height='11.106667' class='bar color1'></rect>
    <rect x='55.000000' y='214.493333' width='64.410377' height='11.106667' class='bar color1'></rect>
    <rect x='55.000000' y='228.400000' width='44.357068' height='11.106667' class='bar color1'></rect>
    <rect x='55.000000' y='242.306667' width='41.898020' height='11.106667' class='bar color1'></rect>
    <rect x='55.000000' y='256.213333' width='40.874638' height='11.106667' class='bar color1'></rect>
    <rect x='55.000000' y='270.120000' width='38.070223' height='11.106667' class='bar color1'></rect>
    <rect x='55.000000' y='284.026667' width='33.243410' height='11.106667' class='bar color1'></rect>
    <rect x='55.000000' y='297.933333' width='31.249823' height='11.106667' class='bar color1'></rect>
    <rect x='55.000000' y='311.840000' width='28.500729' height='11.106667' class='bar color1'></rect>
    <rect x='55.000000' y='325.746667' width='26.697526' height='11.106667' class='bar color1'></rect>
    <rect x='55.000000' y='339.653333' width='26.437261' height='11.106667' class='bar color1'></rect>
    <rect x='55.000000' y='353.560000' width='26.183740' height='11.106667' class='bar color1'></rect>
    <rect x='55.000000' y='367.466667' width='25.955709' height='11.106667' class='bar color1'></rect>
    <rect x='55.000000' y='381.373333' width='22.388533' height='11.106667' class='bar color1'></rect>
    <rect x='55.000000' y='395.280000' width='21.242248' height='11.106667' class='bar color1'></rect>
    <rect x='55.000000' y='409.186667' width='19.781704' height='11.106667' class='bar color1'></rect>
    <rect x='55.000000' y='423.093333' width='19.605317' height='11.106667' class='bar color1'></rect>
  </g>
</svg>
+154 −0
Original line number Diff line number Diff line
<svg width='1024' height='500' class='chart bar horizontal'>
  <style type='text/css'>
  <![CDATA[
  .chart text {
    font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
    font: 10pt sans-serif;
  }

  .axis .stroke {
    stroke: rgb(0,0,0);
    stroke-width: 1px;
  }

  .axis .tick {
    stroke: rgb(0,0,0);
    stroke-width: 1px;
  }

  .axis .label, .axis .title {
    fill: #000;
  }

  .axis .label {
    font-size: 9pt;
  }

  .axis .title {
    font-size: 11pt;
  }

  .chart .line {
    fill: none;
    stroke: #000;
  }

  .chart .area {
    opacity: 0.8;
  }

  .chart .bar,
  .chart .point,
  .chart .area {
    fill: #000;
  }

  .chart .bar.color6,
  .chart .point.color6,
  .chart .area.color6 {
    fill: #db843d;
  }

  .chart .lines .line.color6 {
    strok: #db843d;
  }

  .chart .bar.color5,
  .chart .point.color5,
  .chart .area.color5 {
    fill: #3d96ae;
  }

  .chart .lines .line.color5 {
    stroke: #3d96ae;
  }

  .chart .bar.color4,
  .chart .point.color4,
  .chart .area.color4 {
    fill: #80699b;
  }

  .chart .line.color4 {
    stroke: #80699b;
  }

  .chart .bar.color3,
  .chart .point.color3,
  .chart .area.color3 {
    fill: #89a54e;
  }

  .chart .line.color3 {
    stroke: #89a54e;
  }

  .chart .bar.color2,
  .chart .point.color2,
  .chart .area.color2 {
    fill: #aa4643;
  }

  .chart .line.color2 {
    stroke: #aa4643;
  }

  .chart .bar.color1,
  .chart .point.color1,
  .chart .area.color1 {
    fill: #4572a7;
  }

  .chart .line.color1 {
    stroke: #4572a7;
  }

  .chart.bar.vertical .axis.left .stroke,
  .chart.bar.vertical .axis.left .tick,
  .chart.bar.vertical .axis.right .stroke,
  .chart.bar.vertical .axis.right .tick {
    display: none;
  }
  ]]>
  </style>
  <g class='axis bottom'>
    <text x='55.000000' y='470.000000' style='text-anchor:middle; dominant-baseline:text-before-edge;' class='label' >0</text>
    <text x='243.800000' y='470.000000' style='text-anchor:middle; dominant-baseline:text-before-edge;' class='label' >6.6</text>
    <text x='432.600000' y='470.000000' style='text-anchor:middle; dominant-baseline:text-before-edge;' class='label' >13</text>
    <text x='621.400000' y='470.000000' style='text-anchor:middle; dominant-baseline:text-before-edge;' class='label' >20</text>
    <text x='810.200000' y='470.000000' style='text-anchor:middle; dominant-baseline:text-before-edge;' class='label' >26</text>
    <text x='999.000000' y='470.000000' style='text-anchor:middle; dominant-baseline:text-before-edge;' class='label' >33</text>
    <line x1='55.000000' y1='460.000000' x2='55.000000' y2='455.000000' class='tick' />
    <line x1='243.800000' y1='460.000000' x2='243.800000' y2='455.000000' class='tick' />
    <line x1='432.600000' y1='460.000000' x2='432.600000' y2='455.000000' class='tick' />
    <line x1='621.400000' y1='460.000000' x2='621.400000' y2='455.000000' class='tick' />
    <line x1='810.200000' y1='460.000000' x2='810.200000' y2='455.000000' class='tick' />
    <line x1='999.000000' y1='460.000000' x2='999.000000' y2='455.000000' class='tick' />
    <line x1='55.000000' y1='460.000000' x2='999.000000' y2='460.000000' class='stroke' />
  </g>
  <g class='axis left'>
    <text x='45.000000' y='396.318750' style='text-anchor:end; dominant-baseline:middle;' class='label' >0</text>
    <text x='45.000000' y='291.106250' style='text-anchor:end; dominant-baseline:middle;' class='label' >1.0</text>
    <text x='45.000000' y='185.893750' style='text-anchor:end; dominant-baseline:middle;' class='label' >2.0</text>
    <text x='45.000000' y='80.681250' style='text-anchor:end; dominant-baseline:middle;' class='label' >3.0</text>
    <line x1='55.000000' y1='460.000000' x2='60.000000' y2='460.000000' class='tick' />
    <line x1='55.000000' y1='343.712500' x2='60.000000' y2='343.712500' class='tick' />
    <line x1='55.000000' y1='238.500000' x2='60.000000' y2='238.500000' class='tick' />
    <line x1='55.000000' y1='133.287500' x2='60.000000' y2='133.287500' class='tick' />
    <line x1='55.000000' y1='17.000000' x2='60.000000' y2='17.000000' class='tick' />
    <line x1='55.000000' y1='17.000000' x2='55.000000' y2='460.000000' class='stroke' />
  </g>
  <g class='bars horizontal'>
    <rect x='55.000000' y='39.000000' width='858.181818' height='24.750000' class='bar color1'></rect>
    <rect x='55.000000' y='69.250000' width='772.363636' height='24.750000' class='bar color2'></rect>
    <rect x='55.000000' y='143.500000' width='600.727273' height='24.750000' class='bar color1'></rect>
    <rect x='55.000000' y='173.750000' width='514.909091' height='24.750000' class='bar color2'></rect>
    <rect x='55.000000' y='204.000000' width='686.545455' height='24.750000' class='bar color3'></rect>
    <rect x='55.000000' y='248.000000' width='343.272727' height='24.750000' class='bar color1'></rect>
    <rect x='55.000000' y='278.250000' width='257.454545' height='24.750000' class='bar color2'></rect>
    <rect x='55.000000' y='308.500000' width='429.090909' height='24.750000' class='bar color3'></rect>
    <rect x='55.000000' y='352.500000' width='85.818182' height='24.750000' class='bar color1'></rect>
    <rect x='55.000000' y='382.750000' width='0.000000' height='24.750000' class='bar color2'></rect>
    <rect x='55.000000' y='413.000000' width='171.636364' height='24.750000' class='bar color3'></rect>
  </g>
</svg>
+185 −0

File added.

Preview size limit exceeded, changes collapsed.