01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: /**
18: * @author Alexey A. Ivanov
19: * @version $Revision$
20: */package javax.swing.text.html;
21:
22: import javax.swing.BasicSwingTestCase;
23: import javax.swing.text.AttributeSet;
24: import javax.swing.text.StyleConstants;
25:
26: public class StyleSheet_ConvertAttr_LineHeightTest extends
27: StyleSheet_ConvertAttr_LengthTestCase {
28:
29: protected void setUp() throws Exception {
30: super .setUp();
31: cssKey = CSS.Attribute.LINE_HEIGHT;
32: negativeValuesInvalid = true;
33: }
34:
35: public void testNormal() {
36: ss.addCSSAttribute(simple, cssKey, "normal");
37: cssValue = simple.getAttribute(cssKey);
38: assertEquals("normal", cssValue.toString());
39: }
40:
41: public void testMedium() {
42: ss.addCSSAttribute(simple, cssKey, "medium");
43: cssValue = simple.getAttribute(cssKey);
44: if (!BasicSwingTestCase.isHarmony()) {
45: assertEquals(1, simple.getAttributeCount());
46: assertEquals("medium", cssValue.toString());
47: return;
48: }
49: assertEquals(0, simple.getAttributeCount());
50: assertNull(cssValue);
51: }
52:
53: public void testLength11_1() {
54: ss.addCSSAttribute(simple, cssKey, "11.1"); // Valid for 'line-height'
55: cssValue = simple.getAttribute(cssKey);
56: assertEquals(1, simple.getAttributeCount());
57: assertEquals("11.1", cssValue.toString());
58: }
59:
60: public void testLineSpacing() {
61: StyleSheet ss = new StyleSheet();
62: AttributeSet attr = ss.addAttribute(ss.getEmptySet(),
63: StyleConstants.LineSpacing, new Float(1.1));
64: assertEquals(1, attr.getAttributeCount());
65: assertNull(attr.getAttribute(CSS.Attribute.LINE_HEIGHT));
66: }
67:
68: public void testLengthMinus11_1pt() {
69: negativeValuesInvalid = BasicSwingTestCase.isHarmony();
70: super .testLengthMinus11_1pt();
71: }
72:
73: public void testLengthMinus11_1Percent() {
74: negativeValuesInvalid = BasicSwingTestCase.isHarmony();
75: super.testLengthMinus11_1Percent();
76: }
77: }
|