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

BCF 2.1 support #5

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 130 additions & 0 deletions Xbim.BCF.Tests/2.0/BCF20Tests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
using System.IO;
using System.Xml;
using System.Xml.Linq;
using System.Xml.Schema;
using System.Xml.Serialization;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Xbim.BCF.Tests
{
[TestClass]
public class BCF20Tests
{
private const string version = "2.0";

[TestInitialize]
public void TestInit()
{
}

[TestMethod]
[DeploymentItem("2.0\\XML\\markup20.xml")]
public void DeserializeMarkupXML()
{
MarkupXMLFile xmlObj = new MarkupXMLFile(XDocument.Load("markup20.xml"), version);
//Comments
Assert.IsTrue(xmlObj.Comments.Count > 0);
Assert.IsNotNull(xmlObj.Comments[0].Guid);
Assert.IsNotNull(xmlObj.Comments[0].Date);
Assert.IsNotNull(xmlObj.Comments[0].Author);
Assert.IsNotNull(xmlObj.Comments[0].Comment);
Assert.IsNotNull(xmlObj.Comments[0].ModifiedAuthor);
Assert.IsNotNull(xmlObj.Comments[0].ModifiedDate);
Assert.IsNotNull(xmlObj.Comments[0].Viewpoint.ID);
//Viewpoint
Assert.IsTrue(xmlObj.Viewpoints.Count > 0);
Assert.IsNotNull(xmlObj.Viewpoints[0].Snapshot);
Assert.IsNotNull(xmlObj.Viewpoints[0].Viewpoint);
Assert.IsNotNull(xmlObj.Viewpoints[0].ID);
//Header
Assert.IsNotNull(xmlObj.Header);
//Files
Assert.IsTrue(xmlObj.Header.Files.Count > 0);
Assert.IsNotNull(xmlObj.Header.Files[0].Date);
Assert.IsNotNull(xmlObj.Header.Files[0].Filename);
Assert.IsNotNull(xmlObj.Header.Files[0].IfcProject);
Assert.IsNotNull(xmlObj.Header.Files[0].IfcSpatialStructureElement);
Assert.IsNotNull(xmlObj.Header.Files[0].isExternal);
Assert.IsNotNull(xmlObj.Header.Files[0].Reference);
//Topic
Assert.IsNotNull(xmlObj.Topic);
Assert.IsNotNull(xmlObj.Topic.Guid);
Assert.IsNotNull(xmlObj.Topic.Title);
Assert.IsNotNull(xmlObj.Topic.TopicType);
Assert.IsNotNull(xmlObj.Topic.TopicStatus);
Assert.IsNotNull(xmlObj.Topic.AssignedTo);
Assert.IsNotNull(xmlObj.Topic.Stage);
Assert.IsNotNull(xmlObj.Topic.BimSnippet);
Assert.IsNotNull(xmlObj.Topic.BimSnippet.Reference);
Assert.IsNotNull(xmlObj.Topic.BimSnippet.SnippetType);
Assert.IsNotNull(xmlObj.Topic.BimSnippet.ReferenceSchema);
Assert.IsNotNull(xmlObj.Topic.BimSnippet.isExternal);
}

[TestMethod]
[DeploymentItem("2.0\\XML\\project20.xml")]
public void DeserializeProjectXML()
{
ProjectXMLFile xmlObj = new ProjectXMLFile(XDocument.Load("project20.xml"));

Assert.IsNotNull(xmlObj.ExtensionSchema);
Assert.IsNotNull(xmlObj.Project);
Assert.IsNotNull(xmlObj.Project.Name);
Assert.IsNotNull(xmlObj.Project.ProjectId);
}

[TestMethod]
[DeploymentItem("2.0\\XML\\version20.xml")]
public void DeserializeVersionXML()
{
VersionXMLFile xmlObj = new VersionXMLFile(XDocument.Load("version20.xml"));

Assert.IsNotNull(xmlObj.VersionId);
Assert.IsNotNull(xmlObj.DetailedVersion);
}

[TestMethod]
[DeploymentItem("2.0\\XML\\visinfo20.xml")]
public void DeserializeVisualizationXML()
{
VisualizationXMLFile xmlObj = new VisualizationXMLFile(XDocument.Load("visinfo20.xml"), version);

//Bitmaps
Assert.IsTrue(xmlObj.Bitmaps.Count > 0);
Assert.IsNotNull(xmlObj.Bitmaps[0].Bitmap);
Assert.IsNotNull(xmlObj.Bitmaps[0].Height);
Assert.IsNotNull(xmlObj.Bitmaps[0].Location);
Assert.IsNotNull(xmlObj.Bitmaps[0].Normal);
Assert.IsNotNull(xmlObj.Bitmaps[0].Reference);
Assert.IsNotNull(xmlObj.Bitmaps[0].Up);
//ClippingPlanes
Assert.IsTrue(xmlObj.ClippingPlanes.Count > 0);
Assert.IsNotNull(xmlObj.ClippingPlanes[0].Direction);
Assert.IsNotNull(xmlObj.ClippingPlanes[0].Location);
//Components
Assert.IsTrue(xmlObj.Components.Selection.Components.Count > 0);
Assert.IsNotNull(xmlObj.Components.Selection.Components[0].AuthoringToolId);
Assert.IsNotNull(xmlObj.Components.Colorings[0].Color);
Assert.IsNotNull(xmlObj.Components.Selection.Components[0].IfcGuid);
Assert.IsNotNull(xmlObj.Components.Selection.Components[0].OriginatingSystem);
Assert.IsNotNull(xmlObj.Components.Selection.Components[0]);
Assert.IsNotNull(xmlObj.Components.Visibility.Exceptions[0]);
//Lines
Assert.IsTrue(xmlObj.Lines.Count > 0);
Assert.IsNotNull(xmlObj.Lines[0].StartPoint);
Assert.IsNotNull(xmlObj.Lines[0].EndPoint);
//Orth Camera
Assert.IsNotNull(xmlObj.OrthogonalCamera);
Assert.IsNotNull(xmlObj.OrthogonalCamera.CameraDirection);
Assert.IsNotNull(xmlObj.OrthogonalCamera.CameraUpVector);
Assert.IsNotNull(xmlObj.OrthogonalCamera.CameraViewPoint);
Assert.IsNotNull(xmlObj.OrthogonalCamera.ViewToWorldScale);
//Pers Camera
Assert.IsNotNull(xmlObj.PerspectiveCamera);
Assert.IsNotNull(xmlObj.PerspectiveCamera.CameraDirection);
Assert.IsNotNull(xmlObj.PerspectiveCamera.CameraUpVector);
Assert.IsNotNull(xmlObj.PerspectiveCamera.CameraViewPoint);
Assert.IsNotNull(xmlObj.PerspectiveCamera.FieldOfView);
}
}
}
4 changes: 4 additions & 0 deletions Xbim.BCF.Tests/2.0/XML/Readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Generated from Schemas at https://github.com/BuildingSMART/BCF-XML/tree/master/Schemas
Added as part of backwards compatibility tests with BCF 2.0
Correct as of 16 November 2017
Guids don't seem to generate properly so amend them by hand
102 changes: 102 additions & 0 deletions Xbim.BCF.Tests/2.0/XML/markup20.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<?xml version="1.0" encoding="utf-8"?>
<Markup>
<Header>
<File IfcProject="IfcProject___________1" IfcSpatialStructureElement="IfcSpatialStructureEl1" isExternal="true">
<Filename>Filename1</Filename>
<Date>1900-01-01T01:01:01+01:00</Date>
<Reference>Reference1</Reference>
</File>
<File IfcProject="IfcProject___________2" IfcSpatialStructureElement="IfcSpatialStructureEl2" isExternal="true">
<Filename>Filename2</Filename>
<Date>0001-01-01T00:00:00+01:00</Date>
<Reference>Reference2</Reference>
</File>
<File IfcProject="IfcProject___________3" IfcSpatialStructureElement="IfcSpatialStructureEl3" isExternal="false">
<Filename>Filename3</Filename>
<Date>9999-12-31T23:59:59.9999999+01:00</Date>
<Reference>Reference3</Reference>
</File>
</Header>
<Topic Guid="2158b50f-8069-4ec5-a1b1-f2df82ad1ea0" TopicType="TopicType1" TopicStatus="TopicStatus1">
<ReferenceLink>ReferenceLink1</ReferenceLink>
<Title>Title1</Title>
<Priority>Priority1</Priority>
<Index>1</Index>
<Labels>Labels1</Labels>
<Labels>Labels2</Labels>
<Labels>Labels3</Labels>
<CreationDate>1900-01-01T01:01:01+01:00</CreationDate>
<CreationAuthor>CreationAuthor1</CreationAuthor>
<ModifiedDate>1900-01-01T01:01:01+01:00</ModifiedDate>
<ModifiedAuthor>ModifiedAuthor1</ModifiedAuthor>
<AssignedTo>AssignedTo1</AssignedTo>
<Description>Description1</Description>
<BimSnippet SnippetType="SnippetType1" isExternal="false">
<Reference>Reference1</Reference>
<ReferenceSchema>ReferenceSchema1</ReferenceSchema>
</BimSnippet>
<DocumentReferences Guid="2158b50f-8069-4ec5-a1b1-f2df82ad1ea0" isExternal="false">
<ReferencedDocument>ReferencedDocument1</ReferencedDocument>
<Description>Description1</Description>
</DocumentReferences>
<DocumentReferences Guid="2158b50f-8069-4ec5-a1b1-f2df82ad1ea0" isExternal="true">
<ReferencedDocument>ReferencedDocument2</ReferencedDocument>
<Description>Description2</Description>
</DocumentReferences>
<DocumentReferences Guid="2158b50f-8069-4ec5-a1b1-f2df82ad1ea0" isExternal="false">
<ReferencedDocument>ReferencedDocument3</ReferencedDocument>
<Description>Description3</Description>
</DocumentReferences>
<RelatedTopics Guid="2158b50f-8069-4ec5-a1b1-f2df82ad1ea0" />
<RelatedTopics Guid="2158b50f-8069-4ec5-a1b1-f2df82ad1ea0" />
<RelatedTopics Guid="2158b50f-8069-4ec5-a1b1-f2df82ad1ea0" />
</Topic>
<Comment Guid="2158b50f-8069-4ec5-a1b1-f2df82ad1ea0">
<VerbalStatus>VerbalStatus1</VerbalStatus>
<Status>Unknown</Status>
<Date>1900-01-01T01:01:01+01:00</Date>
<Author>Author1</Author>
<Comment>Comment1</Comment>
<Topic Guid="2158b50f-8069-4ec5-a1b1-f2df82ad1ea0" />
<Viewpoint Guid="2158b50f-8069-4ec5-a1b1-f2df82ad1ea0" />
<ReplyToComment Guid="2158b50f-8069-4ec5-a1b1-f2df82ad1ea0" />
<ModifiedDate>1900-01-01T01:01:01+01:00</ModifiedDate>
<ModifiedAuthor>ModifiedAuthor1</ModifiedAuthor>
</Comment>
<Comment Guid="2158b50f-8069-4ec5-a1b1-f2df82ad1ea0">
<VerbalStatus>VerbalStatus2</VerbalStatus>
<Status>Status1</Status>
<Date>2001-01-01T00:00:00+01:00</Date>
<Author>Author2</Author>
<Comment>Comment2</Comment>
<Topic Guid="2158b50f-8069-4ec5-a1b1-f2df82ad1ea0" />
<Viewpoint Guid="2158b50f-8069-4ec5-a1b1-f2df82ad1ea0" />
<ReplyToComment Guid="2158b50f-8069-4ec5-a1b1-f2df82ad1ea0" />
<ModifiedDate>0001-01-01T00:00:00+01:00</ModifiedDate>
<ModifiedAuthor>ModifiedAuthor2</ModifiedAuthor>
</Comment>
<Comment Guid="2158b50f-8069-4ec5-a1b1-f2df82ad1ea0">
<VerbalStatus>VerbalStatus3</VerbalStatus>
<Status>Status2</Status>
<Date>9999-12-31T23:59:59.9999999+01:00</Date>
<Author>Author3</Author>
<Comment>Comment3</Comment>
<Topic Guid="2158b50f-8069-4ec5-a1b1-f2df82ad1ea0" />
<Viewpoint Guid="2158b50f-8069-4ec5-a1b1-f2df82ad1ea0" />
<ReplyToComment Guid="2158b50f-8069-4ec5-a1b1-f2df82ad1ea0" />
<ModifiedDate>9999-12-31T23:59:59.9999999+01:00</ModifiedDate>
<ModifiedAuthor>ModifiedAuthor3</ModifiedAuthor>
</Comment>
<Viewpoints Guid="2158b50f-8069-4ec5-a1b1-f2df82ad1ea0">
<Viewpoint>Viewpoint1</Viewpoint>
<Snapshot>Snapshot1</Snapshot>
</Viewpoints>
<Viewpoints Guid="2158b50f-8069-4ec5-a1b1-f2df82ad1ea0">
<Viewpoint>Viewpoint2</Viewpoint>
<Snapshot>Snapshot2</Snapshot>
</Viewpoints>
<Viewpoints Guid="2158b50f-8069-4ec5-a1b1-f2df82ad1ea0">
<Viewpoint>Viewpoint3</Viewpoint>
<Snapshot>Snapshot3</Snapshot>
</Viewpoints>
</Markup>
7 changes: 7 additions & 0 deletions Xbim.BCF.Tests/2.0/XML/project20.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<ProjectExtension>
<Project ProjectId="ProjectId1">
<Name>Name1</Name>
</Project>
<ExtensionSchema>http://uri1</ExtensionSchema>
</ProjectExtension>
4 changes: 4 additions & 0 deletions Xbim.BCF.Tests/2.0/XML/version20.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Version VersionId="VersionId1">
<DetailedVersion>DetailedVersion1</DetailedVersion>
</Version>
Loading