mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[ui-tests][clion] Create true Toolchain panel component
GitOrigin-RevId: ac3f1829d56648c616e542011dc5cd07c227bc37
This commit is contained in:
committed by
intellij-monorepo-bot
parent
a8642fabdf
commit
2bcb261ee9
+94
@@ -0,0 +1,94 @@
|
||||
package com.intellij.driver.sdk.ui.components.clion
|
||||
|
||||
sealed class Toolchain(val name: ToolchainNames)
|
||||
|
||||
class DefaultToolchain(
|
||||
val compiler: Compiler = Compiler.DEFAULT,
|
||||
val debugger: Debugger = Debugger.BUNDLED_GDB,
|
||||
val buildTool: Make = Make.DEFAULT,
|
||||
name: ToolchainNames = ToolchainNames.DEFAULT,
|
||||
) : Toolchain(name) {
|
||||
override fun toString(): String = "${compiler}_$debugger"
|
||||
}
|
||||
|
||||
class GCCToolchain(
|
||||
val compiler: Compiler = Compiler.GCC,
|
||||
val debugger: Debugger = Debugger.BUNDLED_GDB,
|
||||
val buildTool: Make = Make.DEFAULT,
|
||||
name: ToolchainNames = ToolchainNames.GCC,
|
||||
) : Toolchain(name) {
|
||||
override fun toString(): String = "${compiler}_$debugger"
|
||||
}
|
||||
|
||||
class CLangToolchain(
|
||||
val compiler: Compiler = Compiler.CLANG,
|
||||
val debugger: Debugger = Debugger.BUNDLED_LLDB,
|
||||
val buildTool: Make = Make.DEFAULT,
|
||||
name: ToolchainNames = ToolchainNames.CLang,
|
||||
) : Toolchain(name) {
|
||||
override fun toString(): String = "${compiler}_$debugger"
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
enum class Make {
|
||||
DEFAULT {
|
||||
override fun getMakePath(): String = ""
|
||||
};
|
||||
|
||||
abstract fun getMakePath(): String
|
||||
}
|
||||
|
||||
enum class Compiler {
|
||||
DEFAULT {
|
||||
override fun getCppCompilerPath(): String = ""
|
||||
override fun getCCompilerPath(): String = ""
|
||||
},
|
||||
|
||||
GCC {
|
||||
override fun getCppCompilerPath(): String = System.getenv("TOOLCHAINS_CPP_GNU") ?: ""
|
||||
override fun getCCompilerPath(): String = System.getenv("TOOLCHAINS_C_GNU") ?: ""
|
||||
},
|
||||
|
||||
CLANG {
|
||||
override fun getCppCompilerPath(): String = System.getenv("TOOLCHAINS_CPP_CLANG") ?: ""
|
||||
override fun getCCompilerPath(): String = System.getenv("TOOLCHAINS_C_CLANG") ?: ""
|
||||
};
|
||||
|
||||
abstract fun getCppCompilerPath(): String
|
||||
abstract fun getCCompilerPath(): String
|
||||
}
|
||||
|
||||
enum class Debugger {
|
||||
BUNDLED_GDB {
|
||||
override fun getDebuggerPath(): String = "Bundled GDB"
|
||||
},
|
||||
|
||||
BUNDLED_LLDB {
|
||||
override fun getDebuggerPath(): String = "Bundled LLDB"
|
||||
};
|
||||
|
||||
abstract fun getDebuggerPath(): String
|
||||
}
|
||||
|
||||
|
||||
enum class ToolchainNames {
|
||||
DEFAULT {
|
||||
override fun toString(): String = "Default"
|
||||
},
|
||||
GCC {
|
||||
override fun toString(): String = "GCC"
|
||||
},
|
||||
CLang {
|
||||
override fun toString(): String = "CLang"
|
||||
},
|
||||
SYSTEM {
|
||||
override fun toString(): String = "System"
|
||||
},
|
||||
REMOTE_HOST {
|
||||
override fun toString(): String = "Remote Host"
|
||||
},
|
||||
DOCKER {
|
||||
override fun toString(): String = "Docker"
|
||||
}
|
||||
}
|
||||
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
package com.intellij.driver.sdk.ui.components.clion
|
||||
|
||||
import com.intellij.driver.sdk.ui.Finder
|
||||
import com.intellij.driver.sdk.ui.components.ComponentData
|
||||
import com.intellij.driver.sdk.ui.components.elements.*
|
||||
import com.intellij.driver.sdk.ui.components.settings.SettingsDialogUiComponent
|
||||
import com.intellij.driver.sdk.ui.ui
|
||||
import com.intellij.driver.sdk.ui.xQuery
|
||||
import java.awt.event.KeyEvent
|
||||
|
||||
fun Finder.toolchainPanel(action: ToolchainPanel.() -> Unit = {}) = x(ToolchainPanel::class.java) { byClass("DialogRootPane") }.apply(action)
|
||||
|
||||
class ToolchainPanel(data: ComponentData) : SettingsDialogUiComponent(data) {
|
||||
fun addNewToolchain(toolchain: Toolchain) {
|
||||
if (toolchain.name == ToolchainNames.DEFAULT) {
|
||||
jBlist(xQuery { byClass("JBList") }).clickItem(toolchain.name.toString())
|
||||
}
|
||||
else {
|
||||
actionButtonByXpath(xQuery { byAttribute("myicon", "add.svg") }).click()
|
||||
popupMenu().select(toolchain.toString())
|
||||
while (!jBlist(xQuery { byClass("JBList") }).items.first().contains("$toolchain (default)")) {
|
||||
moveToolchainUp()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun moveToolchainUp() {
|
||||
actionButtonByXpath(xQuery { byTooltip("Up") }).click()
|
||||
}
|
||||
|
||||
fun moveToolchainDown() {
|
||||
actionButtonByXpath(xQuery { byTooltip("Down") }).click()
|
||||
}
|
||||
|
||||
fun setupToolchains(toolchain: Toolchain) {
|
||||
when (toolchain) {
|
||||
is DefaultToolchain -> {
|
||||
if (toolchain.buildTool != Make.DEFAULT) {
|
||||
writeTextField("Build Tool:", toolchain.buildTool.getMakePath())
|
||||
}
|
||||
writeTextField("C Compiler:", toolchain.compiler.getCCompilerPath())
|
||||
writeTextField("C++ Compiler:", toolchain.compiler.getCppCompilerPath())
|
||||
}
|
||||
is CLangToolchain -> {
|
||||
if (toolchain.buildTool != Make.DEFAULT) {
|
||||
writeTextField("Build Tool:", toolchain.buildTool.getMakePath())
|
||||
}
|
||||
writeTextField("C Compiler:", toolchain.compiler.getCCompilerPath())
|
||||
writeTextField("C++ Compiler:", toolchain.compiler.getCppCompilerPath())
|
||||
setDebugger(toolchain.debugger.getDebuggerPath())
|
||||
}
|
||||
is GCCToolchain -> {
|
||||
if (toolchain.buildTool != Make.DEFAULT) {
|
||||
writeTextField("Build Tool:", toolchain.buildTool.getMakePath())
|
||||
}
|
||||
writeTextField("C Compiler:", toolchain.compiler.getCCompilerPath())
|
||||
writeTextField("C++ Compiler:", toolchain.compiler.getCppCompilerPath())
|
||||
setDebugger(toolchain.debugger.getDebuggerPath())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setDebugger(debugger: String) {
|
||||
textField(xQuery { and(byAccessibleName("Debugger:"), byClass("ExtendableTextField")) }).click()
|
||||
keyboard { key(KeyEvent.VK_DOWN) }
|
||||
driver.ui.popup("//div[@class='CustomComboPopup']").waitFound().list().clickItem(debugger)
|
||||
}
|
||||
|
||||
private fun writeTextField(accessibleName: String, text: String) {
|
||||
textField(xQuery { and(byAccessibleName(accessibleName), byClass("ExtendableTextField")) }).text = text
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user