Package fr.soleil.globalscreen.tangowidget.attribute

Examples of fr.soleil.globalscreen.tangowidget.attribute.MultiAttributSpectrumChart$Builder


        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();
    }
View Full Code Here


        // Initialiser le device et le composant
        initFirstDevice();
        final DeviceAttribute da = m_deviceProxy.read_attribute(attributeName);
        final double[] data = da.extractDoubleArray();

        final MultiAttributSpectrumChart widget = new MultiAttributSpectrumChart.Builder(
                attributeNameList).jframe(jf1).build();

        Sleeper.SECONDS.sleep(2);

        final JLChart chart = (JLChart) tth.findFirstComponent(JLChart.class, jf1);
        Assert.assertTrue("JLChart component not found", chart != null);

        final ITableListenerImpl listenerTest = new ITableListenerImpl();
        widget.addTableListener(listenerTest);

        tth.mouseClickOnComponent(chart);
        Sleeper.SECONDS.sleep(5);

        final int notifCount = listenerTest.getNotifyCount();
        Assert.assertTrue("listener has been notified " + notifCount + "instead of 6 times ",
                notifCount == 6);
        Assert.assertTrue(listenerTest.getNotification("selectedXChanged(int)") != null);
        Assert.assertTrue(listenerTest.getNotification("selectedXChanged(double)") != null);
        Assert.assertTrue(listenerTest.getNotification("selectedYChanged(int)") != null);
        Assert.assertTrue(listenerTest.getNotification("selectedYChanged(double)") != null);
        Assert.assertTrue(listenerTest.getNotification("selectedPointChanged") != null);

        // le clic est effectu� au milieu du composant
        final int xClick = data.length / 2;
        final double yClic = data[xClick];

        // Assert.assertTrue(listenerTest.getNotification("selectedXChanged(int)").equals(xClick));
        // Assert.assertTrue(listenerTest.getNotification("selectedXChanged(double)").equals((double)xClick));
        // Assert.assertTrue(listenerTest.getNotification("selectedYChanged(int)").equals((int)yClick));
        // Assert.assertTrue(listenerTest.getNotification("selectedYChanged(double)").equals(yClick));

        widget.removeTableListener(listenerTest);
        listenerTest.reset();

        tth.mouseClickOnComponent(chart);
        Sleeper.SECONDS.sleep(1);

        Assert.assertTrue("listener should not be notified", listenerTest.getNotifyCount() == 0);

        // clean
        widget.stop();
        jf1.dispose();
    }
View Full Code Here

    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();
  }
View Full Code Here

    // Initialiser le device et le composant
    initFirstDevice();
    final DeviceAttribute da = m_deviceProxy.read_attribute(attributeName);
    final double[] data = da.extractDoubleArray();

    final MultiAttributSpectrumChart widget = new MultiAttributSpectrumChart.Builder(
        attributeNameList).jframe(jf1).build();

    Sleeper.SECONDS.sleep(2);

    final JLChart chart = (JLChart) tth.findFirstComponent(JLChart.class,
        jf1);
    Assert.assertTrue("JLChart component not found", chart != null);

    final ITableListenerImpl listenerTest = new ITableListenerImpl();
    widget.addTableListener(listenerTest);

    tth.mouseClickOnComponent(chart);
    Sleeper.SECONDS.sleep(5);

    final int notifCount = listenerTest.getNotifyCount();
    Assert.assertTrue("listener has been notified " + notifCount
        + "instead of 6 times ", notifCount == 6);
    Assert.assertTrue(listenerTest.getNotification("selectedXChanged(int)") != null);
    Assert.assertTrue(listenerTest
        .getNotification("selectedXChanged(double)") != null);
    Assert.assertTrue(listenerTest.getNotification("selectedYChanged(int)") != null);
    Assert.assertTrue(listenerTest
        .getNotification("selectedYChanged(double)") != null);
    Assert.assertTrue(listenerTest.getNotification("selectedPointChanged") != null);

    // le clic est effectu� au milieu du composant
    final int xClick = data.length / 2;
    final double yClic = data[xClick];

    // Assert.assertTrue(listenerTest.getNotification("selectedXChanged(int)").equals(xClick));
    // Assert.assertTrue(listenerTest.getNotification("selectedXChanged(double)").equals((double)xClick));
    // Assert.assertTrue(listenerTest.getNotification("selectedYChanged(int)").equals((int)yClick));
    // Assert.assertTrue(listenerTest.getNotification("selectedYChanged(double)").equals(yClick));

    widget.removeTableListener(listenerTest);
    listenerTest.reset();

    tth.mouseClickOnComponent(chart);
    Sleeper.SECONDS.sleep(1);

    Assert.assertTrue("listener should not be notified",
        listenerTest.getNotifyCount() == 0);

    // clean
    widget.stop();
    jf1.dispose();
  }
View Full Code Here

TOP

Related Classes of fr.soleil.globalscreen.tangowidget.attribute.MultiAttributSpectrumChart$Builder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.