zircon
zircon copied to clipboard
The Screen implementation violates the Liskov Substitution Principle
If a Screen
instance is passed to a View
's constructor it won't be displayed correctly because the underlying Screen
implementation doesn't handle delegation to its underlying TileGrid
properly. The display will be garbled.
I've noticed that we're creating a new Screen for the TileGrid in BaseView:
final override val screen = Screen.create(tileGrid)
Testing for the type of TileGrid passed to the View fixes the bug:
final override val screen =
if (tileGrid is Screen) {
tileGrid
} else {
Screen.create(tileGrid)
}
but I'm not sure if I'm not simply masking an underlying problem in the Screen implementation
I think this is masking, because outside of these View
s the problem still persists. I'm not sure that there is a simple solution for this problem unfortunately. 😢