0
グループ内に3つのラジオボタンを追加し、ブラウザからページをロードすると正常に動作します。gwt Javaテストのイベントがチェックボックスの値を変更しない
Javaコード:
@UiHandler({
"RadioButton1",
"RadioButton2",
"RadioButton3"
})
void radioButtonClickHandler(ClickEvent event){
if(RadioButton1.getValue()){
// do something
} else if(RadioButton2.getValue()) {
// do something
} else if (RadioButton3.getValue()){
// do something
}
}
私は、この機能のためのテストケースを記述しようとしています。
public void TestRadio1ClickEvent(){
// all values set
// Value of Radiobutton2 set to true
view.RadioButton1.fireEvent(new ClickEvent() {});
assertTrue(view.RadioButton1.getValue());
assertFalse(view.RadioButton2.getValue());
assertFalse(view.RadioButton3.getValue());
}
クリックイベントを発生させると、ラジオボタンの値は変更されません。 RadioButton1の値はfalseのままで、RadioButton2はtrueのままです。
クリックハンドラで値を手動で設定することはできますが、そのようにしたくありません。発砲とは違うボタンのクリックはどうですか?クリックしてラジオボタンの値を変更し、クリックハンドラを呼び出しますか?