Made text work better in sheets

Added WiFi login to qr code generator
This commit is contained in:
Lars Brubaker 2022-11-25 13:11:27 -08:00
parent 6e4ac4ec60
commit e95fd6f388
7 changed files with 176 additions and 68 deletions

View file

@ -24,25 +24,36 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
var sheetData = new SheetData(4, 4);
sheetData[0, 0].Expression = "=4*2";
void Test(string cell, string expression, string expected)
{
sheetData[cell].Expression = expression;
sheetData.Recalculate();
Assert.AreEqual(expected, sheetData.GetCellValue(cell));
}
Assert.AreEqual("8", sheetData.EvaluateExpression("A1"));
Assert.AreEqual("8", sheetData.EvaluateExpression("a1"));
// simple multiply retrived upper and lower case
Test("A1", "=4*2", "8");
Test("a1", "=4*2", "8");
sheetData["a2"].Expression = "=max(4, 5)";
sheetData.Recalculate();
Assert.AreEqual("5", sheetData.EvaluateExpression("a2"));
// make sure functions are working, max in this case
Test("a2", "=max(4, 5)", "5");
sheetData["a3"].Expression = "=a1+a2";
sheetData.Recalculate();
Assert.AreEqual("13", sheetData.EvaluateExpression("a3"));
// make sure cell references are working
Test("a3", "=a1+a2", "13");
sheetData["a4"].Expression = "=((4+5)/3+7)/5";
sheetData.Recalculate();
Assert.AreEqual("2", sheetData.EvaluateExpression("a4"));
// complex formulas are working
Test("a4", "=((4+5)/3+7)/5", "2");
}
}
// complex formulas with references are working
Test("b1", "=(a4+a3)*.5", "7.5");
// constants work, like pi
Test("b2", "=pi", "3.141592653589793");
// check that we get string data back unmodified
Test("b3", "hello", "hello");
}
}
[TestFixture, Category("MatterControl.UI.Automation"), Parallelizable(ParallelScope.Children)]
public class PrimitiveAndSheetsTests