Skip to content

Commit

Permalink
fix bugs in unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
siegfriedpammer committed Sep 18, 2011
1 parent 25237a1 commit 2f349f4
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 16 deletions.
3 changes: 3 additions & 0 deletions ILSpy.BamlDecompiler/CecilType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ public bool IsSubclassOf(IType type)

var t = this.type;

if (t == ct.type)
return false;

while (t != null) {
if (t == ct.type)
return true;
Expand Down
2 changes: 1 addition & 1 deletion ILSpy.BamlDecompiler/CecilTypeResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public IType GetTypeByAssemblyQualifiedName(string name)
}

if (type == null) {
var otherAssembly = resolver.Resolve(assemblyName);
var otherAssembly = resolver.Resolve(AssemblyNameReference.Parse(assemblyName));
if (otherAssembly == null)
return new UnresolvableType(name);
type = otherAssembly.MainModule.GetType(fullName.Replace('+', '/'));
Expand Down
26 changes: 13 additions & 13 deletions ILSpy.BamlDecompiler/Tests/Cases/AvalonDockCommon.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
<MenuItem Command="ad:DocumentContentCommands.TabbedDocument" />
</ContextMenu>
<Style x:Key="{x:Type ad:Resizer}" TargetType="{x:Type ad:Resizer}">
<Setter Property="Background" Value="#00FFFFFF" />
<Setter Property="Template">
<Setter Property="Control.Background" Value="#00FFFFFF" />
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ad:Resizer}">
<Border Background="{TemplateBinding Control.Background}" />
Expand All @@ -27,31 +27,31 @@
</Setter>
</Style>
<Style x:Key="PaneHeaderCommandStyle" TargetType="{x:Type Button}">
<Setter Property="Template">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border Name="PaneHeaderCommandIntBorder" Background="#00FFFFFF" BorderThickness="1" Margin="0" Opacity="0.8">
<ContentPresenter />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="PaneHeaderCommandIntBorder" Value="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.PaneHeaderCommandBorderBrush}}}" Property="BorderBrush" />
<Setter TargetName="PaneHeaderCommandIntBorder" Value="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.PaneHeaderCommandBackground}}}" Property="Background" />
<Setter TargetName="PaneHeaderCommandIntBorder" Property="Opacity" Value="1" />
<Trigger Property="UIElement.IsMouseOver" Value="True">
<Setter TargetName="PaneHeaderCommandIntBorder" Value="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.PaneHeaderCommandBorderBrush}}}" Property="Border.BorderBrush" />
<Setter TargetName="PaneHeaderCommandIntBorder" Value="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.PaneHeaderCommandBackground}}}" Property="Border.Background" />
<Setter TargetName="PaneHeaderCommandIntBorder" Property="UIElement.Opacity" Value="1" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="PaneHeaderContextMenuCommandStyle" TargetType="{x:Type Border}">
<Setter Property="Background" Value="#00FFFFFF" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Border.Background" Value="#00FFFFFF" />
<Setter Property="Border.BorderThickness" Value="1" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderBrush" Value="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.PaneHeaderCommandBorderBrush}}}" />
<Setter Property="Background" Value="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.PaneHeaderCommandBackground}}}" />
<Setter Property="Opacity" Value="1" />
<Trigger Property="UIElement.IsMouseOver" Value="True">
<Setter Property="Border.BorderBrush" Value="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.PaneHeaderCommandBorderBrush}}}" />
<Setter Property="Border.Background" Value="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.PaneHeaderCommandBackground}}}" />
<Setter Property="UIElement.Opacity" Value="1" />
</Trigger>
</Style.Triggers>
</Style>
Expand Down
5 changes: 3 additions & 2 deletions ILSpy.BamlDecompiler/Tests/TestRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,12 @@ void RunTest(string name)

void RunTest(string name, string asmPath, string sourcePath)
{
var assembly = AssemblyDefinition.ReadAssembly(asmPath);
var resolver = new DefaultAssemblyResolver();
var assembly = AssemblyDefinition.ReadAssembly(asmPath, new ReaderParameters { AssemblyResolver = resolver });
Resource res = assembly.MainModule.Resources.First();
Stream bamlStream = LoadBaml(res, name + ".baml");
Assert.IsNotNull(bamlStream);
XDocument document = BamlResourceEntryNode.LoadIntoDocument(new DefaultAssemblyResolver(), assembly, bamlStream);
XDocument document = BamlResourceEntryNode.LoadIntoDocument(resolver, assembly, bamlStream);

CodeAssert.AreEqual(File.ReadAllText(sourcePath), document.ToString());
}
Expand Down

0 comments on commit 2f349f4

Please sign in to comment.