Add test to check numbering application to paragraphs with non-zero left indents
This commit is contained in:
Ilya Kirillov
2024-11-02 15:35:44 +03:00
parent 3f2fca0cbf
commit e7410ec4a2

View File

@ -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.");
});
});