JavaでSikuliX.close()
自動化スクリプトを作成していますが、メソッドの動作について混乱しています。Sikuli のApp
クラス内では、close メソッドは次のようになります。
/**
* tries to close the app defined by this App instance, waits max given seconds for the app to no longer be running
*
* @return this or null on failure
*/
public boolean close(int waitTime) {
if (!isRunning()) {
log("App.close: not running: %s", this);
return false;
}
if (_osUtil.close(this)) {
int timeTowait = maxWait;
if (waitTime > 0) {
timeTowait = waitTime;
}
while (isRunning(0) && timeTowait > 0) {
timeTowait--;
}
}
if (!isValid()) {
log("App.close: %s", this);
} else {
log("App.close: did not work: %s", this);
return true;
}
return false;
}
私にとって問題の部分はリターンです。私の理解では、ブール値を返すため、クローズが成功した場合は true になり、クローズが失敗した場合は false になります。ただし、このコードは逆です。このロジックの私の欠陥のある (?) 理解に基づいて、最初は次のようにコードを書きました。
if (myApp.close()) {
System.out.println("closed.");
isAppClosed = true;
} else {
System.out.println("NOT closed!");
isAppClosed = false;
}
アプリケーションが正常に閉じているため、これは私が望む結果とは反対の結果をもたらしていますが、「閉じられていません」が出力されているため、テストは失敗しています。
バグを見つけましたか、それとも何か不足していますか?
ありがとう。