You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by li...@apache.org on 2012/08/31 06:09:25 UTC

svn commit: r1379279 - in /incubator/ooo/trunk/test/testuno/source/testcase/uno/sc/cell: CellBorder.java CellEffectOverline.java CellEffectUnderline.java

Author: liuzhe
Date: Fri Aug 31 04:09:25 2012
New Revision: 1379279

URL: http://svn.apache.org/viewvc?rev=1379279&view=rev
Log:
#120757 - [testUNO] Test cases to check underline, overline and border setting of cell in Spreadsheet.
Patch By: Zhu Shan <sh...@gmail.com>
Review By: Liu Zhe <al...@gmail.com>

Added:
    incubator/ooo/trunk/test/testuno/source/testcase/uno/sc/cell/CellBorder.java
    incubator/ooo/trunk/test/testuno/source/testcase/uno/sc/cell/CellEffectOverline.java
    incubator/ooo/trunk/test/testuno/source/testcase/uno/sc/cell/CellEffectUnderline.java

Added: incubator/ooo/trunk/test/testuno/source/testcase/uno/sc/cell/CellBorder.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/test/testuno/source/testcase/uno/sc/cell/CellBorder.java?rev=1379279&view=auto
==============================================================================
--- incubator/ooo/trunk/test/testuno/source/testcase/uno/sc/cell/CellBorder.java (added)
+++ incubator/ooo/trunk/test/testuno/source/testcase/uno/sc/cell/CellBorder.java Fri Aug 31 04:09:25 2012
@@ -0,0 +1,223 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+
+package testcase.uno.sc.cell;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+import org.openoffice.test.uno.UnoApp;
+
+import testlib.uno.SCUtil;
+import testlib.uno.TestUtil;
+import testlib.uno.CellInfo;
+
+import com.sun.star.lang.XComponent;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.table.BorderLine;
+import com.sun.star.table.XCell;
+
+
+/**
+ *  Check the cell border setting can be applied and saved
+ * 
+ */
+@RunWith(value = Parameterized.class)
+public class CellBorder {
+	//create a class to implement Equals method for BorderLine
+	private class BorderLineWithEqualsFunction{
+		private int Color;
+		private short InnerLineWidth;
+		private short LineDistance;
+		private short OuterLineWidth;
+		
+		public BorderLineWithEqualsFunction(BorderLine borderLine) {
+			this.Color = borderLine.Color;
+			this.InnerLineWidth = borderLine.InnerLineWidth;
+			this.LineDistance = borderLine.LineDistance;
+			this.OuterLineWidth = borderLine.OuterLineWidth;
+		}
+		
+		public boolean equals(Object obj) {
+			if (!(obj instanceof BorderLineWithEqualsFunction)) {
+				return false;
+			}
+			BorderLineWithEqualsFunction borderLine = (BorderLineWithEqualsFunction) obj;
+			return this.Color == borderLine.Color
+					&& this.InnerLineWidth == borderLine.InnerLineWidth
+					&& this.LineDistance == borderLine.LineDistance 
+					&& this.OuterLineWidth == borderLine.OuterLineWidth;
+		}
+		
+		public int hashCode() {
+	       int result = 17;
+	       result = 37 * result + (int) this.Color;
+	       result = 37 * result + (short) this.InnerLineWidth;
+	       result = 37 * result + (short) this.LineDistance;
+	       result = 37 * result + (short) this.OuterLineWidth;
+	       return result;
+	    } 
+	}
+	
+	private BorderLine expected;
+	private BorderLine borderLine;
+	private String fileType;
+	
+	private static final UnoApp unoApp = new UnoApp();
+	
+	XComponent scComponent = null;
+	XSpreadsheetDocument scDocument = null;
+	
+	@Parameters
+	public static Collection<Object[]> data() throws Exception {
+		int[] colorList = TestUtil.randColorList(3);
+
+		return Arrays.asList(new Object[][] {
+			//{inner line (pt), distance (pt), outer line (pt), color number, inner line (pt), distance (pt), outer line (pt), file type} 
+			{0, 0, 1, 0xFF0000, 0, 0, 1, "ods"},   
+			{0, 0, 0.5, 0x00FF00, 0, 0, 0.5, "ods"},
+			{0, 0, 2.5, 0x0000FF, 0, 0, 2.5, "ods"},
+			{0, 0, 5, 0x0000FF, 0, 0, 5, "ods"},
+			{0.05, 0.05, 0.05, colorList[0], 0.05, 0.05, 0.05, "ods"},   
+			{1.0, 0.5, 1.0, colorList[1], 1.0, 0.5, 1.0, "ods"},
+			{5, 2, 5, colorList[2], 5, 2, 5, "ods"},
+			{0, 0, 4, 0xFF0000, 0, 0, 5, "xls"}, 
+			{0, 0, 2.5, 0xFFFF00, 0, 0, 2, "xls"}, 
+			{0, 0, 1, 0x00FF00, 0, 0, 0.5, "xls"},
+			{1, 1, 1, 0x0000FF, 0.5, 1.0, 0.5, "xls"}
+
+		});
+	}
+	
+	public CellBorder(double expInnerLineWidth, double expLineDistance, double expOuterLineWidth, int color, double innerLineWidth, double lineDistance, double outerLineWidth, String fileType) {
+		BorderLine eBorderLine = new BorderLine();
+		BorderLine aBorderLine = new BorderLine();
+		
+		eBorderLine.Color = color;
+		eBorderLine.InnerLineWidth = (short) Math.round(2540 / 72.0 * expInnerLineWidth);
+		eBorderLine.LineDistance = (short) Math.round(2540 / 72.0 * expLineDistance);
+		eBorderLine.OuterLineWidth = (short) Math.round(2540 / 72.0 * expOuterLineWidth);
+		
+		aBorderLine.Color = color;
+		aBorderLine.InnerLineWidth = (short) Math.round(2540 / 72.0 * innerLineWidth);
+		aBorderLine.LineDistance = (short) Math.round(2540 / 72.0 * lineDistance);
+		aBorderLine.OuterLineWidth = (short) Math.round(2540 / 72.0 * outerLineWidth);
+		
+		this.expected = eBorderLine;
+		this.borderLine = aBorderLine;
+		this.fileType = fileType;
+	}
+	
+	
+	@Before
+	public void setUp() throws Exception {
+		scComponent = unoApp.newDocument("scalc");
+		scDocument = SCUtil.getSCDocument(scComponent);
+	}
+
+	@After
+	public void tearDown() throws Exception {
+		unoApp.closeDocument(scComponent);
+		
+	}
+	
+	@BeforeClass
+	public static void setUpConnection() throws Exception {
+		unoApp.start();
+	}
+
+	@AfterClass
+	public static void tearDownConnection() throws InterruptedException, Exception {
+		unoApp.close();
+		SCUtil.clearTempDir();	
+	}
+	
+	/**
+	 * Check the cell border settings
+	 * 1. Create a spreadsheet file.
+	 * 2. Input number, text, formula into many cell.
+	 * 3. Set cell border properties.
+	 * 4. Save file as ODF/MSBinary format.
+	 * 5. Close and reopen file.  -> Check the border setting.
+	 * @throws Exception
+	 */
+	@Test
+	public void testCellBorder() throws Exception {
+		String fileName = "testCellBorder";
+		String[] borderType = {"LeftBorder", "RightBorder", "TopBorder", "BottomBorder"};
+		int borderNum = borderType.length; 
+		int cellNum = 10;
+		XCell[] cells = new XCell[cellNum];
+		BorderLine[][] results = new BorderLine[cellNum][borderNum];
+		CellInfo cInfo = TestUtil.randCell(10, 10);
+
+		XSpreadsheet sheet = SCUtil.getCurrentSheet(scDocument);
+
+		for (int i = 0; i < cellNum; i++) {
+			cells[i] = sheet.getCellByPosition(cInfo.getCol(), cInfo.getRow() + i);
+		}
+
+		cells[0].setValue(borderLine.Color);
+		SCUtil. setTextToCell(cells[1], "all border");
+		cells[2].setFormula("=2^6");
+		cells[3].setValue(-0.1);
+
+		for (int i = 0; i < cellNum; i++) {
+			for (int j = 0; j < borderNum; j++) {
+				SCUtil.setCellProperties(cells[i], borderType[j], borderLine);
+			}
+		}
+		
+		SCUtil.saveFileAs(scComponent, fileName, fileType);
+		scDocument = SCUtil.reloadFile(unoApp, scDocument, fileName + "." + fileType);
+		sheet = SCUtil.getCurrentSheet(scDocument);
+		
+		for (int i = 0; i < cellNum; i++) {
+			cells[i] = sheet.getCellByPosition(cInfo.getCol(), cInfo.getRow() + i);
+			for (int j = 0; j < borderNum; j++) {
+				results[i][j] = (BorderLine) SCUtil.getCellProperties(cells[i], borderType[j]);
+			}
+		}
+		
+		SCUtil.closeFile(scDocument);
+			
+		for (int i = 0; i< cellNum; i++){
+			for (int j = 0; j<borderNum; j++) {
+				assertEquals("Incorrect cell border(" + borderType[j] + ") value got in ." + fileType + " file.", 
+					new BorderLineWithEqualsFunction(expected), new BorderLineWithEqualsFunction(results[i][j]));
+			}
+		}
+			
+	}	
+
+}

Added: incubator/ooo/trunk/test/testuno/source/testcase/uno/sc/cell/CellEffectOverline.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/test/testuno/source/testcase/uno/sc/cell/CellEffectOverline.java?rev=1379279&view=auto
==============================================================================
--- incubator/ooo/trunk/test/testuno/source/testcase/uno/sc/cell/CellEffectOverline.java (added)
+++ incubator/ooo/trunk/test/testuno/source/testcase/uno/sc/cell/CellEffectOverline.java Fri Aug 31 04:09:25 2012
@@ -0,0 +1,226 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+
+package testcase.uno.sc.cell;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+import org.openoffice.test.uno.UnoApp;
+
+import testlib.uno.SCUtil;
+import testlib.uno.TestUtil;
+import testlib.uno.CellInfo;
+
+import com.sun.star.lang.XComponent;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.table.XCell;
+
+
+/**
+ *  Check the cell background color and font color setting can be applied and saved
+ * 
+ */
+@RunWith(value = Parameterized.class)
+public class CellEffectOverline {
+
+	private int expectedLine;
+	private int expectedColor;
+	private String[] inputType;
+	private int inputStyle;
+	private int inputColor;
+	private String fileType;
+	
+	private static final UnoApp unoApp = new UnoApp();
+	
+	XComponent scComponent = null;
+	XSpreadsheetDocument scDocument = null;
+	
+	@Parameters
+	public static Collection<Object[]> data() throws Exception {
+		String[] typeList = {"CharOverline", "CharOverlineHasColor", "CharOverlineColor"};
+		int[] list = TestUtil.randColorList(19);
+		return Arrays.asList(new Object[][] {
+			{0, list[0], typeList, 0, list[0], "ods"}, //NONE 0
+			{1, list[1], typeList, 1, list[1], "ods"}, //SIGNLE 1
+			{2, list[2], typeList, 2, list[2], "ods"}, //DOUBLE 2
+			{3, list[3], typeList, 3, list[3], "ods"}, //DOTTED 3
+			{0, list[4], typeList, 4, list[4], "ods"}, //DONTKNOW 4  can not set this setting via UI
+			{5, list[5], typeList, 5, list[5], "ods"}, //DASH 5
+			{6, list[6], typeList, 6, list[6], "ods"}, //LONGDASH 6
+			{7, list[7], typeList, 7, list[7], "ods"}, //DASHDOT 7
+			{8, list[8], typeList, 8, list[8], "ods"}, //DASHDOTDOT 8
+			{9, list[9], typeList, 9, list[9], "ods"}, //SMALLWAVE 9  can not set this setting via UI
+			{10, list[10], typeList, 10, list[10], "ods"}, //WAVE 10
+			{11, list[11], typeList, 11, list[11], "ods"}, //DOUBLEWAVE 11
+			{12, list[12], typeList, 12, list[12], "ods"}, //BOLD 12
+			{13, list[13], typeList, 13, list[13], "ods"}, //BOLDDOTTED 13
+			{14, list[14], typeList, 14, list[14], "ods"}, //BOLDDASH 14
+			{15, list[15], typeList, 15, list[15], "ods"}, //BOLDLONGDASH 15
+			{16, list[16], typeList, 16, list[16], "ods"}, //BOLDDASHDOT 16
+			{17, list[17], typeList, 17, list[17], "ods"}, //BOLDDASHDOTDOT 17
+			{18, list[18], typeList, 18, list[18], "ods"}, //BOLDWAVE = 18
+			
+			{0, list[0], typeList, 0, list[0], "xls"}, //NONE 0
+			{0, list[1], typeList, 1, list[1], "xls"}, //SIGNLE 1
+			{0, list[2], typeList, 2, list[2], "xls"}, //DOUBLE 2
+			{0, list[3], typeList, 3, list[3], "xls"}, //DOTTED 3
+			{0, list[4], typeList, 4, list[4], "xls"}, //DONTKNOW 4  can not set this setting via UI
+			{0, list[5], typeList, 5, list[5], "xls"}, //DASH 5
+			{0, list[6], typeList, 6, list[6], "xls"}, //LONGDASH 6
+			{0, list[7], typeList, 7, list[7], "xls"}, //DASHDOT 7
+			{0, list[8], typeList, 8, list[8], "xls"}, //DASHDOTDOT 8
+			{0, list[9], typeList, 9, list[9], "xls"}, //SMALLWAVE 9  can not set this setting via UI
+			{0, list[10], typeList, 10, list[10], "xls"}, //WAVE 10
+			{0, list[11], typeList, 11, list[11], "xls"}, //DOUBLEWAVE 11
+			{0, list[12], typeList, 12, list[12], "xls"}, //BOLD 12
+			{0, list[13], typeList, 13, list[13], "xls"}, //BOLDDOTTED 13
+			{0, list[14], typeList, 14, list[14], "xls"}, //BOLDDASH 14
+			{0, list[15], typeList, 15, list[15], "xls"}, //BOLDLONGDASH 15
+			{0, list[16], typeList, 16, list[16], "xls"}, //BOLDDASHDOT 16
+			{0, list[17], typeList, 17, list[17], "xls"}, //BOLDDASHDOTDOT 17
+			{0, list[18], typeList, 18, list[18], "xls"} //BOLDWAVE = 18
+			
+		});
+	}
+	
+	public CellEffectOverline(int expectedStyle, int expectedColor, String[] inputType, int inputStyle, int inputColor, String fileType) {
+		this.expectedLine = expectedStyle;
+		this.expectedColor = expectedColor;
+		this.inputType = inputType;
+		this.inputStyle = inputStyle;
+		this.inputColor = inputColor;
+		this.fileType = fileType;
+	}
+	
+	
+	@Before
+	public void setUp() throws Exception {
+		scComponent = unoApp.newDocument("scalc");
+		scDocument = SCUtil.getSCDocument(scComponent);
+	}
+
+	@After
+	public void tearDown() throws Exception {
+		unoApp.closeDocument(scComponent);
+		
+	}
+	
+	@BeforeClass
+	public static void setUpConnection() throws Exception {
+		unoApp.start();
+	}
+
+	@AfterClass
+	public static void tearDownConnection() throws InterruptedException, Exception {
+		unoApp.close();
+		SCUtil.clearTempDir();	
+	}
+	
+	/**
+	 * Check the cell overline style and overline color
+	 * 1. Create a spreadsheet file.
+	 * 2. Input number, text, formula into many cell.
+	 * 3. Set cell overline style.
+	 * 4. Set cell overline color, if overline style is not NONE.
+	 * 4. Save file as ODF/MSBinary format. (MSBinary file can not support overline, save as .xls, the overline setting will be lost)
+	 * 5. Close and reopen file.  -> Check the overline style and overline color setting. 
+	 * @throws Exception
+	 */
+	@Test
+	public void testCharOverline() throws Exception {
+		String fileName = "testCharOverline";
+		int cellNum = 5;
+		XCell[] cells = new XCell[cellNum];
+		int[] styleResults = new int[cellNum];
+		boolean[] hasColor = new boolean[cellNum];
+		int[] colorResults = new int[cellNum];
+		CellInfo cInfo = TestUtil.randCell(100, 100);
+		
+		XSpreadsheet sheet = SCUtil.getCurrentSheet(scDocument);
+		
+		for (int i = 0; i < cellNum; i++) {
+			cells[i] = sheet.getCellByPosition(cInfo.getCol(), cInfo.getRow() + i);
+		}
+		
+		cells[0].setValue(inputColor);
+		SCUtil.setTextToCell(cells[1], inputType[0]);
+		cells[2].setFormula("=10/0");
+		cells[3].setValue(-0.0000001);
+
+		for (int i = 0; i < cellNum; i++) {
+			SCUtil.setCellProperties(cells[i], inputType[0], inputStyle);
+			if (inputStyle > 0) {
+				SCUtil.setCellProperties(cells[i], inputType[1], true);
+				SCUtil.setCellProperties(cells[i], inputType[2], inputColor);
+			}						
+		}
+		
+		SCUtil.saveFileAs(scComponent, fileName, fileType);
+		scDocument = SCUtil.reloadFile(unoApp, scDocument, fileName + "." + fileType);
+		sheet = SCUtil.getCurrentSheet(scDocument);
+		
+		for (int i = 0; i < cellNum; i++) {
+			cells[i] = sheet.getCellByPosition(cInfo.getCol(), cInfo.getRow() + i);
+			styleResults[i] = ((Short) SCUtil.getCellProperties(cells[i], inputType[0])).shortValue();
+			
+			if (inputStyle > 0) {
+				hasColor[i] = ((Boolean) SCUtil.getCellProperties(cells[i], inputType[1])).booleanValue();
+				colorResults[i] = ((Integer) SCUtil.getCellProperties(cells[i], inputType[2])).intValue();
+			}
+		}
+		
+		SCUtil.closeFile(scDocument);
+
+		for (int i = 0; i < cellNum; i++) {
+			assertEquals("Incorrect cell overline style(" + inputType[0] + ") value got in ." + fileType + " file.", expectedLine, styleResults[i], 0);
+
+			if (inputStyle > 0) {
+				
+				if( fileType.equalsIgnoreCase("xls") || fileType.equalsIgnoreCase("xlt")) {
+					assertFalse("Incorrect cell overline has color setting(" + inputType[1] + ") value got in ." + fileType + " file.", hasColor[i]);
+				}
+				
+				else {
+					assertTrue("Incorrect cell overline has color setting(" + inputType[1] + ") value got in ." + fileType + " file.", hasColor[i]);
+					assertEquals("Incorrect cell overline color(" + inputType[2] + ") value got in ." + fileType + " file.", expectedColor, colorResults[i], 0);
+				}
+				
+			}
+		}
+			
+	}
+
+}

Added: incubator/ooo/trunk/test/testuno/source/testcase/uno/sc/cell/CellEffectUnderline.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/test/testuno/source/testcase/uno/sc/cell/CellEffectUnderline.java?rev=1379279&view=auto
==============================================================================
--- incubator/ooo/trunk/test/testuno/source/testcase/uno/sc/cell/CellEffectUnderline.java (added)
+++ incubator/ooo/trunk/test/testuno/source/testcase/uno/sc/cell/CellEffectUnderline.java Fri Aug 31 04:09:25 2012
@@ -0,0 +1,220 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+
+package testcase.uno.sc.cell;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+import org.openoffice.test.uno.UnoApp;
+
+import testlib.uno.SCUtil;
+import testlib.uno.TestUtil;
+import testlib.uno.CellInfo;
+
+import com.sun.star.lang.XComponent;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.table.XCell;
+
+
+/**
+ *  Check the cell background color and font color setting can be applied and saved
+ * 
+ */
+@RunWith(value = Parameterized.class)
+public class CellEffectUnderline {
+
+	private int expectedLine;
+	private int expectedColor;
+	private String[] inputType;
+	private int inputStyle;
+	private int inputColor;
+	private String fileType;
+	
+	private static final UnoApp unoApp = new UnoApp();
+	
+	XComponent scComponent = null;
+	XSpreadsheetDocument scDocument = null;
+	
+	@Parameters
+	public static Collection<Object[]> data() throws Exception {
+		String[] typeList = {"CharUnderline", "CharUnderlineHasColor", "CharUnderlineColor"};
+		int[] list = TestUtil.randColorList(19);
+		return Arrays.asList(new Object[][] {
+			{0, list[0], typeList, 0, list[0], "ods"}, //NONE 0
+			{1, list[1], typeList, 1, list[1], "ods"}, //SIGNLE 1
+			{2, list[2], typeList, 2, list[2], "ods"}, //DOUBLE 2
+			{3, list[3], typeList, 3, list[3], "ods"}, //DOTTED 3
+			{0, list[4], typeList, 4, list[4], "ods"}, //DONTKNOW 4  can not set this setting via UI
+			{5, list[5], typeList, 5, list[5], "ods"}, //DASH 5
+			{6, list[6], typeList, 6, list[6], "ods"}, //LONGDASH 6
+			{7, list[7], typeList, 7, list[7], "ods"}, //DASHDOT 7
+			{8, list[8], typeList, 8, list[8], "ods"}, //DASHDOTDOT 8
+			{9, list[9], typeList, 9, list[9], "ods"}, //SMALLWAVE 9  can not set this setting via UI
+			{10, list[10], typeList, 10, list[10], "ods"}, //WAVE 10
+			{11, list[11], typeList, 11, list[11], "ods"}, //DOUBLEWAVE 11
+			{12, list[12], typeList, 12, list[12], "ods"}, //BOLD 12
+			{13, list[13], typeList, 13, list[13], "ods"}, //BOLDDOTTED 13
+			{14, list[14], typeList, 14, list[14], "ods"}, //BOLDDASH 14
+			{15, list[15], typeList, 15, list[15], "ods"}, //BOLDLONGDASH 15
+			{16, list[16], typeList, 16, list[16], "ods"}, //BOLDDASHDOT 16
+			{17, list[17], typeList, 17, list[17], "ods"}, //BOLDDASHDOTDOT 17
+			{18, list[18], typeList, 18, list[18], "ods"}, //BOLDWAVE = 18
+			
+			{0, list[0], typeList, 0, list[0], "xls"}, //NONE 0
+			{1, list[1], typeList, 1, list[1], "xls"}, //SIGNLE 1
+			{2, list[2], typeList, 2, list[2], "xls"}, //DOUBLE 2
+			{1, list[3], typeList, 3, list[3], "xls"}, //DOTTED 3
+			{0, list[4], typeList, 4, list[4], "xls"}, //DONTKNOW 4  can not set this setting via UI
+			{1, list[5], typeList, 5, list[5], "xls"}, //DASH 5
+			{1, list[6], typeList, 6, list[6], "xls"}, //LONGDASH 6
+			{1, list[7], typeList, 7, list[7], "xls"}, //DASHDOT 7
+			{1, list[8], typeList, 8, list[8], "xls"}, //DASHDOTDOT 8
+			{1, list[9], typeList, 9, list[9], "xls"}, //SMALLWAVE 9  can not set this setting via UI
+			{1, list[10], typeList, 10, list[10], "xls"}, //WAVE 10
+			{2, list[11], typeList, 11, list[11], "xls"}, //DOUBLEWAVE 11
+			{1, list[12], typeList, 12, list[12], "xls"}, //BOLD 12
+			{1, list[13], typeList, 13, list[13], "xls"}, //BOLDDOTTED 13
+			{1, list[14], typeList, 14, list[14], "xls"}, //BOLDDASH 14
+			{1, list[15], typeList, 15, list[15], "xls"}, //BOLDLONGDASH 15
+			{1, list[16], typeList, 16, list[16], "xls"}, //BOLDDASHDOT 16
+			{1, list[17], typeList, 17, list[17], "xls"}, //BOLDDASHDOTDOT 17
+			{1, list[18], typeList, 18, list[18], "xls"} //BOLDWAVE = 18		
+		});
+	}
+	
+	public CellEffectUnderline(int expectedStyle, int expectedColor, String[] inputType, int inputStyle, int inputColor, String fileType) {
+		this.expectedLine = expectedStyle;
+		this.expectedColor = expectedColor;
+		this.inputType = inputType;
+		this.inputStyle = inputStyle;
+		this.inputColor = inputColor;
+		this.fileType = fileType;
+	}
+	
+	
+	@Before
+	public void setUp() throws Exception {
+		scComponent = unoApp.newDocument("scalc");
+		scDocument = SCUtil.getSCDocument(scComponent);
+	}
+
+	@After
+	public void tearDown() throws Exception {
+		unoApp.closeDocument(scComponent);
+		
+	}
+	
+	@BeforeClass
+	public static void setUpConnection() throws Exception {
+		unoApp.start();
+	}
+
+	@AfterClass
+	public static void tearDownConnection() throws InterruptedException, Exception {
+		unoApp.close();
+		SCUtil.clearTempDir();	
+	}
+	
+	/**
+	 * Check the cell underline style and underline color
+	 * 1. Create a spreadsheet file.
+	 * 2. Input number, text, formula into many cell.
+	 * 3. Set cell underline style.
+	 * 4. Set cell underline color, if underline style is not NONE.
+	 * 4. Save file as ODF/MSBinary format.
+	 * 5. Close and reopen file.  -> Check the underline style and underline color setting.
+	 * @throws Exception
+	 */
+	@Test
+	public void testCharUnderline() throws Exception {
+		String fileName = "testCharUnderline";
+		int cellNum = 5;
+		XCell[] cells = new XCell[cellNum];
+		int[] styleResults = new int[cellNum];
+		boolean[] hasColor = new boolean[cellNum];
+		int[] colorResults = new int[cellNum];
+		CellInfo cInfo = TestUtil.randCell(100, 32768);
+		
+		XSpreadsheet sheet = SCUtil.getCurrentSheet(scDocument);
+		
+		for (int i = 0; i < cellNum; i++) {
+			cells[i] = sheet.getCellByPosition(cInfo.getCol(), cInfo.getRow() + i);
+		}
+		
+		cells[0].setValue(inputColor);
+		SCUtil.setTextToCell(cells[1], inputType[0]);
+		cells[2].setFormula("=\"ABC\"");
+		cells[3].setValue(-0.90000001);
+
+		for (int i = 0; i < cellNum; i++) {
+			SCUtil.setCellProperties(cells[i], inputType[0], inputStyle);
+			if (inputStyle > 0) {
+				SCUtil.setCellProperties(cells[i], inputType[1], true);
+				SCUtil.setCellProperties(cells[i], inputType[2], inputColor);
+			}						
+		}
+		
+		SCUtil.saveFileAs(scComponent, fileName, fileType);
+		scDocument = SCUtil.reloadFile(unoApp, scDocument, fileName + "." + fileType);
+		sheet = SCUtil.getCurrentSheet(scDocument);
+		
+		for (int i = 0; i < cellNum; i++) {
+			cells[i] = sheet.getCellByPosition(cInfo.getCol(), cInfo.getRow() + i);
+			styleResults[i] = ((Short) SCUtil.getCellProperties(cells[i], inputType[0])).shortValue();
+			if (inputStyle > 0) {
+				hasColor[i] = ((Boolean) SCUtil.getCellProperties(cells[i], inputType[1])).booleanValue();
+				colorResults[i] = ((Integer) SCUtil.getCellProperties(cells[i], inputType[2])).intValue();
+			}
+		}
+		SCUtil.closeFile(scDocument);
+
+		for (int i = 0; i < cellNum; i++) {
+			assertEquals("Incorrect cell underline style(" + inputType[0] + ") value got in ." + fileType + " file.", expectedLine, styleResults[i], 0);
+			if (inputStyle > 0) {
+				if( fileType.equalsIgnoreCase("xls") || fileType.equalsIgnoreCase("xlt")) {
+					assertFalse("Incorrect cell underline has color setting(" + inputType[1] + ") value got in ." + fileType + " file.", hasColor[i]);
+				} 
+				else {
+					assertTrue("Incorrect cell underline has color setting(" + inputType[1] + ") value got in ." + fileType + " file.", hasColor[i]);
+					assertEquals("Incorrect cell underline color(" + inputType[2] + ") value got in ." + fileType + " file.", expectedColor, colorResults[i], 0);
+				}
+				
+			}
+		}
+			
+	}
+
+}