Author: fanningpj
Date: Wed Jul 11 22:55:03 2018
New Revision: 1835685
URL: http://svn.apache.org/viewvc?rev=1835685&view=rev
Log:
try to get more generated classes into poi-ooxml-schemas
Added:
poi/trunk/src/ooxml/testcases/org/apache/poi/xddf/usermodel/TestNecessaryOOXMLClasses.java
- copied, changed from r1835674,
poi/trunk/src/ooxml/testcases/org/apache/poi/xddf/usermodel/TestXDDFColor.java
poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/TestNecessaryOOXMLClasses.java
(with props)
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/TestNecessaryOOXMLClasses.java
(with props)
Copied:
poi/trunk/src/ooxml/testcases/org/apache/poi/xddf/usermodel/TestNecessaryOOXMLClasses.java
(from r1835674,
poi/trunk/src/ooxml/testcases/org/apache/poi/xddf/usermodel/TestXDDFColor.java)
URL:
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xddf/usermodel/TestNecessaryOOXMLClasses.java?p2=poi/trunk/src/ooxml/testcases/org/apache/poi/xddf/usermodel/TestNecessaryOOXMLClasses.java&p1=poi/trunk/src/ooxml/testcases/org/apache/poi/xddf/usermodel/TestXDDFColor.java&r1=1835674&r2=1835685&rev=1835685&view=diff
==============================================================================
---
poi/trunk/src/ooxml/testcases/org/apache/poi/xddf/usermodel/TestXDDFColor.java
(original)
+++
poi/trunk/src/ooxml/testcases/org/apache/poi/xddf/usermodel/TestNecessaryOOXMLClasses.java
Wed Jul 11 22:55:03 2018
@@ -17,112 +17,73 @@
package org.apache.poi.xddf.usermodel;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-
-import java.io.IOException;
-
-import org.apache.poi.xslf.usermodel.XMLSlideShow;
-import org.apache.poi.xslf.usermodel.XSLFTheme;
+import org.junit.Assert;
import org.junit.Test;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTColor;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTSRgbColor;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTScRgbColor;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTSystemColor;
-import org.openxmlformats.schemas.drawingml.x2006.main.STPresetColorVal;
-import org.openxmlformats.schemas.drawingml.x2006.main.STSchemeColorVal;
-import org.openxmlformats.schemas.drawingml.x2006.main.STSystemColorVal;
-import org.xmlunit.builder.DiffBuilder;
-import org.xmlunit.builder.Input;
-import org.xmlunit.diff.Diff;
+import org.openxmlformats.schemas.drawingml.x2006.chart.*;
+import org.openxmlformats.schemas.drawingml.x2006.main.*;
-public class TestXDDFColor {
- private static final String XMLNS =
"xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\"/>";
+// aim is to get these classes loaded and included in poi-ooxml-schemas.jar
+public class TestNecessaryOOXMLClasses {
@Test
- public void testSchemeColor() throws IOException {
- try (XMLSlideShow ppt = new XMLSlideShow()) {
- XSLFTheme theme = ppt.createSlide().getTheme();
-
- XDDFColor color = XDDFColor.forColorContainer(getThemeColor(theme,
STSchemeColorVal.ACCENT_2));
- // accent2 in theme1.xml is <a:srgbClr val="C0504D"/>
- Diff d1 = DiffBuilder.compare(Input.fromString("<a:srgbClr
val=\"C0504D\" " + XMLNS))
- .withTest(color.getColorContainer().toString()).build();
- assertFalse(d1.toString(), d1.hasDifferences());
-
- color = XDDFColor.forColorContainer(getThemeColor(theme,
STSchemeColorVal.LT_1));
- Diff d2 = DiffBuilder.compare(Input.fromString("<a:sysClr
lastClr=\"FFFFFF\" val=\"window\" " + XMLNS))
- .withTest(color.getColorContainer().toString()).build();
- assertFalse(d2.toString(), d2.hasDifferences());
-
- color = XDDFColor.forColorContainer(getThemeColor(theme,
STSchemeColorVal.DK_1));
- Diff d3 = DiffBuilder.compare(Input.fromString("<a:sysClr
lastClr=\"000000\" val=\"windowText\" " + XMLNS))
- .withTest(color.getColorContainer().toString()).build();
- assertFalse(d3.toString(), d3.hasDifferences());
- }
+ public void testProblemClasses() {
+ CTXYAdjustHandle ctxyAdjustHandle =
CTXYAdjustHandle.Factory.newInstance();
+ Assert.assertNotNull(ctxyAdjustHandle);
+ CTPolarAdjustHandle ctPolarAdjustHandle =
CTPolarAdjustHandle.Factory.newInstance();
+ Assert.assertNotNull(ctPolarAdjustHandle);
+ CTChartLines ctChartLines = CTChartLines.Factory.newInstance();
+ Assert.assertNotNull(ctChartLines);
+ CTDashStop ctDashStop = CTDashStop.Factory.newInstance();
+ Assert.assertNotNull(ctDashStop);
+ CTSurface ctSurface = CTSurface.Factory.newInstance();
+ Assert.assertNotNull(ctSurface);
+ CTLegendEntry ctLegendEntry = CTLegendEntry.Factory.newInstance();
+ Assert.assertNotNull(ctLegendEntry);
+ CTShape3D ctShape3D = CTShape3D.Factory.newInstance();
+ Assert.assertNotNull(ctShape3D);
+ CTScene3D ctScene3D = CTScene3D.Factory.newInstance();
+ Assert.assertNotNull(ctScene3D);
+ CTEffectContainer ctEffectContainer =
CTEffectContainer.Factory.newInstance();
+ Assert.assertNotNull(ctEffectContainer);
+ CTConnectionSite ctConnectionSite =
CTConnectionSite.Factory.newInstance();
+ Assert.assertNotNull(ctConnectionSite);
+ STLblAlgn stLblAlgn = STLblAlgn.Factory.newInstance();
+ Assert.assertNotNull(stLblAlgn);
+ STBlackWhiteMode stBlackWhiteMode =
STBlackWhiteMode.Factory.newInstance();
+ Assert.assertNotNull(stBlackWhiteMode);
+ STRectAlignment stRectAlignment =
STRectAlignment.Factory.newInstance();
+ Assert.assertNotNull(stRectAlignment);
+ STTileFlipMode stTileFlipMode = STTileFlipMode.Factory.newInstance();
+ Assert.assertNotNull(stTileFlipMode);
+ STPresetPatternVal stPresetPatternVal =
STPresetPatternVal.Factory.newInstance();
+ Assert.assertNotNull(stPresetPatternVal);
+ STOnOffStyleType stOnOffStyleType =
STOnOffStyleType.Factory.newInstance();
+ Assert.assertNotNull(stOnOffStyleType);
+ CTLineJoinBevel ctLineJoinBevel =
CTLineJoinBevel.Factory.newInstance();
+ Assert.assertNotNull(ctLineJoinBevel);
+ CTLineJoinMiterProperties ctLineJoinMiterProperties =
CTLineJoinMiterProperties.Factory.newInstance();
+ Assert.assertNotNull(ctLineJoinMiterProperties);
+ CTTileInfoProperties ctTileInfoProperties =
CTTileInfoProperties.Factory.newInstance();
+ Assert.assertNotNull(ctTileInfoProperties);
+ CTTableStyleTextStyle ctTableStyleTextStyle =
CTTableStyleTextStyle.Factory.newInstance();
+ Assert.assertNotNull(ctTableStyleTextStyle);
+ CTHeaderFooter ctHeaderFooter = CTHeaderFooter.Factory.newInstance();
+ Assert.assertNotNull(ctHeaderFooter);
+ CTMarker ctMarker = CTMarker.Factory.newInstance();
+ Assert.assertNotNull(ctMarker);
+
+ STLblAlgn.Enum e1 = STLblAlgn.Enum.forString("ctr");
+ Assert.assertNotNull(e1);
+ STBlackWhiteMode.Enum e2 = STBlackWhiteMode.Enum.forString("clr");
+ Assert.assertNotNull(e2);
+ STRectAlignment.Enum e3 = STRectAlignment.Enum.forString("ctr");
+ Assert.assertNotNull(e3);
+ STTileFlipMode.Enum e4 = STTileFlipMode.Enum.forString("xy");
+ Assert.assertNotNull(e4);
+ STPresetPatternVal.Enum e5 = STPresetPatternVal.Enum.forString("horz");
+ Assert.assertNotNull(e5);
+ STMarkerStyle.Enum e6 = STMarkerStyle.Enum.forString("circle");
+ Assert.assertNotNull(e6);
}
- private CTColor getThemeColor(XSLFTheme theme, STSchemeColorVal.Enum
value) {
- // find referenced CTColor in the theme
- return theme.getCTColor(value.toString());
- }
-
- @Test
- public void testPreset() {
- CTColor xml = CTColor.Factory.newInstance();
- xml.addNewPrstClr().setVal(STPresetColorVal.AQUAMARINE);
- String expected =
XDDFColor.forColorContainer(xml).getXmlObject().toString();
- XDDFColor built = XDDFColor.from(PresetColor.AQUAMARINE);
- assertEquals(expected, built.getXmlObject().toString());
- }
-
- @Test
- public void testSystemDefined() {
- CTColor xml = CTColor.Factory.newInstance();
- CTSystemColor sys = xml.addNewSysClr();
- sys.setVal(STSystemColorVal.CAPTION_TEXT);
- String expected =
XDDFColor.forColorContainer(xml).getXmlObject().toString();
-
- XDDFColor built = new XDDFColorSystemDefined(sys, xml);
- assertEquals(expected, built.getXmlObject().toString());
-
- built = XDDFColor.from(SystemColor.CAPTION_TEXT);
- assertEquals(expected, built.getXmlObject().toString());
- }
-
- @Test
- public void testRgbBinary() {
- CTColor xml = CTColor.Factory.newInstance();
- CTSRgbColor color = xml.addNewSrgbClr();
- byte[] bs = new byte[]{-1, -1, -1};
- color.setVal(bs);
- String expected =
XDDFColor.forColorContainer(xml).getXmlObject().toString();
-
- XDDFColor built = XDDFColor.from(bs);
- assertEquals(expected, built.getXmlObject().toString());
- assertEquals("FFFFFF", ((XDDFColorRgbBinary)built).toRGBHex());
- }
-
- @Test
- public void testRgbPercent() {
- CTColor xml = CTColor.Factory.newInstance();
- CTScRgbColor color = xml.addNewScrgbClr();
- color.setR(0);
- color.setG(0);
- color.setB(0);
- String expected =
XDDFColor.forColorContainer(xml).getXmlObject().toString();
-
- XDDFColorRgbPercent built = (XDDFColorRgbPercent) XDDFColor.from(-1,
-1, -1);
- assertEquals(expected, built.getXmlObject().toString());
- assertEquals("000000", built.toRGBHex());
-
- color.setR(100_000);
- color.setG(100_000);
- color.setB(100_000);
- expected = XDDFColor.forColorContainer(xml).getXmlObject().toString();
-
- built = (XDDFColorRgbPercent) XDDFColor.from(654321, 654321, 654321);
- assertEquals(expected, built.getXmlObject().toString());
- assertEquals("FFFFFF", built.toRGBHex());
- }
}
Added:
poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/TestNecessaryOOXMLClasses.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/TestNecessaryOOXMLClasses.java?rev=1835685&view=auto
==============================================================================
---
poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/TestNecessaryOOXMLClasses.java
(added)
+++
poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/TestNecessaryOOXMLClasses.java
Wed Jul 11 22:55:03 2018
@@ -0,0 +1,35 @@
+/* ====================================================================
+ 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 org.apache.poi.xslf;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openxmlformats.schemas.presentationml.x2006.main.CTHeaderFooter;
+import org.openxmlformats.schemas.presentationml.x2006.main.STPlaceholderSize;
+
+// aim is to get these classes loaded and included in poi-ooxml-schemas.jar
+public class TestNecessaryOOXMLClasses {
+
+ @Test
+ public void testProblemClasses() {
+ STPlaceholderSize stPlaceholderSize =
STPlaceholderSize.Factory.newInstance();
+ Assert.assertNotNull(stPlaceholderSize);
+ CTHeaderFooter ctHeaderFooter = CTHeaderFooter.Factory.newInstance();
+ Assert.assertNotNull(ctHeaderFooter);
+ }
+}
Propchange:
poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/TestNecessaryOOXMLClasses.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/TestNecessaryOOXMLClasses.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/TestNecessaryOOXMLClasses.java?rev=1835685&view=auto
==============================================================================
---
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/TestNecessaryOOXMLClasses.java
(added)
+++
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/TestNecessaryOOXMLClasses.java
Wed Jul 11 22:55:03 2018
@@ -0,0 +1,36 @@
+/* ====================================================================
+ 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 org.apache.poi.xssf;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRow;
+import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheetData;
+
+// aim is to get these classes loaded and included in poi-ooxml-schemas.jar
+public class TestNecessaryOOXMLClasses {
+
+ @Test
+ public void testProblemClasses() {
+ CTRow row = CTRow.Factory.newInstance();
+ CTSheetData sheetData = CTSheetData.Factory.newInstance();
+ // need to get the inner class that implements the row list class
loaded
+ Assert.assertTrue(sheetData.getRowList().add(row));
+ Assert.assertTrue(sheetData.getRowList().iterator().hasNext());
+ }
+}
Propchange:
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/TestNecessaryOOXMLClasses.java
------------------------------------------------------------------------------
svn:eol-style = native
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]