1.1 --- a/test/de/matthiasmann/twl/textarea/StyleSheetTest.java Sun Jan 22 11:45:34 2012 +0100
1.2 +++ b/test/de/matthiasmann/twl/textarea/StyleSheetTest.java Sun Jan 22 11:47:37 2012 +0100
1.3 @@ -1,8 +1,32 @@
1.4 /*
1.5 - * To change this template, choose Tools | Templates
1.6 - * and open the template in the editor.
1.7 + * Copyright (c) 2008-2012, Matthias Mann
1.8 + *
1.9 + * All rights reserved.
1.10 + *
1.11 + * Redistribution and use in source and binary forms, with or without
1.12 + * modification, are permitted provided that the following conditions are met:
1.13 + *
1.14 + * * Redistributions of source code must retain the above copyright notice,
1.15 + * this list of conditions and the following disclaimer.
1.16 + * * Redistributions in binary form must reproduce the above copyright
1.17 + * notice, this list of conditions and the following disclaimer in the
1.18 + * documentation and/or other materials provided with the distribution.
1.19 + * * Neither the name of Matthias Mann nor the names of its contributors may
1.20 + * be used to endorse or promote products derived from this software
1.21 + * without specific prior written permission.
1.22 + *
1.23 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1.24 + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1.25 + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1.26 + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
1.27 + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
1.28 + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
1.29 + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
1.30 + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
1.31 + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
1.32 + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
1.33 + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1.34 */
1.35 -
1.36 package de.matthiasmann.twl.textarea;
1.37
1.38 import java.io.StringReader;
1.39 @@ -10,6 +34,7 @@
1.40 import static org.junit.Assert.*;
1.41 import static de.matthiasmann.twl.textarea.StyleAttribute.*;
1.42 import static de.matthiasmann.twl.textarea.Value.Unit.*;
1.43 +import de.matthiasmann.twl.utils.StringList;
1.44
1.45 /**
1.46 *
1.47 @@ -30,38 +55,38 @@
1.48 public void testParse2() throws Exception {
1.49 StyleSheet ss = new StyleSheet();
1.50 ss.parse(new StringReader("a { font: link }"));
1.51 - test(ss, FONT_NAME, "link", new StyleSheetKey("a", null, null));
1.52 - test(ss, FONT_NAME, "default", new StyleSheetKey("td", null, null));
1.53 + test(ss, FONT_FAMILIES, new StringList("link"), new StyleSheetKey("a", null, null));
1.54 + test(ss, FONT_FAMILIES, new StringList("default"), new StyleSheetKey("td", null, null));
1.55 }
1.56
1.57 @Test
1.58 public void testParse3() throws Exception {
1.59 StyleSheet ss = new StyleSheet();
1.60 ss.parse(new StringReader("a { font: link; }"));
1.61 - test(ss, FONT_NAME, "link", new StyleSheetKey("a", null, null));
1.62 - test(ss, FONT_NAME, "default", new StyleSheetKey("td", null, null));
1.63 + test(ss, FONT_FAMILIES, new StringList("link"), new StyleSheetKey("a", null, null));
1.64 + test(ss, FONT_FAMILIES, new StringList("default"), new StyleSheetKey("td", null, null));
1.65 }
1.66
1.67 @Test
1.68 public void testParse4() throws Exception {
1.69 StyleSheet ss = new StyleSheet();
1.70 ss.parse(new StringReader("div a { font: link; }"));
1.71 - test(ss, FONT_NAME, "default", new StyleSheetKey("a", null, null));
1.72 - test(ss, FONT_NAME, "default", new StyleSheetKey("div", null, null));
1.73 - test(ss, FONT_NAME, "default", new StyleSheetKey("td", null, null));
1.74 - test(ss, FONT_NAME, "link", new StyleSheetKey("div", null, null), new StyleSheetKey("a", null, null));
1.75 - test(ss, FONT_NAME, "link", new StyleSheetKey("div", null, null), new StyleSheetKey("p", null, null), new StyleSheetKey("a", null, null));
1.76 + test(ss, FONT_FAMILIES, new StringList("default"), new StyleSheetKey("a", null, null));
1.77 + test(ss, FONT_FAMILIES, new StringList("default"), new StyleSheetKey("div", null, null));
1.78 + test(ss, FONT_FAMILIES, new StringList("default"), new StyleSheetKey("td", null, null));
1.79 + test(ss, FONT_FAMILIES, new StringList("link"), new StyleSheetKey("div", null, null), new StyleSheetKey("a", null, null));
1.80 + test(ss, FONT_FAMILIES, new StringList("link"), new StyleSheetKey("div", null, null), new StyleSheetKey("p", null, null), new StyleSheetKey("a", null, null));
1.81 }
1.82
1.83 @Test
1.84 public void testParse5() throws Exception {
1.85 StyleSheet ss = new StyleSheet();
1.86 ss.parse(new StringReader("div > a { font: link; }"));
1.87 - test(ss, FONT_NAME, "default", new StyleSheetKey("a", null, null));
1.88 - test(ss, FONT_NAME, "default", new StyleSheetKey("div", null, null));
1.89 - test(ss, FONT_NAME, "default", new StyleSheetKey("td", null, null));
1.90 - test(ss, FONT_NAME, "link", new StyleSheetKey("div", null, null), new StyleSheetKey("a", null, null));
1.91 - test(ss, FONT_NAME, "default", new StyleSheetKey("div", null, null), new StyleSheetKey("p", null, null), new StyleSheetKey("a", null, null));
1.92 + test(ss, FONT_FAMILIES, new StringList("default"), new StyleSheetKey("a", null, null));
1.93 + test(ss, FONT_FAMILIES, new StringList("default"), new StyleSheetKey("div", null, null));
1.94 + test(ss, FONT_FAMILIES, new StringList("default"), new StyleSheetKey("td", null, null));
1.95 + test(ss, FONT_FAMILIES, new StringList("link"), new StyleSheetKey("div", null, null), new StyleSheetKey("a", null, null));
1.96 + test(ss, FONT_FAMILIES, new StringList("default"), new StyleSheetKey("div", null, null), new StyleSheetKey("p", null, null), new StyleSheetKey("a", null, null));
1.97 }
1.98
1.99 @Test