1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 package testcase.gui.sc.validity;
23 
24 import static org.junit.Assert.*;
25 import static testlib.gui.AppUtil.*;
26 import static testlib.gui.UIMap.*;
27 
28 import java.io.File;
29 
30 import org.junit.After;
31 import org.junit.Before;
32 import org.junit.Ignore;
33 import org.junit.Rule;
34 import org.junit.Test;
35 import org.openoffice.test.common.Logger;
36 import org.openoffice.test.vcl.IDList;
37 import org.openoffice.test.vcl.widgets.VclMessageBox;
38 
39 import testlib.gui.CalcUtil;
40 
41 public class ValidityDialogSetting {
42 	private static IDList idList = new IDList(new File("./ids"));
43 	public static final VclMessageBox ActiveMsgBox = new VclMessageBox(idList.getId("UID_ACTIVE"), "Message on message box.");
44 
45 	@Rule
46 	public Logger log = Logger.getLogger(this);
47 
48 	@Before
49 	public void setUp() throws Exception {
50 		app.start(true);
51 
52 		// New a spreadsheet, select cell range, open Validity dialog
53 		app.dispatch("private:factory/scalc");
54 		calc.waitForExistence(10, 2);
55 		CalcUtil.selectRange("A1:C5");
56 		app.dispatch(".uno:Validation");
57 	}
58 
59 	@After
60 	public void tearDown() throws Exception {
61 
62 	}
63 
64 	/**
65 	 * test Allow not between Date type in Validity.
66 	 */
67 	@Test
68 	public void testAllowDateNotBetween() {
69 		SC_ValidityCriteriaTabpage.select();
70 		SC_ValidityCriteriaAllowList.select(3); // "Date"
71 		SC_ValidityDecimalCompareOperator.select(7); // "not between"
72 		SC_ValiditySourceInput.setText("01/01/08");
73 		SC_ValidityMaxValueInput.setText("03/01/08");
74 		SC_ValidityErrorAlertTabPage.select();
75 		SC_ValidityShowErrorMessage.check();
76 		SC_ValidityErrorMessageTitle.setText("Stop to enter");
77 		SC_ValidityErrorMessage.setText("Invalid value");
78 		SC_ValidityErrorAlertTabPage.ok();
79 
80 		CalcUtil.selectRange("A1");
81 		SC_InputBar_Input.activate();
82 		typeKeys("12/31/07");
83 		typeKeys("<enter>");
84 		assertEquals("12/31/07", CalcUtil.getCellText("A1"));
85 
86 		CalcUtil.selectRange("A2");
87 		SC_InputBar_Input.activate();
88 		typeKeys("03/02/08");
89 		typeKeys("<enter>");
90 		assertEquals("03/02/08", CalcUtil.getCellText("A2"));
91 
92 		CalcUtil.selectRange("A3");
93 		SC_InputBar_Input.activate();
94 		typeKeys("01/01/08");
95 		typeKeys("<enter>");
96 		assertEquals("Invalid value", ActiveMsgBox.getMessage());
97 		ActiveMsgBox.ok();
98 		assertEquals("", CalcUtil.getCellText("A3"));
99 
100 		CalcUtil.selectRange("A4");
101 		SC_InputBar_Input.activate();
102 		typeKeys("03/01/08");
103 		typeKeys("<enter>");
104 		assertEquals("Invalid value", ActiveMsgBox.getMessage());
105 		ActiveMsgBox.ok();
106 		assertEquals("", CalcUtil.getCellText("A4"));
107 
108 		CalcUtil.selectRange("A5");
109 		SC_InputBar_Input.activate();
110 		typeKeys("01/02/08");
111 		typeKeys("<enter>");
112 		assertEquals("Invalid value", ActiveMsgBox.getMessage());
113 		ActiveMsgBox.ok();
114 		assertEquals("", CalcUtil.getCellText("A5"));
115 
116 		CalcUtil.selectRange("B1");
117 		SC_InputBar_Input.activate();
118 		typeKeys("02/29/08");
119 		typeKeys("<enter>");
120 		assertEquals("Invalid value", ActiveMsgBox.getMessage());
121 		ActiveMsgBox.ok();
122 		assertEquals("", CalcUtil.getCellText("B1"));
123 
124 		CalcUtil.selectRange("B2");
125 		SC_InputBar_Input.activate();
126 		typeKeys("test");
127 		typeKeys("<enter>");
128 		assertEquals("Invalid value", ActiveMsgBox.getMessage());
129 		ActiveMsgBox.ok();
130 		assertEquals("", CalcUtil.getCellText("B2"));
131 
132 		CalcUtil.selectRange("B3");
133 		SC_InputBar_Input.activate();
134 		typeKeys("39448");
135 		typeKeys("<enter>");
136 		assertEquals("Invalid value", ActiveMsgBox.getMessage());
137 		ActiveMsgBox.ok();
138 		assertEquals("", CalcUtil.getCellText("B3"));
139 	}
140 
141 	/**
142 	 * test Allow Decimal equal in Validity.
143 	 */
144 	@Test
145 	public void testAllowDecimalEqual() {
146 
147 		SC_ValidityCriteriaTabpage.select();
148 		SC_ValidityCriteriaAllowList.select(2); // "Decimal"
149 		SC_ValidityDecimalCompareOperator.select(0); // "equal"
150 		SC_ValiditySourceInput.setText("0.33333333");
151 		SC_ValidityErrorAlertTabPage.select();
152 		SC_ValidityShowErrorMessage.check();
153 		SC_ValidityErrorMessageTitle.setText("Stop to enter");
154 		SC_ValidityErrorMessage.setText("Invalid value");
155 		SC_ValidityErrorAlertTabPage.ok();
156 
157 		CalcUtil.selectRange("A1");
158 		SC_InputBar_Input.activate();
159 		typeKeys("0.33333333");
160 		typeKeys("<enter>");
161 		assertEquals("0.33333333", CalcUtil.getCellText("A1"));
162 
163 		CalcUtil.selectRange("A2");
164 		SC_InputBar_Input.activate();
165 		typeKeys("=1/3");
166 		typeKeys("<enter>");
167 		assertEquals("Invalid value", ActiveMsgBox.getMessage());
168 		ActiveMsgBox.ok();
169 		assertEquals("", CalcUtil.getCellText("A2"));
170 
171 		CalcUtil.selectRange("A3");
172 		SC_InputBar_Input.activate();
173 		typeKeys("0.3");
174 		typeKeys("<enter>");
175 		assertEquals("Invalid value", ActiveMsgBox.getMessage());
176 		ActiveMsgBox.ok();
177 		assertEquals("", CalcUtil.getCellText("A3"));
178 
179 		CalcUtil.selectRange("A4");
180 		SC_InputBar_Input.activate();
181 		typeKeys("0.333333333");
182 		typeKeys("<enter>");
183 		assertEquals("Invalid value", ActiveMsgBox.getMessage());
184 		ActiveMsgBox.ok();
185 		assertEquals("", CalcUtil.getCellText("A4"));
186 
187 		CalcUtil.selectRange("B2");
188 		SC_InputBar_Input.activate();
189 		typeKeys("test");
190 		typeKeys("<enter>");
191 		assertEquals("Invalid value", ActiveMsgBox.getMessage());
192 		ActiveMsgBox.ok();
193 		assertEquals("", CalcUtil.getCellText("B2"));
194 	}
195 
196 	/**
197 	 * test Allow Text length, greater than or equal to in Validity.
198 	 */
199 	@Test
200 	public void testAllowGreaterTextLength() {
201 
202 		SC_ValidityCriteriaTabpage.select();
203 		SC_ValidityCriteriaAllowList.select(7); // "Text length"
204 		SC_ValidityDecimalCompareOperator.select(4); // "greater than or equal to"
205 		SC_ValiditySourceInput.setText("10");
206 		SC_ValidityErrorAlertTabPage.select();
207 		SC_ValidityShowErrorMessage.check();
208 		SC_ValidityErrorMessageTitle.setText("Stop to enter");
209 		SC_ValidityErrorMessage.setText("Invalid value");
210 		SC_ValidityErrorAlertTabPage.ok();
211 
212 		CalcUtil.selectRange("A1");
213 		SC_InputBar_Input.activate();
214 		typeKeys("testtesttesttest");
215 		typeKeys("<enter>");
216 		assertEquals("testtesttesttest", CalcUtil.getCellText("A1"));
217 
218 		CalcUtil.selectRange("A2");
219 		SC_InputBar_Input.activate();
220 		typeKeys("test test ");
221 		typeKeys("<enter>");
222 		assertEquals("test test ", CalcUtil.getCellText("A2"));
223 
224 		CalcUtil.selectRange("A4");
225 		SC_InputBar_Input.activate();
226 		typeKeys(" ");
227 		typeKeys("<enter>");
228 		assertEquals("Invalid value", ActiveMsgBox.getMessage());
229 		ActiveMsgBox.ok();
230 		assertEquals("", CalcUtil.getCellText("A4"));
231 
232 		CalcUtil.selectRange("A3");
233 		SC_InputBar_Input.activate();
234 		typeKeys("Testatest");
235 		typeKeys("<enter>");
236 		assertEquals("Invalid value", ActiveMsgBox.getMessage());
237 		ActiveMsgBox.ok();
238 		assertEquals("", CalcUtil.getCellText("A3"));
239 	}
240 
241 	/**
242 	 * test Allow Text length, less than in Validity.
243 	 */
244 	@Ignore("Bug 93128")
245 	public void testAllowLessThanTextLength() {
246 
247 		app.dispatch(".uno:Validation");
248 
249 		SC_ValidityCriteriaTabpage.select();
250 		SC_ValidityCriteriaAllowList.select(7); // "Text length"
251 		SC_ValidityDecimalCompareOperator.select(1); // "less than"
252 		SC_ValiditySourceInput.setText("10");
253 
254 		SC_ValidityInputHelpTabPage.select();
255 		SC_ValidityInputHelpCheckbox.check();
256 		SC_ValidityInputHelpTitle.setText("Help Info Title");
257 		SC_ValidityHelpMessage.setText("help info");
258 
259 		SC_ValidityErrorAlertTabPage.select();
260 		SC_ValidityShowErrorMessage.check();
261 		SC_ValidityErrorAlertActionList.select("Information");
262 		SC_ValidityErrorMessageTitle.setText("Notes to enter");
263 		SC_ValidityErrorMessage.setText("Invalid value");
264 		SC_ValidityErrorAlertTabPage.ok();
265 
266 		CalcUtil.selectRange("A1");
267 		SC_InputBar_Input.activate();
268 		typeKeys("testtesttesttest<enter>");
269 		ActiveMsgBox.ok();
270 		assertEquals("testtesttesttest", CalcUtil.getCellText("A1"));
271 
272 		CalcUtil.selectRange("A2");
273 		SC_InputBar_Input.activate();
274 		typeKeys("sfsafsddddddd<enter>");
275 		ActiveMsgBox.cancel();
276 		assertEquals("", CalcUtil.getCellText("A2"));
277 
278 		CalcUtil.selectRange("A2");
279 		SC_InputBar_Input.activate();
280 		typeKeys("10<enter>");
281 		assertEquals("10", CalcUtil.getCellText("A2"));
282 
283 		CalcUtil.selectRange("A3");
284 		SC_InputBar_Input.activate();
285 		typeKeys("ok<enter>");
286 		assertEquals("ok", CalcUtil.getCellText("A3"));
287 	}
288 
289 	/**
290 	 * test Allow list.
291 	 */
292 	@Test
293 	public void testAllowListSpecialChar() {
294 
295 		SC_ValidityCriteriaTabpage.select();
296 		SC_ValidityCriteriaAllowList.select(6); // "List"
297 		SC_ValidityEntries.focus();
298 		typeKeys("a");
299 		typeKeys("<enter>");
300 		typeKeys("b");
301 		SC_ValidityErrorAlertTabPage.select();
302 		SC_ValidityShowErrorMessage.check();
303 		SC_ValidityErrorMessageTitle.setText("Stop to enter");
304 		SC_ValidityErrorMessage.setText("Invalid value");
305 		SC_ValidityCriteriaTabpage.select();
306 		SC_ValidityCriteriaTabpage.ok();
307 
308 		// These codes are not stable: start
309 		// calc.rightClick(1, 1);
310 		// typeKeys("<shift s>");
311 		// typeKeys("<down><enter>"); // Choose a
312 		// sleep(2); // if no sleep, error occur
313 		// These codes are not stable: end
314 		CalcUtil.selectRange("A1");
315 		SC_InputBar_Input.activate();
316 		typeKeys("a<enter>");
317 		assertEquals("a", CalcUtil.getCellText("A1"));
318 
319 		CalcUtil.selectRange("B2");
320 		SC_InputBar_Input.activate();
321 		typeKeys("test");
322 		typeKeys("<enter>");
323 		assertEquals("Invalid value", ActiveMsgBox.getMessage());
324 		ActiveMsgBox.ok();
325 		assertEquals("", CalcUtil.getCellText("B2"));
326 	}
327 
328 	/**
329 	 * test Allow time between in Validity.
330 	 */
331 	@Test
332 	public void testAllowTimeBetween() {
333 
334 		SC_ValidityCriteriaTabpage.select();
335 		SC_ValidityCriteriaAllowList.select(4); // "Time"
336 		SC_ValidityDecimalCompareOperator.select(6); // "between"
337 		SC_ValiditySourceInput.setText("27:00");
338 		SC_ValidityMaxValueInput.setText("21:00");
339 		SC_ValidityErrorAlertTabPage.select();
340 		SC_ValidityShowErrorMessage.check();
341 		SC_ValidityErrorMessageTitle.setText("Stop to enter");
342 		SC_ValidityErrorMessage.setText("Invalid value");
343 		SC_ValidityErrorAlertTabPage.ok();
344 
345 		CalcUtil.selectRange("A1");
346 		SC_InputBar_Input.activate();
347 		typeKeys("21:00");
348 		typeKeys("<enter>");
349 		assertEquals("09:00:00 PM", CalcUtil.getCellText("A1"));
350 
351 		CalcUtil.selectRange("A2");
352 		SC_InputBar_Input.activate();
353 		typeKeys("27:00");
354 		typeKeys("<enter>");
355 		assertEquals("27:00:00", CalcUtil.getCellText("A2"));
356 
357 		CalcUtil.selectRange("A3");
358 		SC_InputBar_Input.activate();
359 		typeKeys("1.125");
360 		typeKeys("<enter>");
361 		assertEquals("1.125", CalcUtil.getCellText("A3"));
362 
363 		CalcUtil.selectRange("A4");
364 		SC_InputBar_Input.activate();
365 		typeKeys("0.875");
366 		typeKeys("<enter>");
367 		assertEquals("0.875", CalcUtil.getCellText("A4"));
368 
369 		CalcUtil.selectRange("B1");
370 		SC_InputBar_Input.activate();
371 		typeKeys("03:00:01");
372 		typeKeys("<enter>");
373 		assertEquals("Invalid value", ActiveMsgBox.getMessage());
374 		ActiveMsgBox.ok();
375 		assertEquals("", CalcUtil.getCellText("B1"));
376 
377 		CalcUtil.selectRange("B2");
378 		SC_InputBar_Input.activate();
379 		typeKeys("20:59:59");
380 		typeKeys("<enter>");
381 		assertEquals("Invalid value", ActiveMsgBox.getMessage());
382 		ActiveMsgBox.ok();
383 		assertEquals("", CalcUtil.getCellText("B2"));
384 
385 		CalcUtil.selectRange("B3");
386 		SC_InputBar_Input.activate();
387 		typeKeys("1.126");
388 		typeKeys("<enter>");
389 		assertEquals("Invalid value", ActiveMsgBox.getMessage());
390 		ActiveMsgBox.ok();
391 		assertEquals("", CalcUtil.getCellText("B3"));
392 
393 		CalcUtil.selectRange("B4");
394 		SC_InputBar_Input.activate();
395 		typeKeys("0.874");
396 		typeKeys("<enter>");
397 		assertEquals("Invalid value", ActiveMsgBox.getMessage());
398 		ActiveMsgBox.ok();
399 		assertEquals("", CalcUtil.getCellText("B4"));
400 
401 		CalcUtil.selectRange("C1");
402 		SC_InputBar_Input.activate();
403 		typeKeys("test");
404 		typeKeys("<enter>");
405 		assertEquals("Invalid value", ActiveMsgBox.getMessage());
406 		ActiveMsgBox.ok();
407 		assertEquals("", CalcUtil.getCellText("C1"));
408 
409 		CalcUtil.selectRange("C2");
410 		SC_InputBar_Input.activate();
411 		typeKeys("24:00");
412 		typeKeys("<enter>");
413 		assertEquals("24:00:00", CalcUtil.getCellText("C2"));
414 
415 		CalcUtil.selectRange("C3");
416 		SC_InputBar_Input.activate();
417 		typeKeys("12:00");
418 		typeKeys("<enter>");
419 		assertEquals("Invalid value", ActiveMsgBox.getMessage());
420 		ActiveMsgBox.ok();
421 		assertEquals("", CalcUtil.getCellText("C3"));
422 	}
423 
424 	/**
425 	 * test Allow time Greater than and equal to in Validity.
426 	 */
427 	@Test
428 	public void testAllowTimeGreaterThan() {
429 
430 		SC_ValidityCriteriaTabpage.select();
431 		SC_ValidityCriteriaAllowList.select(4); // "Time"
432 		SC_ValidityDecimalCompareOperator.select(4); // "greater than or equal to"
433 		SC_ValiditySourceInput.setText("8:00");
434 
435 		SC_ValidityErrorAlertTabPage.select();
436 		SC_ValidityShowErrorMessage.check();
437 		SC_ValidityErrorAlertActionList.select(1); // "Warning"
438 
439 		SC_ValidityErrorMessageTitle.setText("warning to enter");
440 		SC_ValidityErrorMessage.setText("Invalid value");
441 		SC_ValidityErrorAlertTabPage.ok();
442 
443 		CalcUtil.selectRange("A1");
444 		SC_InputBar_Input.activate();
445 		typeKeys("7:30");
446 		typeKeys("<enter>");
447 		assertEquals("Invalid value", ActiveMsgBox.getMessage());
448 		ActiveMsgBox.ok();
449 		assertEquals("07:30:00 AM", CalcUtil.getCellText("A1"));
450 
451 		CalcUtil.selectRange("A2");
452 		SC_InputBar_Input.activate();
453 		typeKeys("6:00");
454 		typeKeys("<enter>");
455 		assertEquals("Invalid value", ActiveMsgBox.getMessage());
456 		ActiveMsgBox.cancel();
457 		assertEquals("", CalcUtil.getCellText("A2"));
458 
459 		CalcUtil.selectRange("A3");
460 		SC_InputBar_Input.activate();
461 		typeKeys("8:00");
462 		typeKeys("<enter>");
463 		assertEquals("08:00:00 AM", CalcUtil.getCellText("A3"));
464 	}
465 
466 	/**
467 	 * test Allow whole number, less than or equal to in Validity.
468 	 */
469 	@Test
470 	public void testAllowWholeNumLessThan() {
471 
472 		SC_ValidityCriteriaTabpage.select();
473 		SC_ValidityCriteriaAllowList.select(1); // "Whole Numbers"
474 		SC_ValidityDecimalCompareOperator.select(3); // "less than or equal"
475 		SC_ValiditySourceInput.setText("100");
476 		SC_ValidityErrorAlertTabPage.select();
477 		SC_ValidityShowErrorMessage.check();
478 		SC_ValidityErrorMessageTitle.setText("Stop to enter");
479 		SC_ValidityErrorMessage.setText("Invalid value");
480 		SC_ValidityErrorAlertTabPage.ok();
481 
482 		CalcUtil.selectRange("A1");
483 		SC_InputBar_Input.activate();
484 		typeKeys("99");
485 		typeKeys("<enter>");
486 		assertEquals("99", CalcUtil.getCellText("A1"));
487 
488 		CalcUtil.selectRange("A2");
489 		SC_InputBar_Input.activate();
490 		typeKeys("100");
491 		typeKeys("<enter>");
492 		assertEquals("100", CalcUtil.getCellText("A2"));
493 
494 		CalcUtil.selectRange("B1");
495 		SC_InputBar_Input.activate();
496 		typeKeys("101");
497 		typeKeys("<enter>");
498 		assertEquals("Invalid value", ActiveMsgBox.getMessage());
499 		ActiveMsgBox.ok();
500 		assertEquals("", CalcUtil.getCellText("B1"));
501 
502 		CalcUtil.selectRange("B2");
503 		SC_InputBar_Input.activate();
504 		typeKeys("45.5");
505 		typeKeys("<enter>");
506 		assertEquals("Invalid value", ActiveMsgBox.getMessage());
507 		ActiveMsgBox.ok();
508 		assertEquals("", CalcUtil.getCellText("B2"));
509 
510 		CalcUtil.selectRange("C1");
511 		SC_InputBar_Input.activate();
512 		typeKeys("test");
513 		typeKeys("<enter>");
514 		assertEquals("Invalid value", ActiveMsgBox.getMessage());
515 		ActiveMsgBox.ok();
516 		assertEquals("", CalcUtil.getCellText("C1"));
517 	}
518 
519 	/**
520 	 * test default message of Error Alert in Validity.
521 	 */
522 	@Test
523 	public void testDefaultErrorAlertMessage() {
524 
525 		SC_ValidityCriteriaTabpage.select();
526 		SC_ValidityCriteriaAllowList.select(2); // "Decimal"
527 		SC_ValidityDecimalCompareOperator.select(0); // "equal"
528 		SC_ValiditySourceInput.setText("1");
529 
530 		SC_ValidityErrorAlertTabPage.select();
531 		SC_ValidityShowErrorMessage.check();
532 		SC_ValidityErrorAlertActionList.select(0); // "Stop"
533 		SC_ValidityErrorAlertTabPage.ok();
534 
535 		CalcUtil.selectRange("A1");
536 		SC_InputBar_Input.activate();
537 		typeKeys("13");
538 		typeKeys("<enter>");
539 		assertEquals("OpenOffice.org Calc", ActiveMsgBox.getCaption());
540 		// assertEquals("Invalid value.",ActiveMsgBox.getMessage()); // Can not
541 		// verify in multi-language
542 		ActiveMsgBox.ok();
543 		assertEquals("", CalcUtil.getCellText("A1"));
544 	}
545 
546 	/**
547 	 * test uncheck Error Alert in Validity.
548 	 */
549 	@Test
550 	public void testUncheckErrorAlert() {
551 
552 		SC_ValidityCriteriaTabpage.select();
553 		SC_ValidityCriteriaAllowList.select(2); // "Decimal"
554 		SC_ValidityDecimalCompareOperator.select(0); // "equal"
555 		SC_ValiditySourceInput.setText("1");
556 
557 		SC_ValidityErrorAlertTabPage.select();
558 		SC_ValidityShowErrorMessage.uncheck();
559 		SC_ValidityErrorAlertActionList.select(0); // "Stop"
560 		SC_ValidityErrorAlertTabPage.ok();
561 
562 		CalcUtil.selectRange("A1");
563 		typeKeys("13");
564 		typeKeys("<enter>");
565 		assertEquals("13", CalcUtil.getCellText("A1"));
566 	}
567 
568 	/**
569 	 * test Cell range source picker in Validity. Input from Edit Box.
570 	 */
571 	@Test
572 	public void testValidityCellRangeSourcePicker() {
573 
574 		SC_ValidityCriteriaTabpage.select();
575 		SC_ValidityCriteriaAllowList.select(5); // "Cell range"
576 		SC_ValiditySourcePicker.click();
577 		assertEquals(false, SC_ValidityCriteriaAllowList.exists());
578 		SC_ValiditySourceInput.setText("$E$2:$G$5");
579 		SC_ValiditySourcePicker.click();
580 		assertEquals(true, SC_ValidityCriteriaAllowList.exists());
581 
582 		SC_ValidityErrorAlertTabPage.select();
583 		SC_ValidityShowErrorMessage.check();
584 		SC_ValidityErrorAlertActionList.select(0); // "Stop"
585 		SC_ValidityErrorMessageTitle.setText("Stop to enter");
586 		SC_ValidityErrorMessage.setText("Invalid value.");
587 		SC_ValidityErrorAlertTabPage.ok();
588 
589 		// calc.focus();
590 		CalcUtil.selectRange("E2");
591 		SC_InputBar_Input.activate();
592 		typeKeys("test");
593 		typeKeys("<enter>");
594 
595 		CalcUtil.selectRange("A1");
596 		SC_InputBar_Input.activate();
597 		typeKeys("test32");
598 		typeKeys("<enter>");
599 		assertEquals("Invalid value.", ActiveMsgBox.getMessage());
600 		ActiveMsgBox.ok();
601 		assertEquals("", CalcUtil.getCellText("A1"));
602 
603 		CalcUtil.selectRange("B1");
604 		SC_InputBar_Input.activate();
605 		typeKeys("test");
606 		typeKeys("<enter>");
607 		assertEquals("test", CalcUtil.getCellText("B1"));
608 	}
609 
610 	/**
611 	 * test Allow Blank cell Checkbox in Validity.
612 	 */
613 	@Test
614 	public void testAllowBlankCells() {
615 		SC_ValidityCriteriaTabpage.select();
616 		SC_ValidityCriteriaAllowList.select(5); // "Cell range"
617 		SC_ValiditySourceInput.setText("$E$1:$E$5");
618 		SC_ValidityAllowBlankCells.check();
619 		SC_ValidityCriteriaTabpage.ok();
620 
621 		CalcUtil.selectRange("E1");
622 		typeKeys("A<enter>A<enter>A<enter>A<enter>A<enter>");
623 
624 		CalcUtil.selectRange("A1");
625 		typeKeys("A<enter>");
626 		CalcUtil.selectRange("D1");
627 		SC_InputBar_Input.activate();
628 		typeKeys("<backspace><enter>");
629 		assertEquals("", CalcUtil.getCellText("D1"));
630 
631 		CalcUtil.selectRange("B1");
632 		app.dispatch(".uno:Validation");
633 		SC_ValidityCriteriaTabpage.select();
634 		SC_ValidityAllowBlankCells.uncheck();
635 		typeKeys("<enter>");
636 
637 		CalcUtil.selectRange("B1");
638 		SC_InputBar_Input.activate();
639 		typeKeys("<backspace><enter>");
640 		typeKeys("<enter>");
641 	}
642 }
643