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
26 package test.javafx.scene.control;
27
28 import javafx.beans.property.BooleanProperty;
29 import javafx.beans.property.DoubleProperty;
30 import javafx.beans.property.SimpleBooleanProperty;
31 import javafx.beans.property.SimpleDoubleProperty;
32 import javafx.beans.property.SimpleStringProperty;
33 import javafx.beans.property.StringProperty;
34 import javafx.scene.Scene;
35 import javafx.scene.control.TextArea;
36 import javafx.scene.control.TextInputControlShim;
37 import org.junit.Before;
38 import org.junit.Ignore;
39 import org.junit.Test;
40
41 import static test.com.sun.javafx.scene.control.infrastructure.ControlTestUtils.*;
42 import static org.junit.Assert.*;
43
44 /**
45 *
46 * @author srikalyc
47 */
48 public class TextAreaTest {
49 private TextArea txtArea;//Empty string
50 private TextArea dummyTxtArea;//With string value
51
52 @Before public void setup() {
53 txtArea = new TextArea();
54 dummyTxtArea = new TextArea("dummy");
55 }
73 @Test public void checkContentNotNull() {
74 assertNotNull(TextInputControlShim.getContent(txtArea));
75 }
76
77 @Test public void checkDefPromptTextEmptyString() {
78 assertEquals("", txtArea.getPromptText());
79 }
80
81 /*********************************************************************
82 * Tests for default values *
83 ********************************************************************/
84 @Test public void checkDefaultColCount() {
85 assertEquals(TextArea.DEFAULT_PREF_COLUMN_COUNT, 40);
86 }
87
88 @Test public void checkDefaultRowCount() {
89 assertEquals(TextArea.DEFAULT_PREF_ROW_COUNT, 10);
90 }
91
92 @Test public void checkDefaultParagraphCapacity() {
93 assertEquals(TextArea.DEFAULT_PARAGRAPH_CAPACITY, 32);
94 }
95
96 @Test public void checkDefaultWrapText() {
97 assertFalse(txtArea.isWrapText());
98 }
99
100 @Test public void defaultConstructorShouldSetStyleClassTo_textarea() {
101 assertStyleClassContains(txtArea, "text-area");
102 }
103
104 @Test public void defaultParagraphListNotNull() {
105 assertNotNull(dummyTxtArea.getParagraphs());
106 }
107
108 @Test public void checkTextSameAsContent() {
109 assertEquals(dummyTxtArea.getText(), TextInputControlShim.getContent_get(dummyTxtArea, 0, dummyTxtArea.getLength()));
110 }
111
112 @Test public void checkPromptTextPropertyName() {
113 assertTrue(txtArea.promptTextProperty().getName().equals("promptText"));
|
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
26 package test.javafx.scene.control;
27
28 import javafx.beans.property.BooleanProperty;
29 import javafx.beans.property.DoubleProperty;
30 import javafx.beans.property.SimpleBooleanProperty;
31 import javafx.beans.property.SimpleDoubleProperty;
32 import javafx.beans.property.SimpleStringProperty;
33 import javafx.beans.property.StringProperty;
34 import javafx.scene.Scene;
35 import javafx.scene.control.TextArea;
36 import javafx.scene.control.TextAreaShim;
37 import javafx.scene.control.TextInputControlShim;
38 import org.junit.Before;
39 import org.junit.Ignore;
40 import org.junit.Test;
41
42 import static test.com.sun.javafx.scene.control.infrastructure.ControlTestUtils.*;
43 import static org.junit.Assert.*;
44
45 /**
46 *
47 * @author srikalyc
48 */
49 public class TextAreaTest {
50 private TextArea txtArea;//Empty string
51 private TextArea dummyTxtArea;//With string value
52
53 @Before public void setup() {
54 txtArea = new TextArea();
55 dummyTxtArea = new TextArea("dummy");
56 }
74 @Test public void checkContentNotNull() {
75 assertNotNull(TextInputControlShim.getContent(txtArea));
76 }
77
78 @Test public void checkDefPromptTextEmptyString() {
79 assertEquals("", txtArea.getPromptText());
80 }
81
82 /*********************************************************************
83 * Tests for default values *
84 ********************************************************************/
85 @Test public void checkDefaultColCount() {
86 assertEquals(TextArea.DEFAULT_PREF_COLUMN_COUNT, 40);
87 }
88
89 @Test public void checkDefaultRowCount() {
90 assertEquals(TextArea.DEFAULT_PREF_ROW_COUNT, 10);
91 }
92
93 @Test public void checkDefaultParagraphCapacity() {
94 assertEquals(TextAreaShim.getDefaultParagraphCapacity(txtArea), 32);
95 }
96
97 @Test public void checkDefaultWrapText() {
98 assertFalse(txtArea.isWrapText());
99 }
100
101 @Test public void defaultConstructorShouldSetStyleClassTo_textarea() {
102 assertStyleClassContains(txtArea, "text-area");
103 }
104
105 @Test public void defaultParagraphListNotNull() {
106 assertNotNull(dummyTxtArea.getParagraphs());
107 }
108
109 @Test public void checkTextSameAsContent() {
110 assertEquals(dummyTxtArea.getText(), TextInputControlShim.getContent_get(dummyTxtArea, 0, dummyTxtArea.getLength()));
111 }
112
113 @Test public void checkPromptTextPropertyName() {
114 assertTrue(txtArea.promptTextProperty().getName().equals("promptText"));
|