Skip to content

Commit d07ab0a

Browse files
committed
Fix unit tests
1 parent d76378d commit d07ab0a

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

src/dataframe/old/types.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,11 @@ struct RowWrapper
2727

2828
class SeriesIndex
2929
{
30-
std::string_view name;
30+
std::string_view name{};
3131
std::optional<dataframe::aggregator_type> aggregator;
3232

3333
public:
3434
SeriesIndex() :
35-
name(""),
3635
aggregator(dataframe::aggregator_type::count)
3736
{}
3837
SeriesIndex(std::string const &str, const DataTable &table);

test/unit/chart/events.cpp

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,13 @@ break)",
254254

255255
struct chart_setup
256256
{
257-
std::vector<std::pair<Vizzu::Gen::ChannelId, const char *>>
258-
series;
257+
struct series_t
258+
{
259+
Vizzu::Gen::ChannelId channel;
260+
const char *name;
261+
const char *aggr{};
262+
};
263+
std::vector<series_t> series;
259264
std::function<void(Vizzu::Data::DataTable &)> testcase =
260265
testcase_1;
261266
bool is_emscripten{[]
@@ -276,8 +281,15 @@ struct chart_setup
276281
auto &table = chart.getTable();
277282
testcase(table);
278283
auto &channels = chart.getOptions().getChannels();
279-
for (auto &&[ch, name] : series)
284+
for (auto &&[ch, name, aggr] : series) {
280285
channels.at(ch).addSeries({name, std::ref(table)});
286+
if (aggr) {
287+
if (!channels.at(ch).measureId)
288+
channels.at(ch).measureId =
289+
channels.at(ch).dimensionIds.pop_back();
290+
channels.at(ch).measureId->setAggr(aggr);
291+
}
292+
}
281293
chart.setBoundRect(Geom::Rect(Geom::Point{}, {{640, 480}}));
282294
return chart;
283295
}
@@ -559,7 +571,7 @@ const static auto tests =
559571
| "53978116" |
560572
[](Vizzu::Chart &chart = chart_setup{{{color, "Dim3"},
561573
{x, "Dim5"},
562-
{y, "min(Meas1)"},
574+
{y, "Meas1", "min"},
563575
{y, "Dim3"}}})
564576
{
565577
auto &&events = get_events(chart);
@@ -574,8 +586,8 @@ const static auto tests =
574586

575587
| "aggregators step1" |
576588
[](Vizzu::Chart &chart = chart_setup{{{x, "Dim3"},
577-
{y, "min(Meas1)"},
578-
{label, "min(Meas1)"}}})
589+
{y, "Meas1", "min"},
590+
{label, "Meas1", "min"}}})
579591
{
580592
auto &&events = get_events(chart);
581593

0 commit comments

Comments
 (0)