From 4267b40a68899539c09082b409382120c83dbab9 Mon Sep 17 00:00:00 2001 From: Arthur Sonzogni Date: Sat, 22 Jan 2022 11:44:52 +0100 Subject: [PATCH] Add collapsible into fuzzer. (#312) --- src/ftxui/component/component_fuzzer.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/ftxui/component/component_fuzzer.cpp b/src/ftxui/component/component_fuzzer.cpp index d8c73d9..acab31f 100644 --- a/src/ftxui/component/component_fuzzer.cpp +++ b/src/ftxui/component/component_fuzzer.cpp @@ -1,6 +1,5 @@ #include -//#include "ftxui/component/event.hpp" -//#include "ftxui/component/receiver.hpp" +#include #include #include "ftxui/component/component.hpp" #include "ftxui/component/terminal_input_parser.hpp" @@ -57,7 +56,11 @@ Component GeneratorComponent(const char*& data, size_t& size, int depth) { if (depth <= 0) return Button(GeneratorString(data, size), [] {}); - switch (value % 19) { + constexpr int value_max = 19; + value = (value % value_max + value_max) % value_max; + switch (value) { + case 0: + return Button(GeneratorString(data, size), [] {}); case 1: return Checkbox(GeneratorString(data, size), &g_bool); case 2: @@ -106,8 +109,12 @@ Component GeneratorComponent(const char*& data, size_t& size, int depth) { return Maybe(GeneratorComponent(data, size, depth - 1), &g_bool); case 17: return Dropdown(&g_list, &g_int); + case 18: + return Collapsible(GeneratorString(data, size), + GeneratorComponent(data, size, depth - 1), + GeneratorBool(data, size)); default: - return Button(GeneratorString(data, size), [] {}); + assert(false); } }