// Initialiser le device et le composant
initFirstDevice();
initSecondDevice();
final MultiAttributeDualSpectrumChart widget = new MultiAttributeDualSpectrumChart.Builder(
xAttributeNameList, yAttributeNameList)
.displayAttributeLabel(false).jframe(jf1).build();
Sleeper.SECONDS.sleep(2);
final JButton hideBtn = tth.findButtonByText(jf1, "Hide");
Assert.assertTrue("Hide button should be visible", hideBtn != null);
final JButton displayBtn = tth.findButtonByText(jf1, "Display");
Assert.assertTrue("Display button should be visible",
displayBtn != null);
final JButton freezeValuesBtn = tth.findButtonByText(jf1,
"Freeze Values");
Assert.assertTrue("Hide button should be visible",
freezeValuesBtn != null);
final JButton clearFreezesBtn = tth.findButtonByText(jf1,
"Clear Freezes");
Assert.assertTrue("Hide button should be visible",
clearFreezesBtn != null);
final Component[] cbxArray = new ComponentFinderSorter(JComboBox.class)
.findAndSort(jf1);
Assert.assertTrue("combos should be visible", cbxArray != null);
Assert.assertTrue("2 combos should be visible", cbxArray.length == 2);
final JComboBox visibleDataCbx = (JComboBox) cbxArray[0];
final JComboBox hideDataCbx = (JComboBox) cbxArray[1];
Sleeper.SECONDS.sleep(5);
Assert.assertTrue("visible data combo should contain "
+ yAttributeNameList.length + " elements",
visibleDataCbx.getItemCount() == yAttributeNameList.length);
Assert.assertTrue("hide data combo should be empty",
hideDataCbx.getItemCount() == 0);
for (int i = 0; i < yAttributeNameList.length; i++) {
Assert.assertTrue(
"visible data combo should contain attribute names",
visibleDataCbx.getItemAt(i).equals(yAttributeNameList[i]));
}
// tth.enterIndexForCombo(visibleDataCbx, 1);
tth.enterText(visibleDataCbx, yAttributeNameList[1]);
tth.click(hideBtn);
Sleeper.SECONDS.sleep(1);
Assert.assertTrue(
"visible data combo should contain "
+ (yAttributeNameList.length - 1) + " elements",
visibleDataCbx.getItemCount() == (yAttributeNameList.length - 1));
Assert.assertTrue("hide data combo should contain 1 element",
hideDataCbx.getItemCount() == 1);
Assert.assertTrue("hide data combo should contain "
+ yAttributeNameList[1],
hideDataCbx.getItemAt(0).equals(yAttributeNameList[1]));
tth.enterText(visibleDataCbx, yAttributeNameList[2]);
tth.click(hideBtn);
Assert.assertTrue(
"visible data combo should contain "
+ (yAttributeNameList.length - 2) + " elements",
visibleDataCbx.getItemCount() == (yAttributeNameList.length - 2));
Assert.assertTrue("hide data combo should contain 2 elements",
hideDataCbx.getItemCount() == 2);
Assert.assertTrue("hide data combo should contain "
+ yAttributeNameList[2],
hideDataCbx.getItemAt(1).equals(yAttributeNameList[2]));
tth.enterText(hideDataCbx, yAttributeNameList[1]);
tth.click(displayBtn);
Assert.assertTrue("hide data combo should contain 1 element",
hideDataCbx.getItemCount() == 1);
Assert.assertTrue(
"visible data combo should contain "
+ (yAttributeNameList.length - 1) + " elements",
visibleDataCbx.getItemCount() == (yAttributeNameList.length - 1));
Assert.assertTrue("hide data combo should contain "
+ yAttributeNameList[2],
hideDataCbx.getItemAt(0).equals(yAttributeNameList[2]));
widget.setVisible(false);
Assert.assertTrue("widget should not be visible", !hideBtn.isShowing());
// clean
widget.stop();
jf1.dispose();
}