Browse Source

Fixed designer support tests to be able to load assets. Fixed Cairo bitmaps to correctly construct with new design.

pull/575/head
Jeremy Koritzinsky 10 years ago
parent
commit
7bbcd90e7f
  1. 2
      src/Gtk/Avalonia.Cairo/Media/Imaging/BitmapImpl.cs
  2. 12
      tests/Avalonia.DesignerSupport.Tests/Checker.cs
  3. 4
      tests/Avalonia.DesignerSupport.Tests/DesignerSupportTests.cs

2
src/Gtk/Avalonia.Cairo/Media/Imaging/BitmapImpl.cs

@ -12,7 +12,7 @@ namespace Avalonia.Cairo.Media.Imaging
public class BitmapImpl : Gdk.Pixbuf, IBitmapImpl
{
public BitmapImpl(Gdk.Pixbuf pixbuf)
:base(pixbuf, 0, 0, pixbuf.Width, pixbuf.Height)
:base(pixbuf.SaveToBuffer("png"))
{
}

12
tests/Avalonia.DesignerSupport.Tests/Checker.cs

@ -14,9 +14,9 @@ namespace Avalonia.DesignerSupport.Tests
private string _appDir;
private IntPtr _window;
public void DoCheck(string outputDir, string xamlText)
public void DoCheck(string baseAsset, string xamlText)
{
_appDir = Path.GetFullPath(outputDir);
_appDir = new FileInfo(baseAsset).Directory.FullName;
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
foreach (var asm in Directory.GetFiles(_appDir).Where(f => f.ToLower().EndsWith(".dll") || f.ToLower().EndsWith(".exe")))
try
@ -29,8 +29,12 @@ namespace Avalonia.DesignerSupport.Tests
var dic = new Dictionary<string, object>();
var api = new DesignerApi(dic) { OnResize = OnResize, OnWindowCreated = OnWindowCreated };
LookupStaticMethod("Avalonia.DesignerSupport.DesignerAssist", "Init").Invoke(null, new object[] { dic });
api.UpdateXaml(xamlText);
api.UpdateXaml2(new DesignerApiXamlFileInfo
{
Xaml = xamlText,
AssemblyPath = baseAsset
}.Dictionary);
if (_window == IntPtr.Zero)
throw new Exception("Something went wrong");

4
tests/Avalonia.DesignerSupport.Tests/DesignerSupportTests.cs

@ -12,8 +12,8 @@ namespace Avalonia.DesignerSupport.Tests
public class DesignerSupportTests
{
[Theory,
InlineData(@"..\..\..\Avalonia.DesignerSupport.TestApp\bin\$BUILD", @"..\..\..\Avalonia.DesignerSupport.TestApp\MainWindow.xaml"),
InlineData(@"..\..\..\..\samples\ControlCatalog.Desktop\bin\$BUILD", @"..\..\..\..\samples\ControlCatalog\MainWindow.xaml")]
InlineData(@"..\..\..\Avalonia.DesignerSupport.TestApp\bin\$BUILD\Avalonia.DesignerSupport.TestApp.exe", @"..\..\..\Avalonia.DesignerSupport.TestApp\MainWindow.xaml"),
InlineData(@"..\..\..\..\samples\ControlCatalog.Desktop\bin\$BUILD\ControlCatalog.dll", @"..\..\..\..\samples\ControlCatalog\MainWindow.xaml")]
public void DesgignerApiShoudBeOperational(string outputDir, string xamlFile)
{
var xaml = File.ReadAllText(xamlFile);

Loading…
Cancel
Save