mirror of
https://github.com/ONLYOFFICE/sdkjs.git
synced 2026-04-07 14:09:12 +08:00
For bug #71056
Add test to check numbering application to paragraphs with non-zero left indents
This commit is contained in:
@ -298,4 +298,52 @@ $(function ()
|
||||
CheckParagraph(6, "1.");
|
||||
CheckParagraph(7, "a)");
|
||||
});
|
||||
|
||||
QUnit.test("Applying numbering by selecting to paragraphs with left indentation", function (assert)
|
||||
{
|
||||
// Check situation from bug 71056
|
||||
|
||||
function CheckParagraph(paraIndex, text)
|
||||
{
|
||||
let p = logicDocument.GetElement(paraIndex);
|
||||
assert.strictEqual(p.GetNumberingText(false), text, "Check numbering text for paragraph " + paraIndex);
|
||||
}
|
||||
|
||||
function GenerateDocument()
|
||||
{
|
||||
AscTest.ClearDocument();
|
||||
|
||||
for (let i = 0; i < 4; ++i)
|
||||
{
|
||||
let p = AscTest.CreateParagraph();
|
||||
p.SetParagraphIndent({Left : 5, FirstLine : 15});
|
||||
logicDocument.PushToContent(p);
|
||||
let run = new AscWord.CRun();
|
||||
p.AddToContent(0, run);
|
||||
run.AddText("Paragraph " + i);
|
||||
}
|
||||
assert.strictEqual(logicDocument.GetElementsCount(), 4, "Check number of paragraphs");
|
||||
}
|
||||
|
||||
GenerateDocument();
|
||||
logicDocument.SelectAll();
|
||||
logicDocument.SetParagraphNumbering(AscWord.GetNumberingObjectByDeprecatedTypes(1, 2));
|
||||
AscTest.Recalculate();
|
||||
|
||||
CheckParagraph(0, "1)");
|
||||
CheckParagraph(1, "2)");
|
||||
CheckParagraph(2, "3)");
|
||||
CheckParagraph(3, "4)");
|
||||
|
||||
GenerateDocument();
|
||||
logicDocument.GetElement(0).SetParagraphIndent({Left : 5, FirstLine : 25});
|
||||
logicDocument.SelectAll();
|
||||
logicDocument.SetParagraphNumbering(AscWord.GetNumberingObjectByDeprecatedTypes(1, 2));
|
||||
AscTest.Recalculate();
|
||||
|
||||
CheckParagraph(0, "i.");
|
||||
CheckParagraph(1, "b.");
|
||||
CheckParagraph(2, "c.");
|
||||
CheckParagraph(3, "d.");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user