You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by jo...@apache.org on 2020/05/26 15:12:24 UTC
[isis] 01/02: ISIS-2342 scale image / fix test
This is an automated email from the ASF dual-hosted git repository.
joergrade pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git
commit 9eb48fc35ad696fb9ff8a298242ae09b39a354df
Author: Jörg Rade <jo...@kuehne-nagel.com>
AuthorDate: Tue May 26 11:04:04 2020 +0200
ISIS-2342 scale image / fix test
---
.../org/apache/isis/client/kroviz/utils/ScalableVectorGraphic.kt | 8 ++++----
.../ScalableVectorGraphicTest.kt | 9 +++------
2 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/utils/ScalableVectorGraphic.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/utils/ScalableVectorGraphic.kt
index d14a968..61f1edc 100644
--- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/utils/ScalableVectorGraphic.kt
+++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/utils/ScalableVectorGraphic.kt
@@ -32,21 +32,21 @@ class ScalableVectorGraphic(val data: String) {
return document.rootElement!!
}
- private fun setHeight(height: Int) {
+ fun setHeight(height: Int) {
root().setAttribute("height", height.toString() + "px")
}
- private fun getHeight(): Int {
+ fun getHeight(): Int {
val raw = root().getAttribute("height") as String
val value = raw.replace("px", "")
return value.toInt()
}
- private fun setWidth(width: Int) {
+ fun setWidth(width: Int) {
root().setAttribute("width", width.toString() + "px")
}
- private fun getWidth(): Int {
+ fun getWidth(): Int {
val raw = root().getAttribute("width") as String
val value = raw.replace("px", "")
return value.toInt()
diff --git a/incubator/clients/kroviz/src/test/kotlin/org.apache.isis.client.kroviz.util/ScalableVectorGraphicTest.kt b/incubator/clients/kroviz/src/test/kotlin/org.apache.isis.client.kroviz.util/ScalableVectorGraphicTest.kt
index af4c455..fb1533c 100644
--- a/incubator/clients/kroviz/src/test/kotlin/org.apache.isis.client.kroviz.util/ScalableVectorGraphicTest.kt
+++ b/incubator/clients/kroviz/src/test/kotlin/org.apache.isis.client.kroviz.util/ScalableVectorGraphicTest.kt
@@ -15,8 +15,7 @@ class ScalableVectorGraphicTest {
val type = "image/svg+xml"
val p = DOMParser()
//when
- val doc = p.parseFromString(response, type)
- val svg = ScalableVectorGraphic(doc)
+ val svg = ScalableVectorGraphic(response)
svg.scaleDown()
// then
@@ -31,8 +30,7 @@ class ScalableVectorGraphicTest {
val type = "image/svg+xml"
val p = DOMParser()
//when
- val doc = p.parseFromString(response, type)
- val svg = ScalableVectorGraphic(doc)
+ val svg = ScalableVectorGraphic(response)
svg.scaleUp()
// then
@@ -47,8 +45,7 @@ class ScalableVectorGraphicTest {
val type = "image/svg+xml"
val p = DOMParser()
//when
- val doc = p.parseFromString(response, type)
- val svg = ScalableVectorGraphic(doc)
+ val svg = ScalableVectorGraphic(response)
svg.scaleUp(2.0)
//then