Compare commits
1 Commits
184d98bcdd
...
a55cd950d0
Author | SHA1 | Date |
---|---|---|
Shadowfacts | a55cd950d0 |
|
@ -215,7 +215,7 @@ open class View {
|
|||
/**
|
||||
* Converts the given point in this view's coordinate system to the coordinate system of another view or the window.
|
||||
*
|
||||
* @param point The point to convert.
|
||||
* @param point The point to convert, in the coordinate system of this view.
|
||||
* @param to The view to convert to. If `null`, it will be converted to the window's coordinate system.
|
||||
* @return The point in the coordinate system of the [to] view.
|
||||
*/
|
||||
|
@ -247,7 +247,7 @@ open class View {
|
|||
/**
|
||||
* Converts the given rectangle in this view's coordinate system to the coordinate system of another view or the window.
|
||||
*
|
||||
* @param rect The rectangle to convert.
|
||||
* @param rect The rectangle to convert, in the coordinate system of this view.
|
||||
* @param to The view to convert to. If `null`, it will be converted to the window's coordinate system.
|
||||
* @return The rectangle in the coordinate system of the [to] view.
|
||||
*/
|
||||
|
|
|
@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test
|
|||
/**
|
||||
* @author shadowfacts
|
||||
*/
|
||||
class PointConversionTests {
|
||||
class CoordinateConversionTests {
|
||||
|
||||
lateinit var window: Window
|
||||
|
||||
|
@ -30,6 +30,7 @@ class PointConversionTests {
|
|||
|
||||
assertEquals(Point(25.0, 25.0), b.convert(Point(0.0, 0.0), to = a))
|
||||
assertEquals(Point(75.0, 75.0), b.convert(Point(50.0, 50.0), to = a))
|
||||
assertEquals(Rect(25.0, 25.0, 50.0, 50.0), b.convert(Rect(0.0, 0.0, 50.0, 50.0), to = a))
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -46,6 +47,7 @@ class PointConversionTests {
|
|||
|
||||
assertEquals(Point(-50.0, -50.0), a.convert(Point(0.0, 0.0), to = b))
|
||||
assertEquals(Point(100.0, 100.0), b.convert(Point(50.0, 50.0), to = a))
|
||||
assertEquals(Rect(50.0, 50.0, 50.0, 50.0), b.convert(Rect(0.0, 0.0, 50.0, 50.0), to = a))
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -68,6 +70,7 @@ class PointConversionTests {
|
|||
|
||||
assertEquals(Point(-100.0, 0.0), c.convert(Point(0.0, 0.0), to = b))
|
||||
assertEquals(Point(-50.0, 50.0), c.convert(Point(50.0, 50.0), to = d))
|
||||
assertEquals(Rect(100.0, 0.0, 50.0, 50.0), d.convert(Rect(0.0, 0.0, 50.0, 50.0), to = c))
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -81,6 +84,7 @@ class PointConversionTests {
|
|||
|
||||
assertEquals(Point(0.0, 0.0), a.convert(Point(100.0, 100.0), to = b))
|
||||
assertEquals(Point(200.0, 200.0), b.convert(Point(100.0, 100.0), to = a))
|
||||
assertEquals(Rect(100.0, 100.0, 100.0, 100.0), b.convert(Rect(0.0, 0.0, 100.0, 100.0), to = a))
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -100,6 +104,7 @@ class PointConversionTests {
|
|||
|
||||
assertEquals(Point(-50.0, -50.0), c.convert(Point(50.0, 50.0), to = d))
|
||||
assertEquals(Point(100.0, 100.0), d.convert(Point(0.0, 0.0), to = c))
|
||||
assertEquals(Rect(100.0, 100.0, 50.0, 50.0), d.convert(Rect(0.0, 0.0, 50.0, 50.0), to = c))
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue