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.colorpicker;
18 import org.junit.Test;
20 import com.vaadin.shared.ui.colorpicker.Color;
21 import com.vaadin.tests.design.DeclarativeTestBase;
22 import com.vaadin.ui.AbstractColorPicker;
23 import com.vaadin.ui.AbstractColorPicker.PopupStyle;
24 import com.vaadin.ui.ColorPicker;
25 import com.vaadin.ui.ColorPickerArea;
27 public class AbstractColorPickerDeclarativeTest extends
28 DeclarativeTestBase<AbstractColorPicker> {
31 public void testAllAbstractColorPickerFeatures() {
32 String design = "<v-color-picker color='#fafafa' default-caption-enabled='' position='100,100'"
33 + " popup-style='simple' rgb-visibility='false' hsv-visibility='false'"
34 + " history-visibility=false textfield-visibility=false />";
35 ColorPicker colorPicker = new ColorPicker();
36 int colorInt = Integer.parseInt("fafafa", 16);
37 colorPicker.setColor(new Color(colorInt));
38 colorPicker.setDefaultCaptionEnabled(true);
39 colorPicker.setPosition(100, 100);
40 colorPicker.setPopupStyle(PopupStyle.POPUP_SIMPLE);
41 colorPicker.setRGBVisibility(false);
42 colorPicker.setHSVVisibility(false);
43 colorPicker.setSwatchesVisibility(true);
44 colorPicker.setHistoryVisibility(false);
45 colorPicker.setTextfieldVisibility(false);
47 testWrite(design, colorPicker);
48 testRead(design, colorPicker);
52 public void testEmptyColorPicker() {
53 String design = "<v-color-picker />";
54 ColorPicker colorPicker = new ColorPicker();
55 testRead(design, colorPicker);
56 testWrite(design, colorPicker);
60 public void testAllAbstractColorPickerAreaFeatures() {
61 String design = "<v-color-picker-area color='#fafafa' default-caption-enabled='' position='100,100'"
62 + " popup-style='simple' rgb-visibility='false' hsv-visibility='false'"
63 + " history-visibility=false textfield-visibility=false />";
64 AbstractColorPicker colorPicker = new ColorPickerArea();
65 int colorInt = Integer.parseInt("fafafa", 16);
66 colorPicker.setColor(new Color(colorInt));
67 colorPicker.setDefaultCaptionEnabled(true);
68 colorPicker.setPosition(100, 100);
69 colorPicker.setPopupStyle(PopupStyle.POPUP_SIMPLE);
70 colorPicker.setRGBVisibility(false);
71 colorPicker.setHSVVisibility(false);
72 colorPicker.setSwatchesVisibility(true);
73 colorPicker.setHistoryVisibility(false);
74 colorPicker.setTextfieldVisibility(false);
76 testWrite(design, colorPicker);
77 testRead(design, colorPicker);
81 public void testEmptyColorPickerArea() {
82 String design = "<v-color-picker-area />";
83 AbstractColorPicker colorPicker = new ColorPickerArea();
84 testRead(design, colorPicker);
85 testWrite(design, colorPicker);