【问题标题】:How to check if a window is open in Eclipse RCP, with RCPTT如何使用 RCPTT 在 Eclipse RCP 中检查窗口是否打开
【发布时间】:2018-06-19 00:06:46
【问题描述】:

我有一个在 RCPTT 中开发的 ECL 脚本,用于测试 RCP 应用程序。在测试期间,它会设置一些设置并保存。当测试按“OK”时,会打开一个信息窗口,通知用户此更改需要重新构建项目。

我的问题是这个窗口不会一直显示。如果在运行测试的工作区中,该窗口已经打开,并且设置了“记住我的决定”选项,则不会打开。

我想在我的测试中添加一个 if 来处理这两种情况。它应该是这样的:

if [/* what can i put here ?*/] {
    get-window Settings | get-button Yes | click
}

这样的条件怎么写?

我可以做类似if [get-window Settings | verify-true ]if [ not [get-window Settings | verify-error ] ] 的事情吗?

编辑:通过使用“记录 sn-p”工具,我得到了类似的结果:

with [get-window Settings] {
    get-property "isEnabled()" | equals true | verify-true
    get-property "isVisible()" | equals true | verify-true
}

在我的情况下,你使用哪个属性好?启用、可见或两者兼而有之?

【问题讨论】:

    标签: eclipse-rcp eclipse-rcptt


    【解决方案1】:

    在这种情况下使用 try-catch:

    try {
        get-window Settings | get-button Yes | click
    } -catch {
        // Verify that the window was missing (and not some other problem)
        verify-error -command {get-window Settings}
    }
    

    【讨论】:

    • 你是真正的MVP人!谢谢你这完美的作品已经预期
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-18
    • 1970-01-01
    • 1970-01-01
    • 2013-06-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多