fix(node): only round a box that has a border
A filled box without one is a plain rectangle: rounding it leaves the surface showing at the corners, which reads as a seam nobody asked for.
This commit is contained in:
@@ -145,7 +145,8 @@ int main() {
|
||||
"local root = node.create(nil, {type = 'box', w = 'fill', h = 'fill', pad = 4, gap = 2})\n"
|
||||
"local label = node.create(root, {type = 'text', label = 'Hello'})\n"
|
||||
"local button = node.create(root, {type = 'button', h = 40, interactive = true})\n"
|
||||
"node.setStyle(root, {background = 0xFFFFFF, fill = 0xFFFFFF, color = 0, face = 0xEEEEEE, focusColor = 0xFF0000})\n"
|
||||
"node.setStyle(root, {background = 0xFFFFFF, fill = 0xFFFFFF, color = 0, face = 0xEEEEEE,\n"
|
||||
" border = 0x333333, focusColor = 0xFF0000})\n"
|
||||
"assert(node.layout(root, 0, 0, 320, 240))\n"
|
||||
"local x, y, w, h = node.getRect(label)\n"
|
||||
"assert(x == 4 and y == 4 and w == 312 and h == 16)\n"
|
||||
@@ -161,6 +162,8 @@ int main() {
|
||||
"node.draw(root)\n"
|
||||
"node.dropScratch()");
|
||||
assert(bench.gui.trace.find("drawText(Hello);") != std::string::npos);
|
||||
// The bordered box rounds its corners; the button fills without one.
|
||||
assert(bench.gui.trace.find("roundRect(fill,border);") != std::string::npos);
|
||||
assert(bench.gui.trace.find("roundRect(fill,-);") != std::string::npos);
|
||||
expectError(state, "node.create(nil, {type = 'nope'})");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user