You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
777 B
38 lines
777 B
#include <catch2/catch_test_macros.hpp>
|
|
#include <fmt/core.h>
|
|
#include "render.hpp"
|
|
#include "panel.hpp"
|
|
|
|
using namespace ftxui;
|
|
using namespace fmt;
|
|
using std::string;
|
|
|
|
void run_renderer(SFMLRender &renderer, Panel &panel) {
|
|
panel.render();
|
|
renderer.display();
|
|
REQUIRE(renderer.is_open() == true);
|
|
renderer.clear();
|
|
renderer.draw(panel);
|
|
}
|
|
|
|
TEST_CASE("can render a text or grid panel", "[render]") {
|
|
SFMLRender renderer;
|
|
|
|
Panel panel(0, 0, 20, 5);
|
|
Panel grid(200, 200, 20, 5, true);
|
|
|
|
auto text_box = Renderer([]{
|
|
return hbox({
|
|
hflow(
|
|
vbox(text("I AM TEXT"))
|
|
)});
|
|
});
|
|
|
|
panel.set_renderer(text_box);
|
|
grid.set_renderer(text_box);
|
|
|
|
run_renderer(renderer, panel);
|
|
run_renderer(renderer, grid);
|
|
|
|
renderer.close();
|
|
}
|
|
|