jf1 = new JFrame();
// Initialiser le device et le composant
initFirstDevice();
final MultiAttributSpectrumChart widget = new MultiAttributSpectrumChart.Builder(
attributeNameList).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];
Assert.assertTrue("visible data combo should contain "
+ attributeNameList.length + " elements",
visibleDataCbx.getItemCount() == attributeNameList.length);
Assert.assertTrue("hide data combo should be empty",
hideDataCbx.getItemCount() == 0);
for (int i = 0; i < attributeNameList.length; i++) {
Assert.assertTrue(
"visible data combo should contain attribute names",
visibleDataCbx.getItemAt(i).equals(attributeNameList[i]));
}
tth.enterText(visibleDataCbx, attributeNameList[1]);
tth.click(hideBtn);
Assert.assertTrue("visible data combo should contain "
+ (attributeNameList.length - 1) + " elements",
visibleDataCbx.getItemCount() == (attributeNameList.length - 1));
Assert.assertTrue("hide data combo should contain 1 element",
hideDataCbx.getItemCount() == 1);
Assert.assertTrue("hide data combo should contain "
+ attributeNameList[1],
hideDataCbx.getItemAt(0).equals(attributeNameList[1]));
tth.enterText(visibleDataCbx, attributeNameList[2]);
tth.click(hideBtn);
Assert.assertTrue("visible data combo should contain "
+ (attributeNameList.length - 2) + " elements",
visibleDataCbx.getItemCount() == (attributeNameList.length - 2));
Assert.assertTrue("hide data combo should contain 2 elements",
hideDataCbx.getItemCount() == 2);
Assert.assertTrue("hide data combo should contain "
+ attributeNameList[2],
hideDataCbx.getItemAt(1).equals(attributeNameList[2]));
tth.enterText(hideDataCbx, attributeNameList[1]);
tth.click(displayBtn);
Assert.assertTrue("hide data combo should contain 1 element",
hideDataCbx.getItemCount() == 1);
Assert.assertTrue("visible data combo should contain "
+ (attributeNameList.length - 1) + " elements",
visibleDataCbx.getItemCount() == (attributeNameList.length - 1));
Assert.assertTrue("hide data combo should contain "
+ attributeNameList[2],
hideDataCbx.getItemAt(0).equals(attributeNameList[2]));
widget.setVisible(false);
Assert.assertTrue("widget should not be visible", !hideBtn.isShowing());
// clean
widget.stop();
jf1.dispose();
}