Skip to content

Commit

Permalink
test 6
Browse files Browse the repository at this point in the history
  • Loading branch information
amerharb committed Sep 27, 2023
1 parent 4aaf559 commit dac0da0
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions at-date-console/src/test/kotlin/com/amerharb/atdate/MainTest.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package com.amerharb.atdate

import java.awt.Toolkit
import java.awt.datatransfer.DataFlavor
import java.awt.datatransfer.StringSelection
import java.io.ByteArrayOutputStream
import java.io.InputStream
import java.io.PrintStream
Expand Down Expand Up @@ -291,7 +288,7 @@ class MainTest {

@Test
fun testCopyResult() {
clearClipboard()
// clearClipboard()
val systemInMock = InputStreamMock("0xa0\nc\nq")
System.setIn(systemInMock)
main(emptyArray())
Expand All @@ -314,17 +311,17 @@ class InputStreamMock(input: String) : InputStream() {
}
}

fun getClipboard(): String {
val clipboard = Toolkit.getDefaultToolkit().systemClipboard
return clipboard.getData(DataFlavor.stringFlavor) as String
}

fun clearClipboard() {
try {
val clipboard = Toolkit.getDefaultToolkit().systemClipboard
clipboard.setContents(StringSelection(""), null)
} catch (e: Exception) {
println("Error: ${e.message}")
System.err.println(e.message)
}
}
// fun getClipboard(): String {
// val clipboard = Toolkit.getDefaultToolkit().systemClipboard
// return clipboard.getData(DataFlavor.stringFlavor) as String
// }
//
// fun clearClipboard() {
// try {
// val clipboard = Toolkit.getDefaultToolkit().systemClipboard
// clipboard.setContents(StringSelection(""), null)
// } catch (e: Exception) {
// println("Error: ${e.message}")
// System.err.println(e.message)
// }
// }

0 comments on commit dac0da0

Please sign in to comment.