-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CfW: add a test for Text Baseline #1314
Conversation
modifier = Modifier.alignByBaseline() | ||
.onGloballyPositioned { | ||
headingOnPositioned.trySend(it[FirstBaseline]) | ||
println("The heading alignment line is ${it[FirstBaseline]}\n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we keep this println
in test?
assertTrue(headingAlignment > 0) | ||
assertTrue(subtitleAlignment > 0) | ||
assertTrue(headingAlignment > subtitleAlignment) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two questions\suggestions here. First one (more of a suggestion than question) if we do believe that the actual tests would check for something being bigger than specific value, then we can introduce a specialised assertion - so that we'll immediately see which of three has failed and with was exactly value. Something like assertIsGreater
Second (more of a question rather a suggestion) - is it enough? I mean knowng that something is greater than zero? Can we check for a specific value, even with tolerance or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we check for a specific value, even with tolerance or something?
I noticed that the actual value on CI is a bit smaller than on my machine. And it's okay. The actual value depends on the screen resolution (and density too), I guess.
I think that pre-calculating the exact expected value is possible, but it would likely contain some hardcode anyway. And then if, for example, the default font changes, the expected value will need to be updated.
Given it's something device specific, I decided to simplify the check to avoid surprising test failures on some machines.
assertIsGreater
- ACK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤝
import kotlinx.browser.document | ||
import org.w3c.dom.HTMLCanvasElement | ||
|
||
internal interface OnCanvasTests { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A small doc won't harm - like this interfaces is supposed to be used in such and such cases. I mean, it can be obvious to you and to me but not necessarily for our coworkers, current of future )
a02d87a
to
6fb7e9d
Compare
The issue JetBrains/compose-multiplatform#4078 was fixed earlier. Probably in skiko: JetBrains/skiko#846