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