Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dkandalov committed Aug 10, 2017
1 parent cb97a79 commit 13590fe
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/ijkl/keymap-modifier.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ fun initCurrentKeymapModifier(
logger: Logger,
actionManager: ActionManager = ActionManager.getInstance()
) {
var shortcuts = IjklShortcuts(all = keymapInputStream.readShortcutsData())
var shortcuts = IjklShortcuts(keymapInputStream.readShortcutsData())

registerKeymapListener(application, object: KeymapChangeListener {
override fun onChange(oldKeymap: Keymap?, newKeymap: Keymap?) {
Expand Down
4 changes: 1 addition & 3 deletions src/ijkl/shortcut-reader.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ import java.io.InputStream
import javax.swing.KeyStroke
import javax.xml.parsers.DocumentBuilderFactory

fun InputStream.readShortcutsData(): List<ShortcutData> {
return use { readShortcutsDataFrom(this) }
}
fun InputStream.readShortcutsData(): List<ShortcutData> = use { readShortcutsDataFrom(this) }

private fun readShortcutsDataFrom(inputStream: InputStream): List<ShortcutData> {
fun Node.getAttribute(name: String): String? =
Expand Down
8 changes: 4 additions & 4 deletions test/ijkl/Tests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import java.util.regex.Pattern
class Tests {
@Test fun `win, linux keymap xml`() {
resourceInputStream("ijkl-keymap.xml").readShortcutsData().validate(
amountOfActions = 46,
amountOfShortcuts = 49
amountOfActions = 48,
amountOfShortcuts = 51
)
}

@Test fun `osx keymap xml`() {
resourceInputStream("ijkl-osx-keymap.xml").readShortcutsData().validate(
amountOfActions = 46,
amountOfShortcuts = 50
amountOfActions = 48,
amountOfShortcuts = 52
)
}

Expand Down

0 comments on commit 13590fe

Please sign in to comment.