// test_bevel.cpp - regression: stray horizontal line beside 1-row button labels // A 1-row PushButton drew its bevel's top and bottom edges onto the same // row, leaving "──── Label ────" lines beside the text (screenshot: the // "Apply Binding" button, top-panel launchers, file-manager toolbar). #include "../tttest.hpp" #include "../ttgui.hpp" using namespace ttgui; TEST_CASE("bevel: 1-row button has no edge lines beside its label", "[canvas][widget]"){ Config cfg=Config::defaults(); PushButton b("Apply Binding"); b.cfg=&cfg; b.bounds={0,0,24,1}; Canvas c(24,1); b.draw(c); CHECK(c.text().find("─")==std::string::npos); CHECK(c.text().find("│")==std::string::npos); CHECK(c.text().find("Apply Binding")!=std::string::npos); // pressed state still renders (flat + dim) without lines b.pressed=true; Canvas c2(24,1); b.draw(c2); CHECK(c2.text().find("─")==std::string::npos); // 1-row inset widgets share the primitive (EditBox, NumericStepper) EditBox ed; ed.cfg=&cfg; ed.setText("Alt+t"); ed.bounds={0,0,24,1}; Canvas c3(24,1); ed.draw(c3); CHECK(c3.text().find("─")==std::string::npos); CHECK(c3.text().find("Alt+t")!=std::string::npos); // normal multi-row button keeps its bevel PushButton big("OK"); big.cfg=&cfg; big.bounds={0,0,12,3}; Canvas c4(12,3); big.draw(c4); CHECK(c4.text().find("─")!=std::string::npos); // 1-column bevel is flat too Canvas c5(1,6); CellStyle s; c5.drawBevel({0,0,1,6},s); CHECK(c5.text().find("─")==std::string::npos); CHECK(c5.text().find("│")==std::string::npos); }