Browse Source

fix test-data

master
yangxiaodong 8 years ago
parent
commit
fbf3698d11
  1. 3
      .gitignore
  2. 20
      src/Npoi.Core.Ooxml/XSSF/UserModel/XSSFTextParagraph.cs
  3. 1
      test/Npoi.Core.Ooxml.TestCases/SS/Formula/Eval/TestXSSFCircularReferences.cs
  4. 3
      test/Npoi.Core.Ooxml.TestCases/appsettings.json
  5. 4
      test/Npoi.Core.Ooxml.TestCases/project.json
  6. 2
      test/Npoi.Core.OpenXml4Net.Tests/appsettings.json
  7. 2
      test/Npoi.Core.OpenXml4Net.Tests/project.json
  8. 2
      test/Npoi.Core.TestCases/POIDataSamples.cs
  9. 19
      test/Npoi.Core.TestCases/Shim/CultureShim.cs
  10. 3
      test/Npoi.Core.TestCases/appsettings.json
  11. 6
      test/Npoi.Core.TestCases/project.json

3
.gitignore

@ -262,3 +262,6 @@ pkg/
pkgobj/ pkgobj/
/Code/Npoi.Samples.CreateNewSpreadsheet/newbook.core.xlsx /Code/Npoi.Samples.CreateNewSpreadsheet/newbook.core.xlsx
*.ppt *.ppt
*.opc
*.zip
*.ole2

20
src/Npoi.Core.Ooxml/XSSF/UserModel/XSSFTextParagraph.cs

@ -358,6 +358,13 @@ namespace Npoi.Core.XSSF.UserModel
} }
} }
public int GetLevel() {
CT_TextParagraphProperties pr = _p.pPr;
if (pr == null) return 0;
return pr.lvl;
}
/** /**
* *
* @return the color of bullet characters within a given paragraph. * @return the color of bullet characters within a given paragraph.
@ -368,19 +375,6 @@ namespace Npoi.Core.XSSF.UserModel
{ {
get get
{ {
//ParagraphPropertyFetcher<Color> fetcher = new ParagraphPropertyFetcher<Color>(getLevel()){
// public bool fetch(CTTextParagraphProperties props){
// if(props.IsSetBuClr()){
// if(props.GetBuClr().IsSetSrgbClr()){
// CTSRgbColor clr = props.GetBuClr().GetSrgbClr();
// byte[] rgb = clr.GetVal();
// SetValue(new Color(0xFF & rgb[0], 0xFF & rgb[1], 0xFF & rgb[2]));
// return true;
// }
// }
// return false;
// }
//};
ParagraphPropertyFetcherBulletFontColor fetcher = new ParagraphPropertyFetcherBulletFontColor(Level); ParagraphPropertyFetcherBulletFontColor fetcher = new ParagraphPropertyFetcherBulletFontColor(Level);
fetchParagraphProperty(fetcher); fetchParagraphProperty(fetcher);
return fetcher.GetValue(); return fetcher.GetValue();

1
test/Npoi.Core.Ooxml.TestCases/SS/Formula/Eval/TestXSSFCircularReferences.cs

@ -26,7 +26,6 @@ namespace Npoi.Core.SS.Formula.Eval
* *
* @author Josh Micich * @author Josh Micich
*/ */
[TestFixture] [TestFixture]
public class TestXSSFCircularReferences : BaseTestCircularReferences public class TestXSSFCircularReferences : BaseTestCircularReferences
{ {

3
test/Npoi.Core.Ooxml.TestCases/appsettings.json

@ -0,0 +1,3 @@
{
"POI.testdata.path": "..\\test-data"
}

4
test/Npoi.Core.Ooxml.TestCases/project.json

@ -7,7 +7,9 @@
"Npoi.Core.Ooxml": "1.1.0-*", "Npoi.Core.Ooxml": "1.1.0-*",
"SharpZipLib.NETStandard": "0.86.0.1", "SharpZipLib.NETStandard": "0.86.0.1",
"NUnit": "3.5.0", "NUnit": "3.5.0",
"dotnet-test-nunit": "3.4.0-beta-3" "dotnet-test-nunit": "3.4.0-beta-3",
"Microsoft.Extensions.Configuration": "1.1.0",
"Microsoft.Extensions.Configuration.Json": "1.1.0"
}, },
"frameworks": { "frameworks": {

2
test/Npoi.Core.OpenXml4Net.Tests/appsettings.json

@ -1,3 +1,3 @@
{ {
"POI.testdata.path": "..\\..\\..\\Npoi.Core.OpenXml4Net.Tests\\test-data" "POI.testdata.path": "..\\test-data"
} }

2
test/Npoi.Core.OpenXml4Net.Tests/project.json

@ -2,7 +2,6 @@
"version": "1.1.0-*", "version": "1.1.0-*",
"buildOptions": { "nowarn": [ "CS0168", "CS0618", "CS0162" ] }, "buildOptions": { "nowarn": [ "CS0168", "CS0618", "CS0162" ] },
"dependencies": { "dependencies": {
"Microsoft.Extensions.Configuration": "1.1.0",
"Npoi.Core": "1.1.0-*", "Npoi.Core": "1.1.0-*",
"Npoi.Core.Ooxml": "1.1.0-*", "Npoi.Core.Ooxml": "1.1.0-*",
"Npoi.Core.OpenXml4Net": "1.1.0-*", "Npoi.Core.OpenXml4Net": "1.1.0-*",
@ -10,6 +9,7 @@
"NUnit": "3.5.0", "NUnit": "3.5.0",
"dotnet-test-nunit": "3.4.0-beta-3", "dotnet-test-nunit": "3.4.0-beta-3",
"System.Xml.XmlDocument": "4.3.0", "System.Xml.XmlDocument": "4.3.0",
"Microsoft.Extensions.Configuration": "1.1.0",
"Microsoft.Extensions.Configuration.Json": "1.1.0" "Microsoft.Extensions.Configuration.Json": "1.1.0"
}, },

2
test/Npoi.Core.TestCases/POIDataSamples.cs

@ -115,7 +115,7 @@ namespace TestCases
// Some of the tests are depending on the american culture. // Some of the tests are depending on the american culture.
TestCases.CultureShim.SetCurrentCulture("en-US"); TestCases.CultureShim.SetCurrentCulture("en-US");
string dataDirName = TestCases.AppSettingsShim.GetSetting(TEST_PROPERTY); string dataDirName = AppSettingsShim.GetSetting(TEST_PROPERTY);
if (dataDirName == null) if (dataDirName == null)
throw new Exception("Must set system property '" throw new Exception("Must set system property '"

19
test/Npoi.Core.TestCases/Shim/CultureShim.cs

@ -1,5 +1,7 @@
using System; using Microsoft.Extensions.Configuration;
using System;
using System.Globalization; using System.Globalization;
using System.IO;
using System.Text; using System.Text;
namespace TestCases namespace TestCases
@ -8,20 +10,27 @@ namespace TestCases
{ {
public static StringComparison InvariantCultureIgnoreCase => StringComparison.OrdinalIgnoreCase; public static StringComparison InvariantCultureIgnoreCase => StringComparison.OrdinalIgnoreCase;
} }
public class EncodingShim public class EncodingShim
{ {
public static Encoding Default => Encoding.UTF8; public static Encoding Default => Encoding.UTF8;
} }
public class AppSettingsShim public class AppSettingsShim
{ {
public static string GetSetting(string name) public static string GetSetting(string name)
{ {
if ("POI.testdata.path" == name) { var build = new ConfigurationBuilder()
return AppContext.BaseDirectory; .SetBasePath(Directory.GetCurrentDirectory())
} .AddJsonFile("appsettings.json").Build();
throw new NotImplementedException();
return build.GetSection("POI.testdata.path").Value;
} }
} }
public class CultureShim public class CultureShim
{ {
public static CultureInfo InstalledUICulture => CultureInfo.CurrentUICulture; public static CultureInfo InstalledUICulture => CultureInfo.CurrentUICulture;

3
test/Npoi.Core.TestCases/appsettings.json

@ -0,0 +1,3 @@
{
"POI.testdata.path": "..\\test-data"
}

6
test/Npoi.Core.TestCases/project.json

@ -7,9 +7,9 @@
"dependencies": { "dependencies": {
"NUnit": "3.5.0", "NUnit": "3.5.0",
"dotnet-test-nunit": "3.4.0-beta-3", "dotnet-test-nunit": "3.4.0-beta-3",
// "NETStandard.Library": "1.6.0", "Npoi.Core": "1.1.0-*",
"Npoi.Core": "1.1.0-*" "Microsoft.Extensions.Configuration": "1.1.0",
//"nunit": "3.2.1" "Microsoft.Extensions.Configuration.Json": "1.1.0"
}, },
"frameworks": { "frameworks": {

Loading…
Cancel
Save