2 * Copyright 2000-2016 Vaadin Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 * use this file except in compliance with the License. You may obtain a copy of
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 * License for the specific language governing permissions and limitations under
16 package com.vaadin.tests.components.grid.basicfeatures.escalator;
18 import org.junit.Test;
20 import com.vaadin.tests.components.grid.basicfeatures.EscalatorBasicClientFeaturesTest;
21 import com.vaadin.tests.components.grid.basicfeatures.EscalatorUpdaterUi;
23 public class EscalatorUpdaterUiTest extends EscalatorBasicClientFeaturesTest {
25 protected Class<?> getUIClass() {
26 return EscalatorUpdaterUi.class;
30 public void testHeaderPaintOrderRowColRowCol() {
31 boolean addColumnFirst = false;
32 boolean removeColumnFirst = false;
33 testPaintOrder(HEADER_ROWS, addColumnFirst, removeColumnFirst);
37 public void testHeaderPaintOrderRowColColRow() {
38 boolean addColumnFirst = false;
39 boolean removeColumnFirst = true;
40 testPaintOrder(HEADER_ROWS, addColumnFirst, removeColumnFirst);
44 public void testHeaderPaintOrderColRowColRow() {
45 boolean addColumnFirst = true;
46 boolean removeColumnFirst = true;
47 testPaintOrder(HEADER_ROWS, addColumnFirst, removeColumnFirst);
51 public void testHeaderPaintOrderColRowRowCol() {
52 boolean addColumnFirst = true;
53 boolean removeColumnFirst = false;
54 testPaintOrder(HEADER_ROWS, addColumnFirst, removeColumnFirst);
58 public void testBodyPaintOrderRowColRowCol() {
59 boolean addColumnFirst = false;
60 boolean removeColumnFirst = false;
61 testPaintOrder(BODY_ROWS, addColumnFirst, removeColumnFirst);
65 public void testBodyPaintOrderRowColColRow() {
66 boolean addColumnFirst = false;
67 boolean removeColumnFirst = true;
68 testPaintOrder(BODY_ROWS, addColumnFirst, removeColumnFirst);
72 public void testBodyPaintOrderColRowColRow() {
73 boolean addColumnFirst = true;
74 boolean removeColumnFirst = true;
75 testPaintOrder(BODY_ROWS, addColumnFirst, removeColumnFirst);
79 public void testBodyPaintOrderColRowRowCol() {
80 boolean addColumnFirst = true;
81 boolean removeColumnFirst = false;
82 testPaintOrder(BODY_ROWS, addColumnFirst, removeColumnFirst);
86 public void testFooterPaintOrderRowColRowCol() {
87 boolean addColumnFirst = false;
88 boolean removeColumnFirst = false;
89 testPaintOrder(FOOTER_ROWS, addColumnFirst, removeColumnFirst);
93 public void testFooterPaintOrderRowColColRow() {
94 boolean addColumnFirst = false;
95 boolean removeColumnFirst = true;
96 testPaintOrder(FOOTER_ROWS, addColumnFirst, removeColumnFirst);
100 public void testFooterPaintOrderColRowColRow() {
101 boolean addColumnFirst = true;
102 boolean removeColumnFirst = true;
103 testPaintOrder(FOOTER_ROWS, addColumnFirst, removeColumnFirst);
107 public void testFooterPaintOrderColRowRowCol() {
108 boolean addColumnFirst = true;
109 boolean removeColumnFirst = false;
110 testPaintOrder(FOOTER_ROWS, addColumnFirst, removeColumnFirst);
113 private void testPaintOrder(String tableSection, boolean addColumnFirst,
114 boolean removeColumnFirst) {
117 if (addColumnFirst) {
118 selectMenuPath(COLUMNS_AND_ROWS, COLUMNS,
119 ADD_ONE_COLUMN_TO_BEGINNING);
120 selectMenuPath(COLUMNS_AND_ROWS, tableSection,
121 ADD_ONE_ROW_TO_BEGINNING);
123 selectMenuPath(COLUMNS_AND_ROWS, tableSection,
124 ADD_ONE_ROW_TO_BEGINNING);
125 selectMenuPath(COLUMNS_AND_ROWS, COLUMNS,
126 ADD_ONE_COLUMN_TO_BEGINNING);
129 assertLogContainsInOrder("preAttach: elementIsAttached == false",
130 "postAttach: elementIsAttached == true",
131 "update: elementIsAttached == true");
132 assertLogDoesNotContain("preDetach");
133 assertLogDoesNotContain("postDetach");
135 if (removeColumnFirst) {
136 selectMenuPath(COLUMNS_AND_ROWS, COLUMNS,
137 REMOVE_ONE_COLUMN_FROM_BEGINNING);
138 selectMenuPath(COLUMNS_AND_ROWS, tableSection,
139 REMOVE_ONE_ROW_FROM_BEGINNING);
141 selectMenuPath(COLUMNS_AND_ROWS, tableSection,
142 REMOVE_ONE_ROW_FROM_BEGINNING);
143 selectMenuPath(COLUMNS_AND_ROWS, COLUMNS,
144 REMOVE_ONE_COLUMN_FROM_BEGINNING);
147 assertLogContainsInOrder("preDetach: elementIsAttached == true",
148 "postDetach: elementIsAttached == false");