assertj / assertj/assertj-swing

Unable to locate JOptionPane in AWT Hierarchy

オープン
#74 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
bug import from fest-swing Major
主要言語
Java
スター
121
フォーク
52
PR マージ指標
30日以内にマージされた PR はありません

説明

_Issue by **[Bobby](http://jira.codehaus.org/secure/ViewProfile.jspa?name=rbonslat)** from Wed, 11 Aug 2010 14:59:41 -0500_
_Originally opened as http://jira.codehaus.org/browse/FEST-380_

---

I am unable to find JOptionPane when testing a Java swing applet.

Here is the code that executes the swing component from the Swing applet:

int choose = JOptionPane.showOptionDialog(null, "Click Yes to confirm the commit",

"Click Yes to confirm the commit", JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, options,

options[0]);

// int choose = JOptionPane.showConfirmDialog(null,

// "Click Yes to confirm the commit.", "Click Yes to confirm the commit",

// JOptionPane.YES_NO_OPTION);

// if (choose == JOptionPane.YES_OPTION){

if (choose == YesOption)

{
da.commit();
// cbDraw.log("commit.");
}

Here is my FEST test code that tries to locate it:

JOptionPaneFixture option_pane = m_navigator.optionPane();

public JOptionPaneFixture optionPane()

{
return frame.optionPane();
}

/**

{@inheritDoc} _/

public JOptionPaneFixture optionPane() {
return optionPane(DEFAULT_DIALOG_LOOKUP_TIMEOUT);
}



/_\* {@inheritDoc}

*/

public JOptionPaneFixture optionPane(Timeout timeout)

{
TypeMatcher matcher = new TypeMatcher(JOptionPane.class, requireShowing());
String description = "option pane to be found using matcher " + matcher;
ComponentFoundCondition condition = new ComponentFoundCondition(description, robot.finder(), matcher);
pause(condition, timeout);
return new JOptionPaneFixture(robot, (JOptionPane)condition.found());
}

Here is the error I get:

Error (org.fest.swing.exception.WaitTimedOutError: Timed out waiting for option pane to be found using matcher org.fest.swing.core.TypeMatcher[type=javax.swing.JOptionPane, requireShowing=true])

NOTE 1: Strangely enough though it may seem, I am able to find a JOptionPane only when the Swing applet launches the component like the following unlike the one stated above:

JOptionPane.showMessageDialog((Component) cbDraw, "need to input a numerical value between high and low!");

Not sure if this is of any significance or not but it's worth mentioning.

NOTE 2: Also I'm not certain whether this issue has anything to do with owner less windows (parent less windows) or the AWT hierarchy state. I've also tried a GenericTypeMatcher search as well. The component does not even show up when dumping out the hierarchy in the logs. Please advise.

---

votes (original issue): 1
watches (original issue): 1

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

まず Swing アプレットのケースを再現し、JOptionPane.showOptionDialog と、動作している showMessageDialog 呼び出しを比較します。m_navigator.optionPane()、TypeMatcher の検索、および階層ダンプを調べ、オプションペインが見つからない理由を特定します。報告されたダイアログを確実に特定できるようになるか、その制限が焦点を絞った回帰テストとともに文書化されれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
desktop, testing
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。