gpt4 book ai didi

python - 等待在挤压中设置对象属性

转载 作者:行者123 更新时间:2023-11-30 22:20:50 24 4
gpt4 key购买 nike

我正在使用 Squish 6.3 Qt。我正在测试的应用程序包含一个内容动态变化的QLabel。是否可以等待标签设置为特定值?我无法使用 waitForObject,因为该对象始终存在,只有其文本值不断变化。

最佳答案

此示例来自Example - Testing or waiting for an expected property value :

def main():
# Register squish_dir/examples/qt/addressbook
# for this example code:
startApplication("addressbook")

# This will fail, unless you create a new
# address book and add a single entry to it,
# but it demonstrates how to use this
# function:
if not waitForPropertyValue("{type='QTableWidget' visible='1'}", "rowCount", 1, 20000):
test.fail("Property did not have the expected value")
else:
test.passes("Property had the expected value")


def waitForPropertyValue(objectName, propertyName, expectedValue, timeoutInMilliseconds):
"""Waits for property value of an already existing object"""

condition = "findObject(objectName)." + propertyName + " == expectedValue";
return waitFor(condition, timeoutInMilliseconds));

关于python - 等待在挤压中设置对象属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48766455/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com