2 * Copyright 2000-2014 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.server.component.abstractsplitpanel;
18 import org.junit.Test;
20 import com.vaadin.server.Sizeable.Unit;
21 import com.vaadin.tests.design.DeclarativeTestBase;
22 import com.vaadin.ui.AbstractSplitPanel;
23 import com.vaadin.ui.Button;
24 import com.vaadin.ui.HorizontalSplitPanel;
25 import com.vaadin.ui.Table;
26 import com.vaadin.ui.VerticalLayout;
27 import com.vaadin.ui.VerticalSplitPanel;
30 * Tests declarative support for AbstractSplitPanel.
35 public class AbstractSplitPanelDeclarativeTest extends
36 DeclarativeTestBase<AbstractSplitPanel> {
39 public void testWithBothChildren() {
40 String design = "<v-horizontal-split-panel split-position=20.5% "
41 + "min-split-position=20% max-split-position=50px locked='' "
42 + "reversed=\"\"> <v-table /> <v-vertical-layout />"
43 + "</v-horizontal-split-panel>";
44 AbstractSplitPanel sp = new HorizontalSplitPanel();
45 sp.setSplitPosition(20.5f, Unit.PERCENTAGE, true);
46 sp.setMinSplitPosition(20, Unit.PERCENTAGE);
47 sp.setMaxSplitPosition(50, Unit.PIXELS);
49 sp.addComponent(new Table());
50 sp.addComponent(new VerticalLayout());
52 testWrite(design, sp);
56 public void testWithFirstChild() {
57 String design = "<v-vertical-split-panel><v-table caption=\"First slot\"/>"
58 + "</v-vertical-split-panel>";
59 AbstractSplitPanel sp = new VerticalSplitPanel();
60 Table t = new Table();
61 t.setCaption("First slot");
64 testWrite(design, sp);
68 public void testWithSecondChild() {
69 String design = "<v-horizontal-split-panel><v-button :second>Second slot</v-button>"
70 + "</v-vertical-split-panel>";
71 AbstractSplitPanel sp = new HorizontalSplitPanel();
72 Button b = new Button("Second slot");
73 b.setCaptionAsHtml(true);
74 sp.setSecondComponent(b);
76 testWrite(design, sp);
80 public void testEmpty() {
81 String design = "<v-horizontal-split-panel/>";
82 AbstractSplitPanel sp = new HorizontalSplitPanel();
84 testWrite(design, sp);