diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/ICSharpCode.Reporting.csproj b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/ICSharpCode.Reporting.csproj index 577dcda34b..9d135c5203 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/ICSharpCode.Reporting.csproj +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/ICSharpCode.Reporting.csproj @@ -44,8 +44,11 @@ TRACE - - $(SharpDevelopBinPath)\Tools\NUnit\NUnit.Framework.dll + + ..\Libraries\Irony.dll + + + ..\Libraries\Irony.Interpreter.dll 3.0 diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/ICSharpCode.Reporting.Test.csproj b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/ICSharpCode.Reporting.Test.csproj index 1870e42de6..7993496e54 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/ICSharpCode.Reporting.Test.csproj +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/ICSharpCode.Reporting.Test.csproj @@ -44,6 +44,12 @@ TRACE + + ..\..\..\Libraries\Irony.dll + + + ..\..\..\Libraries\Irony.Interpreter.dll + ..\..\..\..\..\..\Tools\NUnit\nunit.framework.dll @@ -60,6 +66,7 @@ + @@ -82,6 +89,7 @@ + diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/Expressions/IronyGeneral.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/Expressions/IronyGeneral.cs new file mode 100644 index 0000000000..9c98ae5568 --- /dev/null +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/Expressions/IronyGeneral.cs @@ -0,0 +1,70 @@ +// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) +// This code is distributed under the GNU LGPL (for details please see \doc\license.txt) +using System; +using Irony.Interpreter.Evaluator; +using NUnit.Framework; + +namespace ICSharpCode.Reporting.Test.Expressions +{ + [TestFixture] + public class IronyBasics + { + ExpressionEvaluatorGrammar grammar; + ExpressionEvaluator evaluator; + + #region Calculation + + [Test] + public void CanAddNumber() { + + var script = "2 + 3"; + var result = evaluator.Evaluate(script); + Assert.That(result,Is.EqualTo(5)); + } + + #endregion + + + #region Stringhandling + + [Test] + public void CanConcatString() { + var result = evaluator.Evaluate("'SharpDevelop' + ' ' + 'is great'"); + Assert.That(result,Is.EqualTo("SharpDevelop is great")); + } + #endregion + + #region System.Environment + + [Test] + public void CanUserSystemEnvironment() { + + //Using methods imported from System.Environment + var script = @"report = '#{MachineName}-#{OSVersion}-#{UserName}'"; + var result = evaluator.Evaluate(script); + var expected = string.Format("{0}-{1}-{2}", Environment.MachineName, Environment.OSVersion, Environment.UserName); + Assert.AreEqual(expected, result, "Unexpected computation result"); + } + + #endregion + + #region System.Math + + [Test] + public void CanRunSystemMath () { + //Using methods imported from System.Math class + var script = @"abs(-1.0) + Log10(100.0) + sqrt(9) + floor(4.5) + sin(PI/2)"; + var result = evaluator.Evaluate(script); + Assert.IsTrue(result is double, "Result is not double."); + Assert.AreEqual(11.0, (double) result, 0.001, "Unexpected computation result"); + } + + #endregion + + [SetUp] + public void Initialize() { + grammar = new ExpressionEvaluatorGrammar(); + evaluator = new ExpressionEvaluator(grammar); + } + } +} diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/Reportingfactory/PushModelFixture.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/Reportingfactory/PushModelFixture.cs index 22790f5276..17065cf58b 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/Reportingfactory/PushModelFixture.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/Reportingfactory/PushModelFixture.cs @@ -8,6 +8,7 @@ */ using System; using System.Collections.Generic; +using System.Drawing; using System.Linq; using System.Reflection; @@ -93,7 +94,7 @@ namespace ICSharpCode.Reporting.Test.Reportingfactory [Test] - public void LastElementInPageIsPageFooter() { + public void LastElementInEveryPageIsPageFooter() { reportCreator.BuildExportList(); var firstPage = reportCreator.Pages[1].ExportedItems; @@ -107,7 +108,7 @@ namespace ICSharpCode.Reporting.Test.Reportingfactory [Test] - public void FirstElementOnScoundPageIsReportHeader() { + public void FirstElementOnSecondPageIsReportHeader() { reportCreator.BuildExportList(); var exporteditems = reportCreator.Pages[1].ExportedItems; var result = exporteditems[0]; @@ -115,6 +116,19 @@ namespace ICSharpCode.Reporting.Test.Reportingfactory } + [Test] + public void RowsHasGapOfOne () { + reportCreator.BuildExportList(); + var exporteditems = reportCreator.Pages[0].ExportedItems; + for (int i = 1; i < exporteditems.Count -1; i++) { + Console.WriteLine(" {0} - {1} - {2}",exporteditems[i-1].DisplayRectangle.Bottom,exporteditems[i].Location.Y,exporteditems[i].Name); +// Assert.That(exporteditems[i].Location.Y,Is.GreaterThan(exporteditems[i-1].DisplayRectangle.Bottom)); + + Assert.That(exporteditems[i].Location.Y,Is.EqualTo(exporteditems[i-1].DisplayRectangle.Bottom +1)); + } + } + + [Test] public void DetailContainsOneDataItem() { reportCreator.BuildExportList(); diff --git a/src/AddIns/Misc/Reporting/Irony/Irony_2013_09_03.zip b/src/AddIns/Misc/Reporting/Irony/Irony_2013_09_03.zip new file mode 100644 index 0000000000..07c7aa5c87 Binary files /dev/null and b/src/AddIns/Misc/Reporting/Irony/Irony_2013_09_03.zip differ diff --git a/src/AddIns/Misc/Reporting/Libraries/Irony.Interpreter.dll b/src/AddIns/Misc/Reporting/Libraries/Irony.Interpreter.dll new file mode 100644 index 0000000000..f535ab8237 Binary files /dev/null and b/src/AddIns/Misc/Reporting/Libraries/Irony.Interpreter.dll differ diff --git a/src/AddIns/Misc/Reporting/Libraries/Irony.dll b/src/AddIns/Misc/Reporting/Libraries/Irony.dll new file mode 100644 index 0000000000..f16ac8af6f Binary files /dev/null and b/src/AddIns/Misc/Reporting/Libraries/Irony.dll differ