-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1364 from dcjxdd123/develop
Fix fontsize of the Math formula in XWPF
- Loading branch information
Showing
2 changed files
with
57 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using NPOI.OpenXmlFormats.Shared; | ||
using NPOI.XWPF.Usermodel; | ||
using NPOI.XWPF.UserModel; | ||
using NUnit.Framework; | ||
|
||
namespace TestCases.XWPF.UserModel | ||
{ | ||
public class TestXWPFSharedRun | ||
{ | ||
private CT_R ctRun; | ||
public IRunBody p; | ||
|
||
[SetUp] | ||
public void SetUp() | ||
{ | ||
XWPFDocument doc = new XWPFDocument(); | ||
p = doc.CreateParagraph(); | ||
|
||
this.ctRun = new CT_R(); | ||
} | ||
|
||
[Test] | ||
public void TestSetGetFontSize() | ||
{ | ||
NPOI.OpenXmlFormats.Wordprocessing.CT_RPr rpr = ctRun.AddNewRPr1(); | ||
rpr.AddNewSz().val = 14; | ||
|
||
XWPFSharedRun run = new XWPFSharedRun(ctRun, p); | ||
Assert.AreEqual(7.0, run.FontSize); | ||
|
||
run.FontSize = 24; | ||
Assert.AreEqual(48, (int) rpr.sz.val); | ||
|
||
run.FontSize = 24.5; | ||
Assert.AreEqual(24.5, run.FontSize); | ||
} | ||
} | ||
} |