60 61 @Smoke 62 @Test(timeout = 300000)//RT-18852 63 public void scrollLeftPropertyTest() throws InterruptedException, Throwable { 64 Assert.assertEquals((new TextArea()).scrollLeftProperty().getValue(), 0, 0); 65 commonScrollLeftTopTest(Orientation.HORIZONTAL, TextControlTestBase.Properties.scrollleft, "ContentScrolledLeft"); 66 } 67 68 @Smoke 69 @Test(timeout = 300000)//RT-18852 70 public void scrollTopPropertyTest() throws InterruptedException, Throwable { 71 Assert.assertEquals((new TextArea()).scrollTopProperty().getValue(), 0, 0); 72 commonScrollLeftTopTest(Orientation.VERTICAL, TextControlTestBase.Properties.scrolltop, "ContentScrolledDown"); 73 } 74 75 private void commonScrollLeftTopTest(Orientation orientation, TextControlTestBase.Properties property, String screenShotName) throws InterruptedException, Throwable { 76 setSize(200, 200); 77 addText(); 78 //There are both scrollBars must exist 79 80 assertEquals(getScrollBarValue(findScrollBar(testedControl.as(Parent.class, Node.class), orientation, true)), 0, 0); 81 82 double[] values = {10, 0, 50, 0, 100}; 83 84 setPropertyBySlider(SettingType.BIDIRECTIONAL, property, 10); 85 double item = getScrollBarValue(findScrollBar(testedControl.as(Parent.class, Node.class), orientation, true)) / 10; 86 87 for (SettingType type : EnumSet.of(SettingType.BIDIRECTIONAL, SettingType.SETTER, SettingType.UNIDIRECTIONAL)) { 88 for (double value : values) { 89 setPropertyBySlider(type, property, value); 90 checkTextFieldValue(property, value); 91 assertEquals(getScrollBarValue(findScrollBar(testedControl.as(Parent.class, Node.class), orientation, true)), value * item, 0.1 * item); 92 } 93 } 94 95 checkScreenshot(screenShotName + "On" + values[values.length - 1] + "Pixels", testedControl); 96 throwScreenshotError(); 97 } 98 99 @Smoke 100 @Test(timeout = 300000)//RT-18856 101 public void prefColumnCountPropertyTest() throws InterruptedException { 102 assertEquals((new TextArea()).prefColumnCountProperty().getValue(), 12, 0); 103 prefColumnCountCommonTest(); 104 } 105 106 @Smoke 107 @Test(timeout = 300000)//RT-18856 108 public void prefRowCountPropertyTest() throws InterruptedException { 109 int[] values = {5, 1, 0, 7, 5}; 110 double currentHeightPerRow = (getHeightValue(testedControl) - 10) / 10; // +/-10 is according to the minimal width. 111 116 assertEquals(getHeightValue(testedControl), value * currentHeightPerRow + 10, 0.1 * currentHeightPerRow);//behavior 117 } 118 } 119 } 120 121 @Smoke 122 @Test(timeout = 300000) 123 public void wrapTextPropertyTest() throws InterruptedException { 124 setSize(70, 70); 125 126 String text = ""; 127 for (int i = 0; i < 15; i++) { 128 text += "text "; 129 } 130 131 setPropertyByTextField(SettingType.BIDIRECTIONAL, Properties.text, text); 132 133 for (SettingType type : EnumSet.of(SettingType.BIDIRECTIONAL, SettingType.SETTER, SettingType.UNIDIRECTIONAL)) { 134 setPropertyByToggleClick(type, Properties.wraptext);//true//bind 135 checkTextFieldText(Properties.wraptext, "true");//getter 136 Assert.assertFalse(findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, false) == null);//behavior 137 Assert.assertFalse(findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true) == null);//behavior 138 139 setPropertyByToggleClick(type, Properties.wraptext);//false//bind 140 checkTextFieldText(Properties.wraptext, "false");//getter 141 Assert.assertFalse(findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true) == null);//behavior 142 Assert.assertFalse(findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, false) == null);//behavior 143 } 144 } 145 146 /** 147 * Test checks, that if control is focused and text is selected, it is blue, 148 * but when focused is lost, selected text becomes grey. Checking done with 149 * screenshot. 150 * 151 * @throws Throwable 152 */ 153 @Test(timeout = 300000) 154 @Smoke 155 public void focusedPropertyTest() throws Throwable { 156 final String text = "some text"; 157 setPropertyByTextField(SettingType.BIDIRECTIONAL, Properties.text, text); 158 159 checkTextFieldText(Properties.focused, "false"); 160 161 testedControl.mouse().click(); 162 testedControl.keyboard().pushKey(KeyboardButtons.A, CTRL_DOWN_MASK_OS); | 60 61 @Smoke 62 @Test(timeout = 300000)//RT-18852 63 public void scrollLeftPropertyTest() throws InterruptedException, Throwable { 64 Assert.assertEquals((new TextArea()).scrollLeftProperty().getValue(), 0, 0); 65 commonScrollLeftTopTest(Orientation.HORIZONTAL, TextControlTestBase.Properties.scrollleft, "ContentScrolledLeft"); 66 } 67 68 @Smoke 69 @Test(timeout = 300000)//RT-18852 70 public void scrollTopPropertyTest() throws InterruptedException, Throwable { 71 Assert.assertEquals((new TextArea()).scrollTopProperty().getValue(), 0, 0); 72 commonScrollLeftTopTest(Orientation.VERTICAL, TextControlTestBase.Properties.scrolltop, "ContentScrolledDown"); 73 } 74 75 private void commonScrollLeftTopTest(Orientation orientation, TextControlTestBase.Properties property, String screenShotName) throws InterruptedException, Throwable { 76 setSize(200, 200); 77 addText(); 78 //There are both scrollBars must exist 79 80 assertEquals(getScrollBarValue(findScrollBar((Parent<Node>)testedControl.as(Parent.class, Node.class), orientation, true)), 0, 0); 81 82 double[] values = {10, 0, 50, 0, 100}; 83 84 setPropertyBySlider(SettingType.BIDIRECTIONAL, property, 10); 85 double item = getScrollBarValue(findScrollBar((Parent<Node>)testedControl.as(Parent.class, Node.class), orientation, true)) / 10; 86 87 for (SettingType type : EnumSet.of(SettingType.BIDIRECTIONAL, SettingType.SETTER, SettingType.UNIDIRECTIONAL)) { 88 for (double value : values) { 89 setPropertyBySlider(type, property, value); 90 checkTextFieldValue(property, value); 91 assertEquals(getScrollBarValue(findScrollBar((Parent<Node>)testedControl.as(Parent.class, Node.class), orientation, true)), value * item, 0.1 * item); 92 } 93 } 94 95 checkScreenshot(screenShotName + "On" + values[values.length - 1] + "Pixels", testedControl); 96 throwScreenshotError(); 97 } 98 99 @Smoke 100 @Test(timeout = 300000)//RT-18856 101 public void prefColumnCountPropertyTest() throws InterruptedException { 102 assertEquals((new TextArea()).prefColumnCountProperty().getValue(), 12, 0); 103 prefColumnCountCommonTest(); 104 } 105 106 @Smoke 107 @Test(timeout = 300000)//RT-18856 108 public void prefRowCountPropertyTest() throws InterruptedException { 109 int[] values = {5, 1, 0, 7, 5}; 110 double currentHeightPerRow = (getHeightValue(testedControl) - 10) / 10; // +/-10 is according to the minimal width. 111 116 assertEquals(getHeightValue(testedControl), value * currentHeightPerRow + 10, 0.1 * currentHeightPerRow);//behavior 117 } 118 } 119 } 120 121 @Smoke 122 @Test(timeout = 300000) 123 public void wrapTextPropertyTest() throws InterruptedException { 124 setSize(70, 70); 125 126 String text = ""; 127 for (int i = 0; i < 15; i++) { 128 text += "text "; 129 } 130 131 setPropertyByTextField(SettingType.BIDIRECTIONAL, Properties.text, text); 132 133 for (SettingType type : EnumSet.of(SettingType.BIDIRECTIONAL, SettingType.SETTER, SettingType.UNIDIRECTIONAL)) { 134 setPropertyByToggleClick(type, Properties.wraptext);//true//bind 135 checkTextFieldText(Properties.wraptext, "true");//getter 136 Assert.assertFalse(findScrollBar((Parent<Node>)testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, false) == null);//behavior 137 Assert.assertFalse(findScrollBar((Parent<Node>)testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true) == null);//behavior 138 139 setPropertyByToggleClick(type, Properties.wraptext);//false//bind 140 checkTextFieldText(Properties.wraptext, "false");//getter 141 Assert.assertFalse(findScrollBar((Parent<Node>)testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true) == null);//behavior 142 Assert.assertFalse(findScrollBar((Parent<Node>)testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, false) == null);//behavior 143 } 144 } 145 146 /** 147 * Test checks, that if control is focused and text is selected, it is blue, 148 * but when focused is lost, selected text becomes grey. Checking done with 149 * screenshot. 150 * 151 * @throws Throwable 152 */ 153 @Test(timeout = 300000) 154 @Smoke 155 public void focusedPropertyTest() throws Throwable { 156 final String text = "some text"; 157 setPropertyByTextField(SettingType.BIDIRECTIONAL, Properties.text, text); 158 159 checkTextFieldText(Properties.focused, "false"); 160 161 testedControl.mouse().click(); 162 testedControl.keyboard().pushKey(KeyboardButtons.A, CTRL_DOWN_MASK_OS); |