mirror of
https://github.com/ONLYOFFICE/sdkjs.git
synced 2026-04-07 14:09:12 +08:00
Merge branch 'release/v8.3.0' into feature/spredsheet-undo
# Conflicts: # cell/model/WorkbookElems.js
This commit is contained in:
@ -703,13 +703,14 @@ $(function () {
|
||||
}
|
||||
};
|
||||
|
||||
let initDefinedName = function (eR, sheetName, range, name) {
|
||||
let initDefinedName = function (eR, sheetName, range, name, shortLink) {
|
||||
let RealDefNameWorksheet = AscCommonExcel.g_DefNameWorksheet;
|
||||
AscCommonExcel.g_DefNameWorksheet = eR.worksheets[sheetName];
|
||||
wb.dependencyFormulas.initOpen();
|
||||
let _obj = {
|
||||
value: name,
|
||||
ws: {sName: sheetName}
|
||||
ws: {sName: sheetName},
|
||||
shortLink: shortLink
|
||||
};
|
||||
eR.initDefinedName(_obj);
|
||||
AscCommonExcel.g_DefNameWorksheet = RealDefNameWorksheet;
|
||||
@ -736,7 +737,7 @@ $(function () {
|
||||
|
||||
res = oParser.calculate();
|
||||
let dimension = res.getDimensions();
|
||||
assert.strictEqual(dimension.row, 0, 'IMPORTRANGE_1_after_add_references_row_count');
|
||||
assert.strictEqual(dimension.row, 1, 'IMPORTRANGE_1_after_add_references_row_count');
|
||||
|
||||
initReference(wb.externalReferences[0], "Sheet1", "A1", [[1000]]);
|
||||
res = oParser.calculate();
|
||||
@ -992,6 +993,215 @@ $(function () {
|
||||
assert.strictEqual(wb.externalReferences.length, 0);
|
||||
});
|
||||
|
||||
QUnit.test("Test: \"Check short links\"", function (assert) {
|
||||
// create ext link
|
||||
// check parser formula - simulate reading a string like [linkIndex] + "SheetName" + "!" + "ReferenceTo"
|
||||
let fullLinkLocal = "'[book.xlsx]Sheet1'!A1",
|
||||
fullLinkDefnameLocal = "'[book.xlsx]Sheet1'!_s1",
|
||||
fullLink = "'[1]Sheet1'!A1",
|
||||
fullLinkDefname = "'[1]Sheet1'!_s1",
|
||||
shortLinkLocal = "'[book.xlsx]'!A1",
|
||||
shortLinkDefnameLocal = "[book.xlsx]!_s1",
|
||||
shortLinkDefnameLocalWithoutBrackets = "book.xlsx!_s1",
|
||||
shortLinkDefnameLocalWithoutBrackets2 = "'book.xlsx'!_s1",
|
||||
shortLink = "[1]!A1",
|
||||
shortLinkDefname = "[1]!_s1",
|
||||
shortLinkDefname2 = "'[1]'!_s1",
|
||||
shortLinkDefnameWithoutBrackets = "'1'!_s1",
|
||||
externalWs;
|
||||
|
||||
let elemInStack;
|
||||
// create external link
|
||||
let cellWithFormula = new AscCommonExcel.CCellWithFormula(ws, 1, 0);
|
||||
let parseResult = new AscCommonExcel.ParseResult([]);
|
||||
oParser = new parserFormula(fullLinkDefnameLocal, cellWithFormula, ws);
|
||||
assert.ok(oParser.parse(true, null, parseResult), fullLinkDefnameLocal);
|
||||
|
||||
// set extrefs to 0
|
||||
wb.externalReferences.length = 0;
|
||||
|
||||
assert.strictEqual(wb.externalReferences.length, 0, 'External reference length before add');
|
||||
wb.addExternalReferencesAfterParseFormulas(parseResult.externalReferenesNeedAdd);
|
||||
assert.strictEqual(wb.externalReferences.length, 1, 'External reference length after add');
|
||||
initDefinedName(wb.externalReferences[0], "Sheet1", "A1:A2", "_s1");
|
||||
|
||||
externalWs = createExternalWorksheet("Sheet1");
|
||||
externalWs.getRange2("A1").setValue("10");
|
||||
externalWs.getRange2("A2").setValue("20");
|
||||
|
||||
wb.externalReferences[0].updateData([externalWs]);
|
||||
// defNames.wb[this.Name].getRef();
|
||||
// wb.externalReferences[0].addDefName()
|
||||
|
||||
// local = false. Read/open file with formulas. Try to parse string to external ref similiar as read the file
|
||||
oParser = new parserFormula(fullLink, cellWithFormula, ws);
|
||||
assert.ok(oParser.parse(false/*isLocal*/, null, parseResult), "Full link. isLocal = false. " + fullLink);
|
||||
|
||||
oParser = new parserFormula(fullLinkDefname, cellWithFormula, ws);
|
||||
assert.ok(oParser.parse(false, null, parseResult), "Full link to defname. isLocal = false. " + fullLinkDefname);
|
||||
|
||||
oParser = new parserFormula(shortLink, cellWithFormula, ws);
|
||||
assert.ok(!oParser.parse(false, null, parseResult), "Short link. isLocal = false. " + shortLink);
|
||||
|
||||
oParser = new parserFormula(shortLinkDefname, cellWithFormula, ws);
|
||||
assert.ok(oParser.parse(false, null, parseResult), "Short link to defname. isLocal = false. " + shortLinkDefname);
|
||||
elemInStack = oParser.outStack && oParser.outStack[0];
|
||||
if (elemInStack && (elemInStack.type === AscCommonExcel.cElementType.name3D)) {
|
||||
assert.strictEqual(elemInStack.value, "_s1");
|
||||
assert.ok(elemInStack.ws);
|
||||
assert.strictEqual(elemInStack.ws && elemInStack.ws.sName, "Sheet1");
|
||||
}
|
||||
|
||||
oParser = new parserFormula("[1]!_s223", cellWithFormula, ws);
|
||||
assert.ok(oParser.parse(false, null, parseResult), "Short link to defname that not exist. isLocal = false. " + "[1]!_s223");
|
||||
elemInStack = oParser.outStack && oParser.outStack[0];
|
||||
if (elemInStack && (elemInStack.type === AscCommonExcel.cElementType.name3D)) {
|
||||
assert.strictEqual(elemInStack.value, "_s223");
|
||||
assert.ok(elemInStack.ws);
|
||||
assert.strictEqual(elemInStack.ws && elemInStack.ws.sName, "Sheet1");
|
||||
}
|
||||
|
||||
// inside the formula tests
|
||||
oParser = new parserFormula("SUM([1]!_s1)", cellWithFormula, ws);
|
||||
assert.ok(oParser.parse(false, null, parseResult), "SUM([1]!_s1). isLocal = false");
|
||||
|
||||
oParser = new parserFormula("SUM('[1]'!_s1)", cellWithFormula, ws);
|
||||
assert.ok(oParser.parse(false, null, parseResult) === false, "SUM('[1]'!_s1). isLocal = false");
|
||||
|
||||
oParser = new parserFormula("SUM([1]!_s1,2,3)", cellWithFormula, ws);
|
||||
assert.ok(oParser.parse(false, null, parseResult), "SUM([1]!_s1,2,3). isLocal = false");
|
||||
|
||||
oParser = new parserFormula("SUM('[1]'!_s1,2,3)", cellWithFormula, ws);
|
||||
assert.ok(oParser.parse(false, null, parseResult) === false, "SUM('[1]'!_s1,2,3). isLocal = false");
|
||||
|
||||
// for bug 72385. eR in file === [0]
|
||||
oParser = new parserFormula("[0]!_s1", cellWithFormula, ws);
|
||||
assert.ok(oParser.parse(false, null, parseResult) === false, "[0]!_s1. isLocal = false");
|
||||
|
||||
oParser = new parserFormula("SUM([0]!_s1,2,3,4)", cellWithFormula, ws);
|
||||
assert.ok(oParser.parse(false, null, parseResult) === false, "SUM([0]!_s1,2,3,4). isLocal = false");
|
||||
|
||||
// local = true. Manual input. Try parse string to external ref similiar as writing a string manually
|
||||
oParser = new parserFormula(fullLinkLocal, cellWithFormula, ws);
|
||||
assert.ok(oParser.parse(true/*isLocal*/, null, parseResult), "Full link. isLocal = true. " + fullLinkLocal);
|
||||
|
||||
oParser = new parserFormula(fullLinkDefnameLocal, cellWithFormula, ws);
|
||||
assert.ok(oParser.parse(true, null, parseResult), "Full link to defname. isLocal = true. " + fullLinkDefnameLocal);
|
||||
|
||||
oParser = new parserFormula(shortLinkLocal, cellWithFormula, ws);
|
||||
assert.ok(oParser.parse(true, null, parseResult) === false, "Short link. isLocal = true. " + shortLinkLocal);
|
||||
|
||||
oParser = new parserFormula(shortLinkDefnameLocal, cellWithFormula, ws);
|
||||
assert.ok(oParser.parse(true, null, parseResult) === false, "Short link to defname. isLocal = true. " + shortLinkDefnameLocal);
|
||||
|
||||
oParser = new parserFormula(shortLinkDefnameLocalWithoutBrackets, cellWithFormula, ws);
|
||||
assert.ok(oParser.parse(true, null, parseResult), "Short link to defname without brackets. isLocal = true. " + shortLinkDefnameLocalWithoutBrackets);
|
||||
|
||||
oParser = new parserFormula(shortLinkDefnameLocalWithoutBrackets2, cellWithFormula, ws);
|
||||
assert.ok(oParser.parse(true, null, parseResult), "Short link to defname without brackets and with single quotes. isLocal = true. " + shortLinkDefnameLocalWithoutBrackets2);
|
||||
|
||||
oParser = new parserFormula(shortLink, cellWithFormula, ws);
|
||||
assert.ok(oParser.parse(true, null, parseResult) === false, "Short link from file as local. isLocal = true. " + shortLink);
|
||||
|
||||
oParser = new parserFormula(shortLinkDefname, cellWithFormula, ws);
|
||||
assert.ok(oParser.parse(true, null, parseResult) === false, "Short link to defname from file as local. isLocal = true. " + shortLinkDefname);
|
||||
|
||||
oParser = new parserFormula(shortLinkDefname2, cellWithFormula, ws);
|
||||
assert.ok(oParser.parse(true, null, parseResult) === false, "Short link to defname with quotes from file as local. isLocal = true. " + shortLinkDefname2);
|
||||
|
||||
oParser = new parserFormula(shortLinkDefnameWithoutBrackets, cellWithFormula, ws);
|
||||
assert.ok(oParser.parse(true, null, parseResult), "Short link to defname with quotes & without brackets from file as local. isLocal = true. " + shortLinkDefnameWithoutBrackets);
|
||||
|
||||
oParser = new parserFormula("book(20).xlsx!_s1", cellWithFormula, ws);
|
||||
assert.ok(oParser.parse(true, null, parseResult) === false, "book(20).xlsx!_s1. isLocal = true");
|
||||
|
||||
oParser = new parserFormula("'book(20).xlsx'!_s1", cellWithFormula, ws);
|
||||
assert.ok(oParser.parse(true, null, parseResult), "'book(20).xlsx'!_s1. isLocal = true");
|
||||
|
||||
oParser = new parserFormula("123book(20).xlsx!_s1", cellWithFormula, ws);
|
||||
assert.ok(oParser.parse(true, null, parseResult) === false, "123book(20).xlsx!_s1. isLocal = true");
|
||||
|
||||
oParser = new parserFormula("'123book(20).xlsx'!_s1", cellWithFormula, ws);
|
||||
assert.ok(oParser.parse(true, null, parseResult), "'123book(20).xlsx'!_s1. isLocal = true");
|
||||
|
||||
// inside the formula tests
|
||||
oParser = new parserFormula("SUM(test.xlsx!_s1)", cellWithFormula, ws);
|
||||
assert.ok(oParser.parse(true, null, parseResult), "SUM(test.xlsx!_s1). isLocal = true");
|
||||
|
||||
oParser = new parserFormula("SUM('test.xlsx'!_s1)", cellWithFormula, ws);
|
||||
assert.ok(oParser.parse(true, null, parseResult), "SUM('test.xlsx'!_s1). isLocal = true");
|
||||
|
||||
oParser = new parserFormula("SUM(test.xlsx!_s1,2,3)", cellWithFormula, ws);
|
||||
assert.ok(oParser.parse(true, null, parseResult), "SUM(test.xlsx!_s1,2,3). isLocal = true");
|
||||
|
||||
oParser = new parserFormula("SUM('test.xlsx'!_s1,2,3)", cellWithFormula, ws);
|
||||
assert.ok(oParser.parse(true, null, parseResult), "SUM('test.xlsx'!_s1,2,3). isLocal = true");
|
||||
|
||||
oParser = new parserFormula("SUM(test(20).xlsx!_s1,2,3)", cellWithFormula, ws);
|
||||
assert.ok(oParser.parse(true, null, parseResult) === false, "SUM(test(20).xlsx!_s1,2,3). isLocal = true");
|
||||
|
||||
oParser = new parserFormula("SUM('test(20).xlsx'!_s1,2,3)", cellWithFormula, ws);
|
||||
assert.ok(oParser.parse(true, null, parseResult), "SUM('test(20).xlsx'!_s1,2,3). isLocal = true");
|
||||
|
||||
oParser = new parserFormula("SUM(123test(20).xlsx!_s1,2,3)", cellWithFormula, ws);
|
||||
assert.ok(oParser.parse(true, null, parseResult) === false, "SUM(123test(20).xlsx!_s1,2,3). isLocal = true");
|
||||
|
||||
oParser = new parserFormula("SUM('123test(20).xlsx'!_s1,2,3)", cellWithFormula, ws);
|
||||
assert.ok(oParser.parse(true, null, parseResult), "SUM('123test(20).xlsx'!_s1,2,3). isLocal = true");
|
||||
|
||||
// todo on the desktop, the file selection window opens three times, one after another
|
||||
oParser = new parserFormula("SUM(book.xlsx!_s1,book2.xlsx!_s2,book3.xlsx!_s3)", cellWithFormula, ws);
|
||||
assert.ok(oParser.parse(true, null, parseResult), "SUM(book.xlsx!_s1,book2.xlsx!_s2,book3.xlsx!_s3). isLocal = true");
|
||||
|
||||
oParser = new parserFormula("SUM('book.xlsx'!_s1,book2.xlsx!_s2,book3.xlsx!_s3)", cellWithFormula, ws);
|
||||
assert.ok(oParser.parse(true, null, parseResult), "SUM('book.xlsx'!_s1,book2.xlsx!_s2,book3.xlsx!_s3). isLocal = true");
|
||||
|
||||
oParser = new parserFormula("SUM('123test(20).xlsx'!_s1, 123test(20).xlsx!_s1)", cellWithFormula, ws);
|
||||
assert.ok(oParser.parse(true, null, parseResult) === false, "SUM('123test(20).xlsx'!_s1, 123test(20).xlsx!_s1). isLocal = true");
|
||||
|
||||
oParser = new parserFormula("SUM('123test(20).xlsx'!_s1, '123test(20).xlsx'!_s1)", cellWithFormula, ws);
|
||||
assert.ok(oParser.parse(true, null, parseResult), "SUM('123test(20).xlsx'!_s1, '123test(20).xlsx'!_s1). isLocal = true");
|
||||
|
||||
// clear er
|
||||
wb.externalReferences.length = 0;
|
||||
|
||||
/* create new eR with temporary ws, which will be deleted */
|
||||
cellWithFormula = new AscCommonExcel.CCellWithFormula(ws, 1, 0);
|
||||
parseResult = new AscCommonExcel.ParseResult([]);
|
||||
oParser = new parserFormula("'book.xlsx'!_s22", cellWithFormula, ws);
|
||||
assert.ok(oParser.parse(true, null, parseResult), "'book.xlsx'!_s22 - local short link with refernce to non existed defname");
|
||||
|
||||
assert.strictEqual(wb.externalReferences.length, 0, 'External reference length before add');
|
||||
wb.addExternalReferencesAfterParseFormulas(parseResult.externalReferenesNeedAdd);
|
||||
assert.strictEqual(wb.externalReferences.length, 1, 'External reference length after add');
|
||||
|
||||
let ER = wb.externalReferences[0];
|
||||
initDefinedName(ER, "book.xlsx", "A1:A2", "_s22", true);
|
||||
|
||||
externalWs = createExternalWorksheet("Sheet1");
|
||||
externalWs.getRange2("A1").setValue("10");
|
||||
externalWs.getRange2("A2").setValue("20");
|
||||
|
||||
let externalWb = ER.getWb();
|
||||
externalWb.insertWorksheet(0, externalWs);
|
||||
ER.addSheet(externalWs);
|
||||
|
||||
assert.strictEqual(ER.SheetNames.length, 2, "Amount of sheets before updateData");
|
||||
assert.strictEqual(ER.SheetDataSet.length, 2, "Amount of SheetDataSet before updateData");
|
||||
assert.strictEqual(ER.SheetDataSet[0].SheetId, 0, "SheetDataSet id before updateData");
|
||||
assert.strictEqual(ER.SheetDataSet[1].SheetId, 1, "SheetDataSet id before updateData");
|
||||
|
||||
ER.updateData([externalWs], null, null, wb);
|
||||
|
||||
assert.strictEqual(ER.SheetNames.length, 1, "Amount of sheets after updateData `received` data");
|
||||
assert.strictEqual(ER.SheetDataSet.length, 1, "Amount of SheetDataSet after updateData `received` data");
|
||||
assert.strictEqual(ER.SheetDataSet[0].SheetId, 0, "SheetDataSet id after updateData and shift id's");
|
||||
|
||||
//remove external reference
|
||||
wb.removeExternalReferences([wb.externalReferences[0].getAscLink()]);
|
||||
assert.strictEqual(wb.externalReferences.length, 0);
|
||||
});
|
||||
|
||||
// Mocks for API Testing
|
||||
Asc.spreadsheet_api.prototype._init = function () {
|
||||
this._loadModules();
|
||||
|
||||
@ -1662,7 +1662,7 @@ $(function () {
|
||||
bCaFromSelectedCell = getCaFromSelectedCell("B1068");
|
||||
assert.strictEqual(bCaFromSelectedCell, true, "Test: IFS. 6 args. Recursion formula. One of condition is recursion but it matches. B1068 - flag ca: true");
|
||||
bCaFromSelectedCell = null;
|
||||
// Case: SWITCH. Without default_arg. One of result_arg has recursion, but it doesn't match. With disabled Iterative calculation setting.
|
||||
// - Case: SWITCH. Without default_arg. One of result_arg has recursion, but it doesn't match. With disabled Iterative calculation setting.
|
||||
// expression
|
||||
ws.getRange2("A1069").setValue("3");
|
||||
// values
|
||||
@ -1682,14 +1682,14 @@ $(function () {
|
||||
bCaFromSelectedCell = getCaFromSelectedCell("A1072");
|
||||
assert.strictEqual(bCaFromSelectedCell, false, "Test: SWITCH. Without default_arg. One of result_arg has recursion but it doesn't matches. A1072 - flag ca: false");
|
||||
bCaFromSelectedCell = null;
|
||||
// Case: SWITCH. Without default_arg. One of result_arg has recursion, but it matches. With disabled Iterative calculation setting.
|
||||
// - Case: SWITCH. Without default_arg. One of result_arg has recursion, but it matches. With disabled Iterative calculation setting.
|
||||
ws.getRange2("A1069").setValue("2");
|
||||
ws.getRange2("A1072").setValue("=SWITCH(A1069,A1070, A1071, B1070, A1072, C1070, B1071, D1070, C1071, E1070, D1071)");
|
||||
assert.strictEqual(ws.getRange2("A1072").getValue(), "0", "Test: SWITCH. Without default_arg. One of result_arg has recursion but it matches. A1072 - 0");
|
||||
bCaFromSelectedCell = getCaFromSelectedCell("A1072");
|
||||
assert.strictEqual(bCaFromSelectedCell, true, "Test: SWITCH. Without default_arg. One of result_arg has recursion but it matches. A1072 - flag ca: true");
|
||||
bCaFromSelectedCell = null;
|
||||
// Case: SWITCH. With default_arg. Default_arg has recursion, but it doesn't match. With disabled Iterative calculation setting.
|
||||
// - Case: SWITCH. With default_arg. Default_arg has recursion, but it doesn't match. With disabled Iterative calculation setting.
|
||||
ws.getRange2("A1069").setValue("7");
|
||||
// default_arg
|
||||
ws.getRange2("E1071").setValue("Unknown day of week");
|
||||
@ -1698,18 +1698,60 @@ $(function () {
|
||||
bCaFromSelectedCell = getCaFromSelectedCell("A1072");
|
||||
assert.strictEqual(bCaFromSelectedCell, false, "Test: SWITCH. With default_arg. Default_arg has recursion but it doesn't matches. A1072 - flag ca: false");
|
||||
bCaFromSelectedCell = null;
|
||||
// Case: SWITCH. With default_arg. Default_arg has recursion, but it matches. With disabled Iterative calculation setting.
|
||||
// - Case: SWITCH. With default_arg. Default_arg has recursion, but it matches. With disabled Iterative calculation setting.
|
||||
ws.getRange2("A1072").setValue("=SWITCH(A1069,A1070, A1071, B1070, A1072, C1070, B1071, D1070, C1071, E1070, D1071, A1072)");
|
||||
assert.strictEqual(ws.getRange2("A1072").getValue(), "0", "Test: SWITCH. With default_arg. Default_arg has recursion but it matches. A1072 - 0");
|
||||
bCaFromSelectedCell = getCaFromSelectedCell("A1072");
|
||||
assert.strictEqual(bCaFromSelectedCell, true, "Test: SWITCH. With default_arg. Default_arg has recursion but it matches. A1072 - flag ca: true");
|
||||
bCaFromSelectedCell = null;
|
||||
// Case: Exception formula "CELL" that ignores rules of recursion recognition
|
||||
// - Case: Exception formula "CELL" that ignores rules of recursion recognition
|
||||
ws.getRange2("A1073").setValue("=CELL(\"filename\",A1073)");
|
||||
assert.strictEqual(ws.getRange2("A1073").getValue(), "[TeSt.xlsx]Sheet1", "Test: Exception formulas that ignores rules of recursion recognition. A1073 - 1039. Formula - CELL");
|
||||
bCaFromSelectedCell = getCaFromSelectedCell("A1073");
|
||||
assert.strictEqual(bCaFromSelectedCell, true, "Test: Exception formulas that ignores rules of recursion recognition. A1039 - flag ca: true");
|
||||
bCaFromSelectedCell = null;
|
||||
// - Case: Chain without recursion. B1074 <- A1075 <- D1075 <- E1075 <- F1075. With disabled Iterative calculation setting. Case from bug-71996
|
||||
// year field
|
||||
ws.getRange2("A1074").setValue("2024");
|
||||
// month field
|
||||
ws.getRange2("B1074").setValue("=DATE(A1074, SHEET(),1");
|
||||
// time break
|
||||
ws.getRange2("C1074").setValue("0.02");
|
||||
ws.getRange2("D1074").setValue("0.03");
|
||||
ws.getRange2("E1074").setValue("0.33");
|
||||
// additional field
|
||||
ws.getRange2("F1074").setValue("=IF(MONTH(B1074)=1;$G$1074;INDIRECT(TEXT(DATE(YEAR(B1074);MONTH(B1074)-1;1);\"MMM\") & \"!F39\"))");
|
||||
ws.getRange2("G1074").setValue("0");
|
||||
// main chain
|
||||
ws.getRange2("A1075").setValue("=B1074");
|
||||
ws.getRange2("B1075").setValue("0");
|
||||
ws.getRange2("C1075").setValue("0");
|
||||
ws.getRange2("D1075").setValue("=IF(ISNUMBER($A1075);IF((C1075-B1075)<TIME(6;1;0);TIME(0;0;0);IF((C1075-B1075)<TIME(9;31;0);$C$1074;$D$1074));\"\")");
|
||||
ws.getRange2("E1075").setValue("=IF(ISNUMBER($A1075);IF(OR(G1075=\"U\";H1075=\"X\");(C1075-B1075-D1075);IF(OR(G1075=\"K\";G1075=\"B\";G1075=\"D\");TIME(0;0;0);C1075-B1075-D1075-$E$1074));\"\")");
|
||||
ws.getRange2("F1075").setValue("==IF(ISNUMBER($A1075);IF(OR(G1075=\"Zaus\";E1075>-$E$1074;G1075=\"kA\");(F1074+E1075);TIME(0;0;0));\"\")");
|
||||
ws.getRange2("G1075").setValue("Neujahr");
|
||||
ws.getRange2("H1075").setValue("X");
|
||||
// Checking via initStartCellForIterCalc method that cells haven't recursion
|
||||
oCell = selectCell("A1075");
|
||||
let bCellHasRecursion = !!getStartCellForIterCalc(oCell);
|
||||
assert.strictEqual(bCellHasRecursion, false, "Test: Chain without recursion. B1074 <- A1075 <- D1075 <- E1075 <- F1075. With disabled Iterative calculation setting. Case from bug-71996. A1075 - false");
|
||||
bCellHasRecursion = null;
|
||||
g_cCalcRecursion.setStartCellIndex(null);
|
||||
oCell = selectCell("D1075");
|
||||
bCellHasRecursion = !!getStartCellForIterCalc(oCell);
|
||||
assert.strictEqual(bCellHasRecursion, false, "Test: Chain without recursion. B1074 <- A1075 <- D1075 <- E1075 <- F1075. With disabled Iterative calculation setting. Case from bug-71996. D1075 - false");
|
||||
bCellHasRecursion = null;
|
||||
g_cCalcRecursion.setStartCellIndex(null);
|
||||
oCell = selectCell("E1075");
|
||||
bCellHasRecursion = !!getStartCellForIterCalc(oCell);
|
||||
assert.strictEqual(bCellHasRecursion, false, "Test: Chain without recursion. B1074 <- A1075 <- D1075 <- E1075 <- F1075. With disabled Iterative calculation setting. Case from bug-71996. E1075 - false");
|
||||
bCellHasRecursion = null;
|
||||
g_cCalcRecursion.setStartCellIndex(null);
|
||||
oCell = selectCell("F1075");
|
||||
bCellHasRecursion = !!getStartCellForIterCalc(oCell);
|
||||
assert.strictEqual(bCellHasRecursion, false, "Test: Chain without recursion. B1074 <- A1075 <- D1075 <- E1075 <- F1075. With disabled Iterative calculation setting. Case from bug-71996. F1075 - false");
|
||||
bCellHasRecursion = null;
|
||||
g_cCalcRecursion.setStartCellIndex(null);
|
||||
// -- Test changeLinkedCell method.
|
||||
oCell = selectCell("A1000");
|
||||
let oCellNeedEnableRecalc = selectCell("B1000");
|
||||
|
||||
@ -76,7 +76,9 @@ const allTests = [
|
||||
'slide/shortcuts/shortcuts.html',
|
||||
'word/shortcuts/shortcuts.html',
|
||||
|
||||
'oform/xml/oformXml.html'
|
||||
// related ooxml tests
|
||||
'oform/xml/oformXml.html',
|
||||
'word/custom-xml/custom-xml-ooxml.html',
|
||||
];
|
||||
|
||||
const maxTestsAtOnce = require('events').defaultMaxListeners;
|
||||
|
||||
317
tests/word/custom-xml/custom-xml-common.js
Normal file
317
tests/word/custom-xml/custom-xml-common.js
Normal file
File diff suppressed because one or more lines are too long
36
tests/word/custom-xml/custom-xml-ooxml.html
Normal file
36
tests/word/custom-xml/custom-xml-ooxml.html
Normal file
@ -0,0 +1,36 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
|
||||
<title>Document calculation tests</title>
|
||||
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
||||
<link type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/qunit/2.16.0/qunit.css" rel="stylesheet" media="screen" />
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/qunit/2.16.0/qunit.js"></script>
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/xregexp/3.2.0/xregexp-all.min.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../../../develop/sdkjs/word/scripts.js"></script>
|
||||
<script type="text/javascript">
|
||||
window.sdk_scripts.forEach(function(item){
|
||||
document.write('<script type="text/javascript" src="' + item + '"><\/script>');
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" src="../common/common.js"></script>
|
||||
<script type="text/javascript" src="../common/editor.js"></script>
|
||||
<script type="text/javascript" src="../common/document.js"></script>
|
||||
<script type="text/javascript" src="../common/measurer.js"></script>
|
||||
|
||||
<script type="text/javascript" src="custom-xml-common.js"></script>
|
||||
<script type="text/javascript" src="custom-xml-ooxml.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="qunit-header">Test forms</h1>
|
||||
<h2 id="qunit-banner"></h2>
|
||||
<div id="qunit-testrunner-toolbar"></div>
|
||||
<h2 id="qunit-userAgent"></h2>
|
||||
<ol id="qunit-tests"></ol>
|
||||
<div id="qunit-fixture">test markup, will be hidden</div>
|
||||
</body>
|
||||
</html>
|
||||
70
tests/word/custom-xml/custom-xml-ooxml.js
Normal file
70
tests/word/custom-xml/custom-xml-ooxml.js
Normal file
File diff suppressed because one or more lines are too long
@ -22,6 +22,7 @@
|
||||
<script type="text/javascript" src="../common/document.js"></script>
|
||||
<script type="text/javascript" src="../common/measurer.js"></script>
|
||||
|
||||
<script type="text/javascript" src="custom-xml-common.js"></script>
|
||||
<script type="text/javascript" src="custom-xml.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -970,6 +970,7 @@ $(function () {
|
||||
Test("\\int _(x+1)\\of 1/2 ", [["ParaRun", ""], ["CNary", "∫_(x+1)▒〖1/2〗"], ["ParaRun", ""]], false, "Check large operators");
|
||||
Test("\\prod ^(x+1)\\of 1/2 ", [["ParaRun", ""], ["CNary", "∏^(x+1)▒〖1/2〗"], ["ParaRun", ""]],false, "Check large operators");
|
||||
Test("∫^(x+1)_(1_i)\\of 1/2 ", [["ParaRun", ""], ["CNary", "∫_(1_i)^(x+1)▒〖1/2〗"], ["ParaRun", ""]], false, "Check large operators");
|
||||
Test("∑_(k=0)^n▒〖(n¦k) a^k b^(n-k)〗 ", [["ParaRun", ""], ["CNary", "∑_(k=0)^n▒〖(n¦k) a^k b^(n-k)〗"], ["ParaRun", " "]], false, "Check add space after nary");
|
||||
})
|
||||
|
||||
QUnit.module( "Functions", function ()
|
||||
|
||||
@ -1322,8 +1322,10 @@
|
||||
TurnOnRecalculate();
|
||||
ClearDocumentAndAddParagraph('');
|
||||
const complexForm = AddComplexForm();
|
||||
AscTest.Recalculate();
|
||||
assert.strictEqual(complexForm.GetLinesCount(), 1, "Check line count before adding line break");
|
||||
ExecuteHotkey(testHotkeyActions.addBreakLineInlineLvlSdt);
|
||||
assert.strictEqual(complexForm.Lines[0], 2, "Check add break line");
|
||||
assert.strictEqual(complexForm.GetLinesCount(), 2, "Check line count after adding line break");
|
||||
TurnOffRecalculate();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user