2
0
mirror of https://github.com/koreader/koreader synced 2024-11-10 01:10:34 +00:00

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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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)