snapshot of https://github.com/dream-num/univer.git (dev, 2026-09-16; blobs > 131072B omitted)
Some checks failed
📦 Build / build (push) Has been cancelled
🧪 CI Test / test shard (1/4) (push) Has been cancelled
🧪 CI Test / test shard (2/4) (push) Has been cancelled
🧪 CI Test / test shard (3/4) (push) Has been cancelled
🧪 CI Test / test shard (4/4) (push) Has been cancelled
🧪 CI Test / test (push) Has been cancelled
🧪 CI Test / eslint (push) Has been cancelled
🧪 CI Test / typecheck (push) Has been cancelled
🔫 Sync to Pro / dispatch-sync (push) Has been cancelled
🔮 Sync Mirror / sync (push) Has been cancelled

This commit is contained in:
upstream-mirror
2026-09-16 05:09:45 +05:00
commit bcf6ef63ad
7118 changed files with 1236854 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
# formula-integration-test
This is a test repository for the formula integration feature.

View File

@@ -0,0 +1,24 @@
{
"name": "formula-integration-test",
"private": true,
"author": "DreamNum <developer@univer.ai>",
"license": "Apache-2.0",
"scripts": {
"test": "vitest run",
"test:watch": "vitest",
"coverage": "vitest run --coverage",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@univerjs/core": "workspace:*",
"@univerjs/engine-formula": "workspace:*",
"@univerjs/sheets": "workspace:*",
"@univerjs/sheets-filter": "workspace:*",
"@univerjs/sheets-formula": "workspace:*"
},
"devDependencies": {
"@univerjs-infra/shared": "workspace:*",
"typescript": "^6.0.3",
"vitest": "^5.0.0"
}
}

View File

@@ -0,0 +1,124 @@
{
"id": "-23yFfY3SZ2pr9nPYERZXg",
"sheetOrder": [
"4FDtSTxrsa_03719b8_jm"
],
"name": "New Sheet",
"appVersion": "1",
"locale": "enUS",
"styles": {
"1l4gGD": {
"ff": "Arial",
"fs": 11
}
},
"sheets": {
"4FDtSTxrsa_03719b8_jm": {
"id": "4FDtSTxrsa_03719b8_jm",
"name": "Sheet1",
"rowCount": 1000,
"columnCount": 20,
"freeze": {
"xSplit": 0,
"ySplit": 0,
"startRow": -1,
"startColumn": -1
},
"hidden": 0,
"rowData": {
"0": {
"ah": 24
},
"1": {
"ah": 24
}
},
"tabColor": "",
"mergeData": [],
"rowHeader": {
"width": 46,
"hidden": 0
},
"scrollTop": 200,
"zoomRatio": 1,
"columnData": {},
"scrollLeft": 100,
"rightToLeft": 0,
"columnHeader": {
"height": 20,
"hidden": 0
},
"showGridlines": 1,
"defaultRowHeight": 24,
"defaultColumnWidth": 88,
"cellData": {
"0": {
"0": {
"v": 1,
"t": 2,
"s": "1l4gGD"
},
"1": {
"f": "=SUM(A1:A2)",
"t": 2,
"v": 3
}
},
"1": {
"0": {
"v": 2,
"t": 2,
"s": "1l4gGD"
}
}
}
}
},
"resources": [
{
"name": "SHEET_UNIVER_THREAD_COMMENT_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_RANGE_PROTECTION_PLUGIN",
"data": ""
},
{
"data": "{}",
"name": "SHEET_AuthzIoMockService_PLUGIN"
},
{
"name": "SHEET_WORKSHEET_PROTECTION_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_WORKSHEET_PROTECTION_POINT_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_CONDITIONAL_FORMATTING_PLUGIN",
"data": ""
},
{
"name": "SHEET_DRAWING_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_DEFINED_NAME_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_RANGE_THEME_MODEL_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_DATA_VALIDATION_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_FILTER_PLUGIN",
"data": "{}"
}
],
"rev": 4
}

View File

@@ -0,0 +1,123 @@
{
"id": "-23yFfY3SZ2pr9nPYERZXg",
"sheetOrder": [
"4FDtSTxrsa_03719b8_jm"
],
"name": "New Sheet",
"appVersion": "1",
"locale": "enUS",
"styles": {
"1l4gGD": {
"ff": "Arial",
"fs": 11
}
},
"sheets": {
"4FDtSTxrsa_03719b8_jm": {
"id": "4FDtSTxrsa_03719b8_jm",
"name": "Sheet1",
"rowCount": 1000,
"columnCount": 20,
"freeze": {
"xSplit": 0,
"ySplit": 0,
"startRow": -1,
"startColumn": -1
},
"hidden": 0,
"rowData": {
"0": {
"ah": 24
},
"1": {
"ah": 24
}
},
"tabColor": "",
"mergeData": [],
"rowHeader": {
"width": 46,
"hidden": 0
},
"scrollTop": 200,
"zoomRatio": 1,
"columnData": {},
"scrollLeft": 100,
"rightToLeft": 0,
"columnHeader": {
"height": 20,
"hidden": 0
},
"showGridlines": 1,
"defaultRowHeight": 24,
"defaultColumnWidth": 88,
"cellData": {
"0": {
"0": {
"v": 1,
"t": 2,
"s": "1l4gGD"
},
"1": {
"f": "=SUM(A1:A2)",
"t": 2
}
},
"1": {
"0": {
"v": 2,
"t": 2,
"s": "1l4gGD"
}
}
}
}
},
"resources": [
{
"name": "SHEET_UNIVER_THREAD_COMMENT_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_RANGE_PROTECTION_PLUGIN",
"data": ""
},
{
"data": "{}",
"name": "SHEET_AuthzIoMockService_PLUGIN"
},
{
"name": "SHEET_WORKSHEET_PROTECTION_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_WORKSHEET_PROTECTION_POINT_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_CONDITIONAL_FORMATTING_PLUGIN",
"data": ""
},
{
"name": "SHEET_DRAWING_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_CHART_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_DEFINED_NAME_PLUGIN",
"data": ""
},
{
"name": "SHEET_DATA_VALIDATION_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_FILTER_PLUGIN",
"data": "{}"
}
],
"rev": 4
}

View File

@@ -0,0 +1,109 @@
{
"id": "Czx9Y5",
"sheetOrder": [
"lXnRfcI9sd18sz0D_6OmT"
],
"name": "",
"appVersion": "0.8.1",
"locale": "zhCN",
"styles": {},
"sheets": {
"lXnRfcI9sd18sz0D_6OmT": {
"id": "lXnRfcI9sd18sz0D_6OmT",
"name": "Sheet1",
"tabColor": "",
"hidden": 0,
"rowCount": 1000,
"columnCount": 20,
"zoomRatio": 1,
"freeze": {
"xSplit": 0,
"ySplit": 0,
"startRow": -1,
"startColumn": -1
},
"scrollTop": 0,
"scrollLeft": 0,
"defaultColumnWidth": 88,
"defaultRowHeight": 24,
"mergeData": [],
"cellData": {
"3": {
"2": {
"v": 1,
"t": 2
}
},
"4": {
"2": {
"v": 2,
"t": 2
}
},
"5": {
"2": {
"v": 3,
"t": 2
},
"3": {
"f": "=C6",
"v": 3,
"t": 2
}
},
"12": {
"6": {
"f": "=C4",
"v": 1,
"t": 2
}
},
"13": {
"6": {
"f": "=C5",
"v": 2,
"t": 2
}
}
},
"rowData": {},
"columnData": {},
"showGridlines": 1,
"rowHeader": {
"width": 46,
"hidden": 0
},
"columnHeader": {
"height": 20,
"hidden": 0
},
"rightToLeft": 0
}
},
"resources": [
{
"name": "SHEET_RANGE_PROTECTION_PLUGIN",
"data": ""
},
{
"name": "SHEET_AuthzIoMockService_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_WORKSHEET_PROTECTION_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_WORKSHEET_PROTECTION_POINT_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_DEFINED_NAME_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_RANGE_THEME_MODEL_PLUGIN",
"data": "{}"
}
]
}

View File

@@ -0,0 +1,105 @@
{
"id": "Czx9Y5",
"sheetOrder": [
"lXnRfcI9sd18sz0D_6OmT"
],
"name": "",
"appVersion": "0.8.1",
"locale": "zhCN",
"styles": {},
"sheets": {
"lXnRfcI9sd18sz0D_6OmT": {
"id": "lXnRfcI9sd18sz0D_6OmT",
"name": "Sheet1",
"tabColor": "",
"hidden": 0,
"rowCount": 1000,
"columnCount": 20,
"zoomRatio": 1,
"freeze": {
"xSplit": 0,
"ySplit": 0,
"startRow": -1,
"startColumn": -1
},
"scrollTop": 0,
"scrollLeft": 0,
"defaultColumnWidth": 88,
"defaultRowHeight": 24,
"mergeData": [],
"cellData": {
"3": {
"2": {
"v": 1,
"t": 2
},
"3": {
"f": "=C4",
"v": 1,
"t": 2
}
},
"4": {
"2": {
"v": 2,
"t": 2
},
"3": {
"f": "=C5",
"v": 2,
"t": 2
}
},
"5": {
"2": {
"v": 3,
"t": 2
},
"3": {
"f": "=C6",
"v": 3,
"t": 2
}
}
},
"rowData": {},
"columnData": {},
"showGridlines": 1,
"rowHeader": {
"width": 46,
"hidden": 0
},
"columnHeader": {
"height": 20,
"hidden": 0
},
"rightToLeft": 0
}
},
"resources": [
{
"name": "SHEET_RANGE_PROTECTION_PLUGIN",
"data": ""
},
{
"name": "SHEET_AuthzIoMockService_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_WORKSHEET_PROTECTION_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_WORKSHEET_PROTECTION_POINT_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_DEFINED_NAME_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_RANGE_THEME_MODEL_PLUGIN",
"data": "{}"
}
]
}

View File

@@ -0,0 +1,105 @@
{
"id": "wcKMFW",
"sheetOrder": [
"XkNPQsSrdwlQrVOFgt9FM"
],
"name": "",
"appVersion": "0.8.1",
"locale": "zhCN",
"styles": {},
"sheets": {
"XkNPQsSrdwlQrVOFgt9FM": {
"id": "XkNPQsSrdwlQrVOFgt9FM",
"name": "Sheet1",
"tabColor": "",
"hidden": 0,
"rowCount": 1000,
"columnCount": 20,
"zoomRatio": 1,
"freeze": {
"xSplit": 0,
"ySplit": 0,
"startRow": -1,
"startColumn": -1
},
"scrollTop": 0,
"scrollLeft": 0,
"defaultColumnWidth": 88,
"defaultRowHeight": 24,
"mergeData": [],
"cellData": {
"2": {
"2": {
"v": 2,
"t": 2
},
"3": {
"f": "=C3",
"v": 2,
"t": 2
}
},
"3": {
"2": {
"v": 1,
"t": 2
},
"3": {
"f": "=C4",
"v": 1,
"t": 2
}
},
"4": {
"2": {
"v": 3,
"t": 2
},
"3": {
"f": "=C5",
"v": 3,
"t": 2
}
}
},
"rowData": {},
"columnData": {},
"showGridlines": 1,
"rowHeader": {
"width": 46,
"hidden": 0
},
"columnHeader": {
"height": 20,
"hidden": 0
},
"rightToLeft": 0
}
},
"resources": [
{
"name": "SHEET_RANGE_PROTECTION_PLUGIN",
"data": ""
},
{
"name": "SHEET_AuthzIoMockService_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_WORKSHEET_PROTECTION_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_WORKSHEET_PROTECTION_POINT_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_DEFINED_NAME_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_RANGE_THEME_MODEL_PLUGIN",
"data": "{}"
}
]
}

View File

@@ -0,0 +1,105 @@
{
"id": "wcKMFW",
"sheetOrder": [
"XkNPQsSrdwlQrVOFgt9FM"
],
"name": "",
"appVersion": "0.8.1",
"locale": "zhCN",
"styles": {},
"sheets": {
"XkNPQsSrdwlQrVOFgt9FM": {
"id": "XkNPQsSrdwlQrVOFgt9FM",
"name": "Sheet1",
"tabColor": "",
"hidden": 0,
"rowCount": 1000,
"columnCount": 20,
"zoomRatio": 1,
"freeze": {
"xSplit": 0,
"ySplit": 0,
"startRow": -1,
"startColumn": -1
},
"scrollTop": 0,
"scrollLeft": 0,
"defaultColumnWidth": 88,
"defaultRowHeight": 24,
"mergeData": [],
"cellData": {
"2": {
"2": {
"v": 1,
"t": 2
},
"3": {
"f": "=C3",
"v": 1,
"t": 2
}
},
"3": {
"2": {
"v": 2,
"t": 2
},
"3": {
"f": "=C4",
"v": 2,
"t": 2
}
},
"4": {
"2": {
"v": 3,
"t": 2
},
"3": {
"f": "=C5",
"v": 3,
"t": 2
}
}
},
"rowData": {},
"columnData": {},
"showGridlines": 1,
"rowHeader": {
"width": 46,
"hidden": 0
},
"columnHeader": {
"height": 20,
"hidden": 0
},
"rightToLeft": 0
}
},
"resources": [
{
"name": "SHEET_RANGE_PROTECTION_PLUGIN",
"data": ""
},
{
"name": "SHEET_AuthzIoMockService_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_WORKSHEET_PROTECTION_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_WORKSHEET_PROTECTION_POINT_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_DEFINED_NAME_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_RANGE_THEME_MODEL_PLUGIN",
"data": "{}"
}
]
}

View File

@@ -0,0 +1,105 @@
{
"id": "Opu_sb",
"sheetOrder": [
"AmvABRJl7VeVXpMk7Hq6_"
],
"name": "",
"appVersion": "0.10.5",
"locale": "zhCN",
"styles": {},
"sheets": {
"AmvABRJl7VeVXpMk7Hq6_": {
"id": "AmvABRJl7VeVXpMk7Hq6_",
"name": "Sheet1",
"tabColor": "",
"hidden": 0,
"rowCount": 1000,
"columnCount": 20,
"zoomRatio": 1,
"freeze": {
"xSplit": 0,
"ySplit": 0,
"startRow": -1,
"startColumn": -1
},
"scrollTop": 0,
"scrollLeft": 0,
"defaultColumnWidth": 88,
"defaultRowHeight": 24,
"mergeData": [],
"cellData": {
"2": {
"2": {
"v": 2,
"t": 2
},
"3": {
"f": "=C3",
"v": 2,
"t": 2
}
},
"3": {
"2": {
"v": 1,
"t": 2
},
"3": {
"f": "=C4",
"v": 1,
"t": 2
}
},
"4": {
"2": {
"v": 3,
"t": 2
},
"3": {
"f": "=C5",
"v": 3,
"t": 2
}
}
},
"rowData": {},
"columnData": {},
"showGridlines": 1,
"rowHeader": {
"width": 46,
"hidden": 0
},
"columnHeader": {
"height": 20,
"hidden": 0
},
"rightToLeft": 0
}
},
"resources": [
{
"name": "SHEET_RANGE_PROTECTION_PLUGIN",
"data": ""
},
{
"name": "SHEET_AuthzIoMockService_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_WORKSHEET_PROTECTION_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_WORKSHEET_PROTECTION_POINT_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_DEFINED_NAME_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_RANGE_THEME_MODEL_PLUGIN",
"data": "{}"
}
]
}

View File

@@ -0,0 +1,106 @@
{
"id": "Opu_sb",
"sheetOrder": [
"AmvABRJl7VeVXpMk7Hq6_"
],
"name": "",
"appVersion": "0.10.5",
"locale": "zhCN",
"styles": {},
"sheets": {
"AmvABRJl7VeVXpMk7Hq6_": {
"id": "AmvABRJl7VeVXpMk7Hq6_",
"name": "Sheet1",
"tabColor": "",
"hidden": 0,
"rowCount": 1000,
"columnCount": 20,
"zoomRatio": 1,
"freeze": {
"xSplit": 0,
"ySplit": 0,
"startRow": -1,
"startColumn": -1
},
"scrollTop": 0,
"scrollLeft": 0,
"defaultColumnWidth": 88,
"defaultRowHeight": 24,
"mergeData": [],
"cellData": {
"2": {
"2": {
"v": 1,
"t": 2
},
"3": {
"f": "=C3",
"v": 1,
"t": 2
}
},
"3": {
"2": {
"v": 2,
"t": 2
},
"3": {
"si": "v8h2ot",
"f": "=C4",
"v": 2,
"t": 2
}
},
"4": {
"2": {
"v": 3,
"t": 2
},
"3": {
"si": "v8h2ot",
"v": 3,
"t": 2
}
}
},
"rowData": {},
"columnData": {},
"showGridlines": 1,
"rowHeader": {
"width": 46,
"hidden": 0
},
"columnHeader": {
"height": 20,
"hidden": 0
},
"rightToLeft": 0
}
},
"resources": [
{
"name": "SHEET_RANGE_PROTECTION_PLUGIN",
"data": ""
},
{
"name": "SHEET_AuthzIoMockService_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_WORKSHEET_PROTECTION_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_WORKSHEET_PROTECTION_POINT_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_DEFINED_NAME_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_RANGE_THEME_MODEL_PLUGIN",
"data": "{}"
}
]
}

View File

@@ -0,0 +1,327 @@
{
"id": "YoRIim",
"sheetOrder": [
"_P52izs4-QQtg1AbFSjwH"
],
"name": "",
"appVersion": "0.8.1",
"locale": "zhCN",
"styles": {},
"sheets": {
"_P52izs4-QQtg1AbFSjwH": {
"id": "_P52izs4-QQtg1AbFSjwH",
"name": "Sheet1",
"tabColor": "",
"hidden": 0,
"rowCount": 998,
"columnCount": 20,
"zoomRatio": 1,
"freeze": {
"xSplit": 0,
"ySplit": 0,
"startRow": -1,
"startColumn": -1
},
"scrollTop": 0,
"scrollLeft": 0,
"defaultColumnWidth": 88,
"defaultRowHeight": 24,
"mergeData": [],
"cellData": {
"0": {
"0": {
"v": 1,
"t": 2
},
"1": {
"v": 2,
"t": 2
},
"2": {
"v": 3,
"t": 2
},
"3": {
"v": 4,
"t": 2
},
"4": {
"v": 5,
"t": 2
},
"5": {
"v": 6,
"t": 2
},
"6": {
"v": 7,
"t": 2
}
},
"1": {
"0": {
"v": 3,
"t": 2
},
"1": {
"v": 4,
"t": 2
},
"2": {
"v": 5,
"t": 2
},
"3": {
"v": 6,
"t": 2
},
"4": {
"v": 7,
"t": 2
},
"5": {
"v": 8,
"t": 2
},
"6": {
"v": 9,
"t": 2
}
},
"2": {
"0": {
"v": 4,
"t": 2
},
"1": {
"v": 5,
"t": 2
},
"2": {
"v": 6,
"t": 2
},
"3": {
"v": 7,
"t": 2
},
"4": {
"v": 8,
"t": 2
},
"5": {
"v": 9,
"t": 2
},
"6": {
"v": 10,
"t": 2
}
},
"3": {
"0": {
"v": 6,
"t": 2
},
"1": {
"v": 7,
"t": 2
},
"2": {
"v": 8,
"t": 2
},
"3": {
"v": 9,
"t": 2
},
"4": {
"v": 10,
"t": 2
},
"5": {
"v": 11,
"t": 2
},
"6": {
"v": 12,
"t": 2
}
},
"4": {
"0": {
"v": 7,
"t": 2
},
"1": {
"v": 8,
"t": 2
},
"2": {
"v": 9,
"t": 2
},
"3": {
"v": 10,
"t": 2
},
"4": {
"v": 11,
"t": 2
},
"5": {
"v": 12,
"t": 2
},
"6": {
"v": 13,
"t": 2
}
},
"5": {
"0": {
"v": 8,
"t": 2
},
"1": {
"v": 9,
"t": 2
},
"2": {
"v": 10,
"t": 2
},
"3": {
"v": 11,
"t": 2
},
"4": {
"v": 12,
"t": 2
},
"5": {
"v": 13,
"t": 2
},
"6": {
"v": 14,
"t": 2
}
},
"6": {
"0": {
"v": 9,
"t": 2
},
"1": {
"v": 10,
"t": 2
},
"2": {
"v": 11,
"t": 2
},
"3": {
"v": 12,
"t": 2
},
"4": {
"v": 13,
"t": 2
},
"5": {
"v": 14,
"t": 2
},
"6": {
"v": 15,
"t": 2
}
},
"7": {
"0": {
"v": 10,
"t": 2
},
"1": {
"v": 11,
"t": 2
},
"2": {
"v": 12,
"t": 2
},
"3": {
"v": 13,
"t": 2
},
"4": {
"v": 14,
"t": 2
},
"5": {
"v": 15,
"t": 2
},
"6": {
"v": 16,
"t": 2
}
},
"9": {
"1": {
"f": "=SUM(B8)",
"v": 11,
"t": 2
}
}
},
"rowData": {},
"columnData": {
"5": {
"hd": 1
}
},
"showGridlines": 1,
"rowHeader": {
"width": 46,
"hidden": 0
},
"columnHeader": {
"height": 20,
"hidden": 0
},
"rightToLeft": 0
}
},
"resources": [
{
"name": "SHEET_RANGE_PROTECTION_PLUGIN",
"data": ""
},
{
"name": "SHEET_AuthzIoMockService_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_WORKSHEET_PROTECTION_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_WORKSHEET_PROTECTION_POINT_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_DEFINED_NAME_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_RANGE_THEME_MODEL_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_FILTER_PLUGIN",
"data": "{\"_P52izs4-QQtg1AbFSjwH\":{\"ref\":{\"startRow\":0,\"startColumn\":0,\"endRow\":3,\"endColumn\":6,\"rangeType\":0},\"filterColumns\":[{\"colId\":3,\"filters\":{\"filters\":[\"5\",\"8\",\"9\"]}}],\"cachedFilteredOut\":[1,2]}}"
}
]
}

View File

@@ -0,0 +1,387 @@
{
"id": "YoRIim",
"sheetOrder": [
"_P52izs4-QQtg1AbFSjwH"
],
"name": "",
"appVersion": "0.8.1",
"locale": "zhCN",
"styles": {},
"sheets": {
"_P52izs4-QQtg1AbFSjwH": {
"id": "_P52izs4-QQtg1AbFSjwH",
"name": "Sheet1",
"tabColor": "",
"hidden": 0,
"rowCount": 1000,
"columnCount": 20,
"zoomRatio": 1,
"freeze": {
"xSplit": 0,
"ySplit": 0,
"startRow": -1,
"startColumn": -1
},
"scrollTop": 0,
"scrollLeft": 0,
"defaultColumnWidth": 88,
"defaultRowHeight": 24,
"mergeData": [],
"cellData": {
"0": {
"0": {
"v": 1,
"t": 2
},
"1": {
"v": 2,
"t": 2
},
"2": {
"v": 3,
"t": 2
},
"3": {
"v": 4,
"t": 2
},
"4": {
"v": 5,
"t": 2
},
"5": {
"v": 6,
"t": 2
},
"6": {
"v": 7,
"t": 2
}
},
"1": {
"0": {
"v": 2,
"t": 2
},
"1": {
"v": 3,
"t": 2
},
"2": {
"v": 4,
"t": 2
},
"3": {
"v": 5,
"t": 2
},
"4": {
"v": 6,
"t": 2
},
"5": {
"v": 7,
"t": 2
},
"6": {
"v": 8,
"t": 2
}
},
"2": {
"0": {
"v": 3,
"t": 2
},
"1": {
"v": 4,
"t": 2
},
"2": {
"v": 5,
"t": 2
},
"3": {
"v": 6,
"t": 2
},
"4": {
"v": 7,
"t": 2
},
"5": {
"v": 8,
"t": 2
},
"6": {
"v": 9,
"t": 2
}
},
"3": {
"0": {
"v": 4,
"t": 2
},
"1": {
"v": 5,
"t": 2
},
"2": {
"v": 6,
"t": 2
},
"3": {
"v": 7,
"t": 2
},
"4": {
"v": 8,
"t": 2
},
"5": {
"v": 9,
"t": 2
},
"6": {
"v": 10,
"t": 2
}
},
"4": {
"0": {
"v": 5,
"t": 2
},
"1": {
"v": 6,
"t": 2
},
"2": {
"v": 7,
"t": 2
},
"3": {
"v": 8,
"t": 2
},
"4": {
"v": 9,
"t": 2
},
"5": {
"v": 10,
"t": 2
},
"6": {
"v": 11,
"t": 2
}
},
"5": {
"0": {
"v": 6,
"t": 2
},
"1": {
"v": 7,
"t": 2
},
"2": {
"v": 8,
"t": 2
},
"3": {
"v": 9,
"t": 2
},
"4": {
"v": 10,
"t": 2
},
"5": {
"v": 11,
"t": 2
},
"6": {
"v": 12,
"t": 2
}
},
"6": {
"0": {
"v": 7,
"t": 2
},
"1": {
"v": 8,
"t": 2
},
"2": {
"v": 9,
"t": 2
},
"3": {
"v": 10,
"t": 2
},
"4": {
"v": 11,
"t": 2
},
"5": {
"v": 12,
"t": 2
},
"6": {
"v": 13,
"t": 2
}
},
"7": {
"0": {
"v": 8,
"t": 2
},
"1": {
"v": 9,
"t": 2
},
"2": {
"v": 10,
"t": 2
},
"3": {
"v": 11,
"t": 2
},
"4": {
"v": 12,
"t": 2
},
"5": {
"v": 13,
"t": 2
},
"6": {
"v": 14,
"t": 2
}
},
"8": {
"0": {
"v": 9,
"t": 2
},
"1": {
"v": 10,
"t": 2
},
"2": {
"v": 11,
"t": 2
},
"3": {
"v": 12,
"t": 2
},
"4": {
"v": 13,
"t": 2
},
"5": {
"v": 14,
"t": 2
},
"6": {
"v": 15,
"t": 2
}
},
"9": {
"0": {
"v": 10,
"t": 2
},
"1": {
"v": 11,
"t": 2
},
"2": {
"v": 12,
"t": 2
},
"3": {
"v": 13,
"t": 2
},
"4": {
"v": 14,
"t": 2
},
"5": {
"v": 15,
"t": 2
},
"6": {
"v": 16,
"t": 2
}
},
"11": {
"1": {
"f": "=SUM(B10)",
"v": 11,
"t": 2
}
}
},
"rowData": {},
"columnData": {
"5": {
"hd": 1
}
},
"showGridlines": 1,
"rowHeader": {
"width": 46,
"hidden": 0
},
"columnHeader": {
"height": 20,
"hidden": 0
},
"rightToLeft": 0
}
},
"resources": [
{
"name": "SHEET_RANGE_PROTECTION_PLUGIN",
"data": ""
},
{
"name": "SHEET_AuthzIoMockService_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_WORKSHEET_PROTECTION_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_WORKSHEET_PROTECTION_POINT_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_DEFINED_NAME_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_RANGE_THEME_MODEL_PLUGIN",
"data": "{}"
},
{
"name": "SHEET_FILTER_PLUGIN",
"data": "{\"_P52izs4-QQtg1AbFSjwH\":{\"ref\":{\"startRow\":0,\"startColumn\":0,\"endRow\":5,\"endColumn\":6,\"rangeType\":0},\"filterColumns\":[{\"colId\":3,\"filters\":{\"filters\":[\"5\",\"8\",\"9\"]}}],\"cachedFilteredOut\":[2,3]}}"
}
]
}

View File

@@ -0,0 +1,86 @@
import { IUniverInstanceService } from '@univerjs/core';
import { MoveRangeCommand } from '@univerjs/sheets';
import { CalculationMode } from '@univerjs/sheets-formula';
import { expect } from 'vitest';
import { createFormulaTestBed } from './univer';
import { readTestSnapshot } from './util';
export async function expectMoveFormulaRowsResultMatchesSnapshot() {
const testBed = createFormulaTestBed({ initialFormulaComputing: CalculationMode.FORCED });
const workbook = testBed.api.createWorkbook(readTestSnapshot());
const univerInstanceService = testBed.get(IUniverInstanceService);
univerInstanceService.focusUnit(workbook.getId());
const worksheet = workbook.getActiveSheet();
await testBed.api.getFormula().onCalculationResultApplied();
// move row 3 to before row 5
const rowSpec = worksheet.getRange('3:3');
worksheet.moveRows(rowSpec, 4);
await testBed.api.getFormula().onCalculationResultApplied();
expect(workbook.save()).toMatchObject(readTestSnapshot('-result'));
// perform undo operation
await testBed.api.undo();
await testBed.api.getFormula().onCalculationResultApplied();
// compare the result with the snapshot
expect(workbook.save()).toMatchObject(readTestSnapshot());
}
export async function expectMoveFormulaSiRowsResultMatchesSnapshot() {
const testBed = createFormulaTestBed({ initialFormulaComputing: CalculationMode.FORCED });
const workbook = testBed.api.createWorkbook(readTestSnapshot());
const univerInstanceService = testBed.get(IUniverInstanceService);
univerInstanceService.focusUnit(workbook.getId());
const worksheet = workbook.getActiveSheet();
await testBed.api.getFormula().onCalculationResultApplied();
// move row 3 to before row 5
const rowSpec = worksheet.getRange('3:3');
worksheet.moveRows(rowSpec, 4);
await testBed.api.getFormula().onCalculationResultApplied();
expect(workbook.save()).toMatchObject(readTestSnapshot('-result'));
// perform undo operation
await testBed.api.undo();
await testBed.api.getFormula().onCalculationResultApplied();
// compare the result with the snapshot
expect(workbook.save()).toMatchObject(readTestSnapshot());
}
export async function expectMoveFormulaCellResultMatchesSnapshot() {
const testBed = createFormulaTestBed({ initialFormulaComputing: CalculationMode.FORCED });
const workbook = testBed.api.createWorkbook(readTestSnapshot());
const univerInstanceService = testBed.get(IUniverInstanceService);
univerInstanceService.focusUnit(workbook.getId());
const worksheet = workbook.getActiveSheet();
await testBed.api.getFormula().onCalculationResultApplied();
// move D4:D5 to G13:G14
const fromRange = worksheet.getRange('D4:D5').getRange();
const toRange = worksheet.getRange('G13:G14').getRange();
await testBed.api.executeCommand(MoveRangeCommand.id, {
fromRange,
toRange,
});
await testBed.api.getFormula().onCalculationResultApplied();
expect(workbook.save()).toMatchObject(readTestSnapshot('-result'));
// perform undo operation
await testBed.api.undo();
await testBed.api.getFormula().onCalculationResultApplied();
// compare the result with the snapshot
expect(workbook.save()).toMatchObject(readTestSnapshot());
}

View File

@@ -0,0 +1,29 @@
import { IUniverInstanceService } from '@univerjs/core';
import { expect } from 'vitest';
import { createFormulaTestBed } from './univer';
import { readTestSnapshot } from './util';
export async function expectRemoveRowsOfFilterRowsResultMatchesSnapshot() {
const testBed = createFormulaTestBed({ registerSheetsFilter: true });
const workbook = testBed.api.createWorkbook(readTestSnapshot());
const univerInstanceService = testBed.get(IUniverInstanceService);
univerInstanceService.focusUnit(workbook.getId());
const worksheet = workbook.getActiveSheet();
await testBed.api.getFormula().onCalculationResultApplied();
// remove rows 2 to 5, where the 3 to 4 rows are filtered rows
worksheet.deleteRows(1, 4);
await testBed.api.getFormula().onCalculationResultApplied();
expect(workbook.save()).toMatchObject(readTestSnapshot('-result'));
// perform undo operation
await testBed.api.undo();
await testBed.api.getFormula().onCalculationResultApplied();
// compare the result with the snapshot
expect(workbook.save()).toMatchObject(readTestSnapshot());
}

View File

@@ -0,0 +1,42 @@
import type { CalculationMode } from '@univerjs/sheets-formula';
import { LocaleType, Univer } from '@univerjs/core';
import { FUniver } from '@univerjs/core/facade';
import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';
import { UniverSheetsPlugin } from '@univerjs/sheets';
import { UniverSheetsFilterPlugin } from '@univerjs/sheets-filter';
import { UniverSheetsFormulaPlugin } from '@univerjs/sheets-formula';
import zhCN from '@univerjs/sheets/locale/zh-CN';
import '@univerjs/engine-formula/facade';
import '@univerjs/sheets/facade';
import '@univerjs/sheets-filter/facade';
import '@univerjs/sheets-formula/facade';
export function createFormulaTestBed(options: {
initialFormulaComputing?: CalculationMode;
registerSheetsFilter?: boolean;
} = {}) {
const univer = new Univer({
locale: LocaleType.ZH_CN,
locales: {
[LocaleType.ZH_CN]: zhCN,
},
});
univer.registerPlugin(UniverFormulaEnginePlugin);
univer.registerPlugin(UniverSheetsPlugin);
univer.registerPlugin(UniverSheetsFormulaPlugin, {
initialFormulaComputing: options.initialFormulaComputing,
});
if (options.registerSheetsFilter) {
univer.registerPlugin(UniverSheetsFilterPlugin);
}
const injector = univer.__getInjector();
return {
univer,
get: injector.get.bind(injector),
api: FUniver.newAPI(univer),
};
}

View File

@@ -0,0 +1,43 @@
import type { IWorkbookData } from '@univerjs/core';
import fs from 'node:fs';
import path from 'node:path';
import { expect } from 'vitest';
import { createFormulaTestBed } from './univer';
export function getTestName(): string {
const testName = expect.getState().currentTestName;
if (!testName) {
throw new Error('Cannot get test name. Maybe you call the method outside a test case?');
}
return testName;
}
export function getTestFilePath() {
const name = getTestName();
return name.replace(/[ >]/g, '-').toLowerCase();
}
export function readTestSnapshot(suffix = ''): IWorkbookData {
const snapshotPath = path.resolve(import.meta.dirname, '../__snapshots__', `${getTestFilePath()}${suffix}.json`);
if (!fs.existsSync(snapshotPath)) {
throw new Error(`Cannot find snapshot file for test "${getTestName()}".`);
}
return JSON.parse(fs.readFileSync(snapshotPath, 'utf-8')) as IWorkbookData;
}
export async function expectCalculationResultMatchesSnapshot() {
const testBed = createFormulaTestBed();
const workbook = testBed.api.createWorkbook(readTestSnapshot());
await testBed.api.getFormula().onCalculationResultApplied();
const resultSnapshot = workbook.save();
const expectedSnapshot = readTestSnapshot('-result');
for (const sheetId of expectedSnapshot.sheetOrder) {
expect(resultSnapshot.sheets[sheetId]?.cellData).toMatchObject(expectedSnapshot.sheets[sheetId].cellData ?? {});
}
}

View File

@@ -0,0 +1,8 @@
import { describe, it } from 'vitest';
import { expectCalculationResultMatchesSnapshot } from '../__testing__/util';
describe('Test formula correctness', () => {
it('basic sum', async () => {
await expectCalculationResultMatchesSnapshot();
});
});

View File

@@ -0,0 +1,20 @@
import { describe, it } from 'vitest';
import {
expectMoveFormulaCellResultMatchesSnapshot,
expectMoveFormulaRowsResultMatchesSnapshot,
expectMoveFormulaSiRowsResultMatchesSnapshot,
} from '../__testing__/test-formula-move';
describe('Test formula move', () => {
it('move formula rows', async () => {
await expectMoveFormulaRowsResultMatchesSnapshot();
});
it('move formula si rows', async () => {
await expectMoveFormulaSiRowsResultMatchesSnapshot();
});
it('move formula cell', async () => {
await expectMoveFormulaCellResultMatchesSnapshot();
});
});

View File

@@ -0,0 +1,8 @@
import { describe, it } from 'vitest';
import { expectRemoveRowsOfFilterRowsResultMatchesSnapshot } from '../__testing__/test-remove-rows-of-filter-rows';
describe('Test remove rows', () => {
it('of filter rows', async () => {
await expectRemoveRowsOfFilterRowsResultMatchesSnapshot();
});
});

View File

@@ -0,0 +1 @@
export { expectCalculationResultMatchesSnapshot } from './__testing__/util';

View File

@@ -0,0 +1,8 @@
{
"extends": "@univerjs-infra/shared/tsconfigs/base",
"compilerOptions": {
"rootDir": "src",
"outDir": "lib/types"
},
"include": ["src"]
}

View File

@@ -0,0 +1,4 @@
{
"extends": "@univerjs-infra/shared/tsconfigs/node",
"include": ["vitest.config.ts"]
}

View File

@@ -0,0 +1,3 @@
import createConfig from '@univerjs-infra/shared/vitest';
export default createConfig();