13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 package org.netbeans.jemmy.operators; 26 27 import javax.swing.JFrame; 28 import javax.swing.JLabel; 29 import javax.swing.JToolTip; 30 31 import org.netbeans.jemmy.ComponentChooser; 32 import org.netbeans.jemmy.TimeoutExpiredException; 33 import org.testng.Assert; 34 import org.testng.annotations.AfterClass; 35 import org.testng.annotations.BeforeClass; 36 import org.testng.annotations.Test; 37 38 public class JToolTipOperatorTest { 39 40 41 private JFrame frame = null; 42 43 @BeforeClass 44 protected void setUp() throws Exception { 45 frame = new JFrame(); 46 frame.setSize(400,400); 47 frame.setLocationRelativeTo(null); 48 } 49 50 @AfterClass 51 protected void tearDown() throws Exception { 52 frame.setVisible(false); 53 frame.dispose(); 54 } 55 56 @Test 57 public void testToolTip() { 58 final String TOLLTIP_TEXT = "A simple Tooltip"; 59 final String LABEL_TEXT = "Roll over here to see a tooltip"; 60 JLabel label = new JLabel(LABEL_TEXT); 61 label.setToolTipText(TOLLTIP_TEXT); 62 label.setBounds(0, 0, 200, 200); 63 frame.add(label); 64 frame.setVisible(true); 65 JLabelOperator labelOperator = new JLabelOperator(label); 66 JToolTipOperator toolTipOperator = new JToolTipOperator( 67 labelOperator.showToolTip()); | 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 package org.netbeans.jemmy.operators; 26 27 import javax.swing.JFrame; 28 import javax.swing.JLabel; 29 import javax.swing.JToolTip; 30 31 import org.netbeans.jemmy.ComponentChooser; 32 import org.netbeans.jemmy.TimeoutExpiredException; 33 import org.netbeans.jemmy.Timeouts; 34 import org.testng.Assert; 35 import org.testng.annotations.AfterClass; 36 import org.testng.annotations.BeforeClass; 37 import org.testng.annotations.Test; 38 39 public class JToolTipOperatorTest { 40 41 42 private JFrame frame = null; 43 44 @BeforeClass 45 protected void setUp() throws Exception { 46 frame = new JFrame(); 47 frame.setSize(400,400); 48 frame.setLocationRelativeTo(null); 49 Timeouts timeouts = Operator.getEnvironmentOperator().getTimeouts(); 50 timeouts.setTimeout("JToolTipOperator.WaitToolTipTimeout", 5000); 51 } 52 53 @AfterClass 54 protected void tearDown() throws Exception { 55 frame.setVisible(false); 56 frame.dispose(); 57 } 58 59 @Test 60 public void testToolTip() { 61 final String TOLLTIP_TEXT = "A simple Tooltip"; 62 final String LABEL_TEXT = "Roll over here to see a tooltip"; 63 JLabel label = new JLabel(LABEL_TEXT); 64 label.setToolTipText(TOLLTIP_TEXT); 65 label.setBounds(0, 0, 200, 200); 66 frame.add(label); 67 frame.setVisible(true); 68 JLabelOperator labelOperator = new JLabelOperator(label); 69 JToolTipOperator toolTipOperator = new JToolTipOperator( 70 labelOperator.showToolTip()); |