From fbcf311212fb44eee59531be97631b457ca6dd8a Mon Sep 17 00:00:00 2001 From: Friedrich von Never Date: Mon, 6 Jan 2020 19:49:43 +0700 Subject: [PATCH] Add a unit test for a multiline formula (#149) --- src/WpfMath.Tests/ParserTests.fs | 4 + .../ParserTests.multilineFormula.approved.txt | 270 ++++++++++++++++++ 2 files changed, 274 insertions(+) create mode 100644 src/WpfMath.Tests/TestResults/ParserTests.multilineFormula.approved.txt diff --git a/src/WpfMath.Tests/ParserTests.fs b/src/WpfMath.Tests/ParserTests.fs index 463fd7d0..2ba84784 100644 --- a/src/WpfMath.Tests/ParserTests.fs +++ b/src/WpfMath.Tests/ParserTests.fs @@ -285,3 +285,7 @@ let colorModelsWithOpacity(text: string): unit = verifyParseResultScenario <| processSpecialChars text <| text + +[] +let multilineFormula(): unit = + verifyParseResult @"line 1\\line 2\\line 3" diff --git a/src/WpfMath.Tests/TestResults/ParserTests.multilineFormula.approved.txt b/src/WpfMath.Tests/TestResults/ParserTests.multilineFormula.approved.txt new file mode 100644 index 00000000..49601772 --- /dev/null +++ b/src/WpfMath.Tests/TestResults/ParserTests.multilineFormula.approved.txt @@ -0,0 +1,270 @@ +{ + "TextStyle": null, + "RootAtom": { + "PreviousAtom": null, + "Elements": [ + { + "MatrixCells": [ + [ + { + "PreviousAtom": null, + "Elements": [ + { + "MatrixCells": [ + [ + { + "PreviousAtom": null, + "Elements": [ + { + "Character": "l", + "TextStyle": null, + "IsDefaultTextStyle": true, + "IsTextSymbol": false, + "Type": "Ordinary", + "Source": { + "Start": 0, + "End": 1, + "Length": 1, + "Source": "line 1\\\\line 2\\\\line 3" + } + }, + { + "Character": "i", + "TextStyle": null, + "IsDefaultTextStyle": true, + "IsTextSymbol": false, + "Type": "Ordinary", + "Source": { + "Start": 1, + "End": 2, + "Length": 1, + "Source": "line 1\\\\line 2\\\\line 3" + } + }, + { + "Character": "n", + "TextStyle": null, + "IsDefaultTextStyle": true, + "IsTextSymbol": false, + "Type": "Ordinary", + "Source": { + "Start": 2, + "End": 3, + "Length": 1, + "Source": "line 1\\\\line 2\\\\line 3" + } + }, + { + "Character": "e", + "TextStyle": null, + "IsDefaultTextStyle": true, + "IsTextSymbol": false, + "Type": "Ordinary", + "Source": { + "Start": 3, + "End": 4, + "Length": 1, + "Source": "line 1\\\\line 2\\\\line 3" + } + }, + { + "Character": "1", + "TextStyle": null, + "IsDefaultTextStyle": true, + "IsTextSymbol": false, + "Type": "Ordinary", + "Source": { + "Start": 5, + "End": 6, + "Length": 1, + "Source": "line 1\\\\line 2\\\\line 3" + } + } + ], + "Type": "Ordinary", + "Source": { + "Start": 0, + "End": 6, + "Length": 6, + "Source": "line 1\\\\line 2\\\\line 3" + } + } + ], + [ + { + "Character": "l", + "TextStyle": null, + "IsDefaultTextStyle": true, + "IsTextSymbol": false, + "Type": "Ordinary", + "Source": { + "Start": 8, + "End": 9, + "Length": 1, + "Source": "line 1\\\\line 2\\\\line 3" + } + } + ] + ], + "VerticalPadding": 0.35, + "HorizontalPadding": 0.35, + "MatrixCellAlignment": "Center", + "Type": "Ordinary", + "Source": { + "Start": 7, + "End": 9, + "Length": 2, + "Source": "line 1\\\\line 2\\\\line 3" + } + }, + { + "Character": "i", + "TextStyle": null, + "IsDefaultTextStyle": true, + "IsTextSymbol": false, + "Type": "Ordinary", + "Source": { + "Start": 9, + "End": 10, + "Length": 1, + "Source": "line 1\\\\line 2\\\\line 3" + } + }, + { + "Character": "n", + "TextStyle": null, + "IsDefaultTextStyle": true, + "IsTextSymbol": false, + "Type": "Ordinary", + "Source": { + "Start": 10, + "End": 11, + "Length": 1, + "Source": "line 1\\\\line 2\\\\line 3" + } + }, + { + "Character": "e", + "TextStyle": null, + "IsDefaultTextStyle": true, + "IsTextSymbol": false, + "Type": "Ordinary", + "Source": { + "Start": 11, + "End": 12, + "Length": 1, + "Source": "line 1\\\\line 2\\\\line 3" + } + }, + { + "Character": "2", + "TextStyle": null, + "IsDefaultTextStyle": true, + "IsTextSymbol": false, + "Type": "Ordinary", + "Source": { + "Start": 13, + "End": 14, + "Length": 1, + "Source": "line 1\\\\line 2\\\\line 3" + } + } + ], + "Type": "Ordinary", + "Source": { + "Start": 0, + "End": 14, + "Length": 14, + "Source": "line 1\\\\line 2\\\\line 3" + } + } + ], + [ + { + "Character": "l", + "TextStyle": null, + "IsDefaultTextStyle": true, + "IsTextSymbol": false, + "Type": "Ordinary", + "Source": { + "Start": 16, + "End": 17, + "Length": 1, + "Source": "line 1\\\\line 2\\\\line 3" + } + } + ] + ], + "VerticalPadding": 0.35, + "HorizontalPadding": 0.35, + "MatrixCellAlignment": "Center", + "Type": "Ordinary", + "Source": { + "Start": 15, + "End": 17, + "Length": 2, + "Source": "line 1\\\\line 2\\\\line 3" + } + }, + { + "Character": "i", + "TextStyle": null, + "IsDefaultTextStyle": true, + "IsTextSymbol": false, + "Type": "Ordinary", + "Source": { + "Start": 17, + "End": 18, + "Length": 1, + "Source": "line 1\\\\line 2\\\\line 3" + } + }, + { + "Character": "n", + "TextStyle": null, + "IsDefaultTextStyle": true, + "IsTextSymbol": false, + "Type": "Ordinary", + "Source": { + "Start": 18, + "End": 19, + "Length": 1, + "Source": "line 1\\\\line 2\\\\line 3" + } + }, + { + "Character": "e", + "TextStyle": null, + "IsDefaultTextStyle": true, + "IsTextSymbol": false, + "Type": "Ordinary", + "Source": { + "Start": 19, + "End": 20, + "Length": 1, + "Source": "line 1\\\\line 2\\\\line 3" + } + }, + { + "Character": "3", + "TextStyle": null, + "IsDefaultTextStyle": true, + "IsTextSymbol": false, + "Type": "Ordinary", + "Source": { + "Start": 21, + "End": 22, + "Length": 1, + "Source": "line 1\\\\line 2\\\\line 3" + } + } + ], + "Type": "Ordinary", + "Source": { + "Start": 0, + "End": 22, + "Length": 22, + "Source": "line 1\\\\line 2\\\\line 3" + } + } +} \ No newline at end of file