TextWidget: allow numbers in setText and updateSize (#12310)

Closes #12318.
This commit is contained in:
zwim
2024-08-09 22:06:53 +02:00
committed by GitHub
parent 92de5821bb
commit dc3b638378

View File

@@ -178,8 +178,8 @@ function TextWidget:updateSize()
end
dbg:guard(TextWidget, "updateSize",
function(self)
assert(type(self.text) == "string",
"Wrong text type (expected string)")
assert(type(self.text) == "string" or type(self.text) == "number",
"Wrong self.text type (expected string or number)")
end)
function TextWidget:_measureWithXText()
@@ -324,8 +324,8 @@ function TextWidget:setText(text)
end
dbg:guard(TextWidget, "setText",
function(self, text)
assert(type(text) == "string",
"Wrong text type (expected string)")
assert(type(text) == "string" or type(text) == "number",
"Wrong text type (expected string or number)")
end)
function TextWidget:setMaxWidth(max_width)