Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 474 header defaults #490

Merged
merged 13 commits into from
Jan 8, 2025
16 changes: 16 additions & 0 deletions src/ACadSharp.Tests/IO/CadReaderTestsBase.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using ACadSharp.Entities;
using ACadSharp.Header;
using ACadSharp.IO;
using ACadSharp.Tables;
using ACadSharp.Tests.TestModels;
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -85,6 +86,21 @@ public virtual void AssertDocumentTree(FileModel test)
this._docIntegrity.AssertDocumentTree(doc);
}

public virtual void AssertDocumentHeader(FileModel test)
{
CadDocument doc = this.getDocument(test, false);
CadHeader header = doc.Header;

Assert.Equal(doc.Layers[Layer.DefaultName], header.CurrentLayer);
Assert.Equal(Layer.DefaultName, header.CurrentLayerName, ignoreCase: true);

Assert.Equal(doc.LineTypes[LineType.ByLayerName], header.CurrentLineType);
Assert.Equal(LineType.ByLayerName, header.CurrentLineTypeName, ignoreCase: true);

Assert.Equal(doc.TextStyles[TextStyle.DefaultName], header.CurrentTextStyle);
Assert.Equal(TextStyle.DefaultName, header.TextStyleName, ignoreCase: true);
}

public void Dispose()
{
this._documents.Clear();
Expand Down
7 changes: 7 additions & 0 deletions src/ACadSharp.Tests/IO/DWG/DwgReaderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ public override void AssertDocumentTree(FileModel test)
this._docIntegrity.AssertDocumentTree(doc);
}

[Theory]
[MemberData(nameof(DwgFilePaths))]
public override void AssertDocumentHeader(FileModel test)
{
base.AssertDocumentHeader(test);
}

[Theory(Skip = "Long time test")]
[MemberData(nameof(DwgFilePaths))]
public void ReadCrcEnabledTest(FileModel test)
Expand Down
8 changes: 8 additions & 0 deletions src/ACadSharp.Tests/IO/DXF/DxfReaderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,14 @@ public override void AssertDocumentTree(FileModel test)
this._docIntegrity.AssertDocumentTree(doc);
}

[Theory]
[MemberData(nameof(DxfAsciiFiles))]
[MemberData(nameof(DxfBinaryFiles))]
public override void AssertDocumentHeader(FileModel test)
{
base.AssertDocumentHeader(test);
}

#if !NETFRAMEWORK
[Theory]
[MemberData(nameof(DxfAsciiFiles))]
Expand Down
Loading