Skip to content

Commit

Permalink
use jfx for browser action
Browse files Browse the repository at this point in the history
  • Loading branch information
breandan committed Sep 22, 2019
1 parent 7d25df3 commit 9b452fe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
2 changes: 2 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ dependencies {
compile("org.bytedeco:tesseract-platform:1.5.1")
compile("org.bytedeco:leptonica-platform:1.5.1")
implementation("com.1stleg:jnativehook:2.1.0")
implementation("org.openjfx:javafx-swing:11")
implementation("org.openjfx:javafx:11")
}

repositories.mavenCentral()
Expand Down
12 changes: 4 additions & 8 deletions src/test/kotlin/TraceTest.kt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import javafx.application.Application
import javafx.event.EventHandler
import javafx.scene.Scene
Expand All @@ -19,10 +18,10 @@ import org.bytedeco.leptonica.global.lept.pixScale
import org.bytedeco.tesseract.ResultIterator
import org.bytedeco.tesseract.TessBaseAPI
import org.bytedeco.tesseract.global.tesseract.*
import org.junit.Ignore
import org.junit.Test
import java.awt.*
import java.net.URI
import java.awt.Rectangle
import java.awt.Robot
import java.awt.Toolkit
import java.net.URLEncoder
import kotlin.system.exitProcess
import kotlin.system.measureTimeMillis
Expand Down Expand Up @@ -58,10 +57,8 @@ class TraceTest : Application() {
val tg = results.firstOrNull { it.isPointInMap(e.x, e.y) }
if (tg != null)
try {
val desktop = Desktop.getDesktop()
val encodedQuery = URLEncoder.encode(tg.string, "UTF-8")
val oURL = URI("https://stackoverflow.com/search?q=$encodedQuery")
desktop.browse(oURL)
hostServices.showDocument("https://stackoverflow.com/search?q=$encodedQuery")
} catch (e: Exception) {
e.printStackTrace()
}
Expand Down Expand Up @@ -143,7 +140,6 @@ class TraceTest : Application() {
println("Cleanup time: ${System.currentTimeMillis() - start}")
}

@Ignore
@Test
fun traceTest() = launch()

Expand Down

0 comments on commit 9b452fe

Please sign in to comment.