Files
NeoTerm_System/app/src/test/java/io/neoterm/ConfigureFileTest.kt

73 lines
2.2 KiB
Kotlin
Raw Normal View History

2017-08-06 00:28:51 +08:00
package io.neoterm
import io.neoterm.component.color.NeoColorScheme
2017-12-13 23:39:40 +08:00
import io.neoterm.component.extrakey.NeoExtraKey
import io.neoterm.component.profile.ProfileComponent
import io.neoterm.frontend.component.ComponentManager
import io.neoterm.frontend.session.shell.ShellProfile
2017-08-06 00:28:51 +08:00
import org.junit.Test
2017-08-08 16:04:22 +08:00
import java.io.File
2017-08-06 00:28:51 +08:00
/**
* @author kiva
*/
class ConfigureFileTest {
2017-08-09 02:38:06 +08:00
@Test
fun colorConfigureTest() {
try {
2017-08-17 01:39:39 +08:00
TestInitializer.init()
} catch (ignore: Throwable) {
}
2017-08-09 02:50:36 +08:00
val color = NeoColorScheme()
if (color.loadConfigure(File("NeoLang/example/color-scheme.nl"))) {
println("colorName: ${color.colorName}")
println("colorVersion: ${color.colorVersion}")
println("background: ${color.backgroundColor}")
println("foreground: ${color.foregroundColor}")
println("color1: ${color.color[1]}")
println("color2: ${color.color[2]}")
2017-08-09 02:38:06 +08:00
}
}
@Test
fun extraKeyConfigureTest() {
2017-08-09 15:41:32 +08:00
try {
2017-08-17 01:39:39 +08:00
TestInitializer.init()
2017-08-09 15:41:32 +08:00
} catch (ignore: Throwable) {
}
2017-08-09 15:41:32 +08:00
val extraKey = NeoExtraKey()
if (extraKey.loadConfigure(File("app/src/main/assets/eks/vim.nl"))) {
2017-08-09 15:52:49 +08:00
println("programs: ${extraKey.programNames}")
println("version: ${extraKey.version}")
println("with-default: ${extraKey.withDefaultKeys}")
println("keys: ${extraKey.shortcutKeys}")
}
2017-08-06 00:28:51 +08:00
}
2017-08-08 16:04:22 +08:00
@Test
fun profileConfigureTest() {
try {
TestInitializer.init()
} catch (ignore: Throwable) {
}
ComponentManager.registerComponent(ProfileComponent::class.java)
val profileComp = ComponentManager.getComponent<ProfileComponent>()
profileComp.registerProfile(ShellProfile.PROFILE_META_NAME, ShellProfile::class.java)
val comp = ComponentManager.getComponent<ProfileComponent>()
val profile = comp.loadConfigure<ShellProfile>(File("NeoLang/example/profile.nl"))
2017-12-15 21:54:53 +08:00
return
}
2017-08-08 16:04:22 +08:00
@Test
fun configureFileTest() {
2017-08-09 02:38:06 +08:00
colorConfigureTest()
extraKeyConfigureTest()
profileConfigureTest()
2017-08-08 16:04:22 +08:00
}
2017-08-06 00:28:51 +08:00
}