Browse Source

Fix UnitTest's (Remove SetCulture), small fix in Addin.BaseImageItem.cs

pull/14/head
peterforstmeier 15 years ago
parent
commit
efe555b0ec
  1. 33
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportItems/BaseImageItem.cs
  2. 4
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Test/ICSharpCode.Reports.Core.Test/ReportingLanguage/IntegrationTests/AggregateFunctionsFixture.cs

33
src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportItems/BaseImageItem.cs

@ -60,12 +60,10 @@ namespace ICSharpCode.Reports.Addin
if (this.scaleImageToSize) { if (this.scaleImageToSize) {
graphics.DrawImageUnscaled(this.Image,this.Location.X,this.Location.Y); graphics.DrawImageUnscaled(this.Image,this.Location.X,this.Location.Y);
} else { } else {
Image im = this.image;
if (im != null) {
graphics.DrawImage(this.Image,this.ClientRectangle); graphics.DrawImage(this.Image,this.ClientRectangle);
} }
} }
}
#region Property's #region Property's
@ -74,9 +72,11 @@ namespace ICSharpCode.Reports.Addin
public string ImageFileName { public string ImageFileName {
get { return imageFileName; } get { return imageFileName; }
set { imageFileName = value; set { imageFileName = value;
if (!String.IsNullOrEmpty(reportFileName)) {
this.relativeFileName = FileUtility.GetRelativePath(Path.GetFullPath(this.reportFileName),Path.GetFullPath(this.ImageFileName)); this.relativeFileName = FileUtility.GetRelativePath(Path.GetFullPath(this.reportFileName),Path.GetFullPath(this.ImageFileName));
} }
} }
}
private static Bitmap ErrorBitmap(Size size) private static Bitmap ErrorBitmap(Size size)
@ -138,16 +138,24 @@ namespace ICSharpCode.Reports.Addin
if (this.imageSource == GlobalEnums.ImageSource.Database ) { if (this.imageSource == GlobalEnums.ImageSource.Database ) {
text = "<Database>"; text = "<Database>";
} }
if (!String.IsNullOrEmpty(imageFileName)) {
this.image = this.LoadImage();
return this.image;
}
/*
this.image = FakeImage(base.Size,text); this.image = FakeImage(base.Size,text);
if (this.image != null) { if (this.image != null) {
return image; return image;
} else { } else {
var s = AbsoluteFileName;
if (!String.IsNullOrEmpty(imageFileName)) { if (!String.IsNullOrEmpty(imageFileName)) {
this.image = this.LoadImage(); this.image = this.LoadImage();
return this.image; return this.image;
} }
} }
return null; return null;
*/
return null;
} }
set { set {
this.image = value; this.image = value;
@ -212,16 +220,25 @@ namespace ICSharpCode.Reports.Addin
public string AbsoluteFileName public string AbsoluteFileName
{ {
get { get {
//D:\SharpDevelop3.0_WorkingCopy\SharpDevelop\samples\SharpDevelopReports\SampleReports\Logos //D:\SharpDevelop3.0_WorkingCopy\SharpDevelop\samples\SharpDevelopReports\SampleReports\Logos
if (!string.IsNullOrEmpty(relativeFileName)) { if (!string.IsNullOrEmpty(relativeFileName)) {
Console.WriteLine(""); Console.WriteLine("");
string testFileName = FileUtility.NormalizePath(Path.Combine(Path.GetDirectoryName(this.reportFileName),this.relativeFileName));
string testFileName = String.Empty;
if (! String.IsNullOrEmpty(reportFileName)) {
testFileName = FileUtility.NormalizePath(Path.Combine(Path.GetDirectoryName(this.reportFileName),this.relativeFileName));
}
// else
// {
// testFileName = FileUtility.NormalizePath(Path.Combine(Path.GetDirectoryName(this.reportFileName),this.relativeFileName));
// }
if (File.Exists(testFileName)){ if (File.Exists(testFileName)){
Console.WriteLine("Image found with Relative Filename"); Console.WriteLine("Image found with Relative Filename");
Console.WriteLine("Report Filename {0}",this.reportFileName); // Console.WriteLine("Report Filename {0}",this.reportFileName);
Console.WriteLine("Relative Filename {0}",this.relativeFileName); // Console.WriteLine("Relative Filename {0}",this.relativeFileName);
Console.WriteLine("Image Filename {0}",this.ImageFileName); // Console.WriteLine("Image Filename {0}",this.ImageFileName);
return testFileName; return testFileName;
} else { } else {
Console.WriteLine("AbsoluteFileName can't load image"); Console.WriteLine("AbsoluteFileName can't load image");

4
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Test/ICSharpCode.Reports.Core.Test/ReportingLanguage/IntegrationTests/AggregateFunctionsFixture.cs

@ -15,7 +15,7 @@ namespace ICSharpCode.Reports.Core.Test.ReportingLanguage.IntegrationTests
{ {
[TestFixture] [TestFixture]
[SetCulture("de-DE")] // [SetCulture("de-DE")]
public class AggregateFunctionsFromTableFixture public class AggregateFunctionsFromTableFixture
{ {
@ -100,6 +100,7 @@ namespace ICSharpCode.Reports.Core.Test.ReportingLanguage.IntegrationTests
public void Can_Sum_Double () public void Can_Sum_Double ()
{ {
const string expression = "=sum(amount)"; const string expression = "=sum(amount)";
//var s = this.evaluator.Evaluate(expression);
Assert.That(this.evaluator.Evaluate(expression), Assert.That(this.evaluator.Evaluate(expression),
Is.EqualTo(this.doubleResult.ToString())); Is.EqualTo(this.doubleResult.ToString()));
} }
@ -112,6 +113,7 @@ namespace ICSharpCode.Reports.Core.Test.ReportingLanguage.IntegrationTests
public void Can_Look_For_MaxValue() public void Can_Look_For_MaxValue()
{ {
const string expression = "=max(amount)"; const string expression = "=max(amount)";
//var s = this.evaluator.Evaluate(expression);
Assert.That(this.evaluator.Evaluate(expression), Assert.That(this.evaluator.Evaluate(expression),
Is.EqualTo("400,5")); Is.EqualTo("400,5"));
} }

Loading…
Cancel
Save