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

Version 0.5.6 #31

Merged
merged 5 commits into from
Nov 9, 2023
Merged
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
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [0.5.6] / 2023-11-08
### Features
- Update Remove and QuickAccess
### Updated
- Update `QuickAccessToolBarExtension` with internal methods.
- Update `MoveToRibbonTab` to move to `Modify` tab.
### Tests
- Add Tests for `QuickAccessToolBarExtension`
- Add Tests for `RibbonHelp` and `RibbonItem`
- Add Tests for `AppLoader`
- Add Tests for `MoveToRibbonTab`

## [0.5.5] / 2023-11-03
### Features
- Language Update and Test
Expand Down Expand Up @@ -279,6 +291,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- First Release

[vNext]: ../../compare/1.0.0...HEAD
[0.5.6]: ../../compare/0.5.5...0.5.6
[0.5.5]: ../../compare/0.5.4...0.5.5
[0.5.4]: ../../compare/0.5.3...0.5.4
[0.5.3]: ../../compare/0.5.2...0.5.3
Expand Down
6 changes: 2 additions & 4 deletions ricaun.Revit.UI.Example/Revit/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

namespace ricaun.Revit.UI.Example.Revit
{
[AppLoader]
//[AppLoader]
//[Obsolete]
public class App : IExternalApplication
{
Expand Down Expand Up @@ -278,9 +278,6 @@ private void AddNewPanelToMove(UIControlledApplication application)
.SetLargeImage("/UIFrameworkRes;component/ribbon/images/revit.ico");
}




//Console.WriteLine($">> {split}");

//var ribbonItem = button.GetRibbonItem();
Expand Down Expand Up @@ -623,6 +620,7 @@ public Result OnShutdown(UIControlledApplication application)
{
ribbonPanelMove?.Remove(true);
ribbonPanel?.Remove(true);

return Result.Succeeded;
}

Expand Down
2 changes: 2 additions & 0 deletions ricaun.Revit.UI.Example/Revit/AppExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public Result OnStartup(UIControlledApplication application)
.SetLongDescription("Esta é uma descrição.");
}

//ribbonPanel.MoveToRibbonTab();

return Result.Succeeded;
}

Expand Down
2 changes: 1 addition & 1 deletion ricaun.Revit.UI.Example/ricaun.Revit.UI.Example.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@

<PropertyGroup>
<PackageId>ricaun.Revit.UI.Example</PackageId>
<Version>1.5.4</Version>
<Version>0.5.6</Version>
<ProjectGuid>{f736f68f-7101-4640-9093-8715f88ccb95}</ProjectGuid>
</PropertyGroup>

Expand Down
14 changes: 14 additions & 0 deletions ricaun.Revit.UI.Tests/AppLoaderTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using NUnit.Framework;

namespace ricaun.Revit.UI.Tests
{
public class AppLoaderTests
{
[Test]
public void HasAppLoaderAttribute()
{
var name = typeof(AppLoaderAttribute).Name;
Assert.AreEqual("AppLoaderAttribute", name);
}
}
}
2 changes: 1 addition & 1 deletion ricaun.Revit.UI.Tests/Base/BaseCreatePanelTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public void SetUp(UIControlledApplication application)
}

[TearDown]
public void TearDown(UIControlledApplication application)
public void TearDown()
{
ribbonPanel?.Remove(true);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Autodesk.Revit.ApplicationServices;
using NUnit.Framework;

namespace ricaun.Revit.UI.Tests
namespace ricaun.Revit.UI.Tests.Extensions
{
public class RevitLanguageTests
{
Expand Down
29 changes: 29 additions & 0 deletions ricaun.Revit.UI.Tests/Extensions/RevitRibbonHelpTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using Autodesk.Revit.UI;
using NUnit.Framework;

namespace ricaun.Revit.UI.Tests.Extensions
{
public class RevitRibbonHelpTests
{
[TestCase("http")]
[TestCase("http://ricaun.com")]
[TestCase("https://ricaun.com")]
public void ContextualHelp_ShouldBe_Url(string helpPath)
{
var contextualHelp = RibbonHelpExtension.GetContextualHelp(helpPath);
Assert.AreEqual(ContextualHelpType.Url, contextualHelp.HelpType);
Assert.AreEqual(helpPath, contextualHelp.HelpPath);
}

[TestCase("file")]
[TestCase("help.pdf")]
[TestCase("ricaun.com")]
public void ContextualHelp_ShouldBe_ChmFile(string helpPath)
{
var contextualHelp = RibbonHelpExtension.GetContextualHelp(helpPath);
Assert.AreEqual(ContextualHelpType.ChmFile, contextualHelp.HelpType);
Assert.AreEqual(helpPath, contextualHelp.HelpPath);
}
}

}
34 changes: 34 additions & 0 deletions ricaun.Revit.UI.Tests/Extensions/RevitRibbonItemTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using NUnit.Framework;

namespace ricaun.Revit.UI.Tests.Extensions
{
public class RevitRibbonItemTests : BaseCreatePanelTests
{
[Test]
public void GetRibbonItem_NotNull()
{
var pushButton = ribbonPanel.CreatePushButton<BaseCommand>();
var ribbonItem = pushButton.GetRibbonItem();
Assert.IsNotNull(ribbonItem);
}

[Test]
public void GetRibbonItem_Alternative_NotNull()
{
var pushButton = ribbonPanel.CreatePushButton<BaseCommand>();
var ribbonItemAlternative = pushButton.GetRibbonItem_Alternative();
Assert.IsNotNull(ribbonItemAlternative);
}

[Test]
public void GetRibbonItem_EqualTo_Alternative()
{
var pushButton = ribbonPanel.CreatePushButton<BaseCommand>();
var ribbonItem = pushButton.GetRibbonItem();
var ribbonItemAlternative = pushButton.GetRibbonItem_Alternative();
Assert.AreEqual(ribbonItem, ribbonItemAlternative);
}

}

}
64 changes: 64 additions & 0 deletions ricaun.Revit.UI.Tests/Panels/RevitPanelMoveTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
using NUnit.Framework;
using System.Linq;

namespace ricaun.Revit.UI.Tests.Panels
{
public class RevitPanelMoveTests : BaseCreatePanelTests
{
private const string TabIdAddIns = "Add-Ins";
private const string TabIdModify = "Modify";

[Test]
public void CreatePanel_ShouldBe_AddIns()
{
Assert.AreEqual(TabIdAddIns, ribbonPanel.GetRibbonTab().Id);
}

[Test]
public void MovePanelTo_Modify()
{
ribbonPanel.MoveToRibbonTab();
Assert.AreEqual(TabIdModify, ribbonPanel.GetRibbonTab().Id);
}

[Test]
public void MovePanelWithId_Modify()
{
ribbonPanel.MoveToRibbonTab(TabIdModify);
Assert.AreEqual(TabIdModify, ribbonPanel.GetRibbonTab().Id);
}

[Test]
public void MovePanelWithId_Empty()
{
ribbonPanel.MoveToRibbonTab(string.Empty);
Assert.AreEqual(TabIdAddIns, ribbonPanel.GetRibbonTab().Id);
}

[Test]
public void MovePanelWithId_AddIns()
{
ribbonPanel.MoveToRibbonTab(TabIdModify);
ribbonPanel.MoveToRibbonTab(TabIdAddIns);
Assert.AreEqual(TabIdAddIns, ribbonPanel.GetRibbonTab().Id);
}

[Test]
public void MovePanelWithTab_First()
{
var ribbonTab = RibbonTabExtension.GetRibbonTabs().FirstOrDefault();
ribbonPanel.MoveToRibbonTab(ribbonTab);
Assert.AreEqual(ribbonTab, ribbonPanel.GetRibbonTab());
}

[Test]
public void MovePanelWithTab_ForEach()
{
foreach (var ribbonTab in RibbonTabExtension.GetRibbonTabs())
{
ribbonPanel.MoveToRibbonTab(ribbonTab);
Assert.AreEqual(ribbonTab, ribbonPanel.GetRibbonTab());
}
}
}
}
95 changes: 95 additions & 0 deletions ricaun.Revit.UI.Tests/Panels/RevitPanelQuickAccessTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
using Autodesk.Revit.UI;
using NUnit.Framework;

namespace ricaun.Revit.UI.Tests.Panels
{
public class RevitPanelQuickAccessTests
{
private const string PanelName = "Example";

[Test]
public void Internal_HasQuickAccessToolBar_IgnoreNull()
{
Autodesk.Windows.RibbonItem ribbonItem = null;
Assert.IsFalse(ribbonItem.HasQuickAccessToolBar());
}

[Test]
public void Internal_GetQuickAccessToolBar_IgnoreNull()
{
Autodesk.Windows.RibbonItem ribbonItem = null;
Assert.IsNull(ribbonItem.GetQuickAccessToolBar());
}

[Test]
public void PushButton_AddQuickAccessToolBar(UIControlledApplication application)
{
var panel = application.CreatePanel(PanelName);
var pushButton = panel.CreatePushButton<BaseCommand>();
var ribbonItem = pushButton.GetRibbonItem();
Assert.IsFalse(ribbonItem.HasQuickAccessToolBar(), "Should not has QuickAccess after Create");
try
{
pushButton.AddQuickAccessToolBar();
Assert.IsTrue(ribbonItem.HasQuickAccessToolBar(), "Should has QuickAccess after AddQuickAccessToolBar");
}
finally
{
panel.Remove(true);
Assert.IsFalse(ribbonItem.HasQuickAccessToolBar(), "Should not has QuickAccess after Remove(true)");
}
}

[Test]
public void PushButton_AddRemoveQuickAccessToolBar(UIControlledApplication application)
{
var panel = application.CreatePanel(PanelName);
var pushButton = panel.CreatePushButton<BaseCommand>();
var ribbonItem = pushButton.GetRibbonItem();
Assert.IsFalse(ribbonItem.HasQuickAccessToolBar(), "Should not has QuickAccess after Create");

try
{
pushButton.AddQuickAccessToolBar();
Assert.IsTrue(ribbonItem.HasQuickAccessToolBar(), "Should has QuickAccess after AddQuickAccessToolBar");

pushButton.RemoveQuickAccessToolBar();
Assert.IsFalse(ribbonItem.HasQuickAccessToolBar(), "Should has not QuickAccess after RemoveQuickAccessToolBar");
}
finally
{
panel.Remove(true);
}
}

[Test]
public void RibbonItem_AddRemoveQuickAccessToolBar(UIControlledApplication application)
{
var panel = application.CreatePanel(PanelName);
var pushButton = panel.CreatePushButton<BaseCommand>();
var ribbonItem = pushButton.GetRibbonItem();
Assert.IsFalse(ribbonItem.HasQuickAccessToolBar(), "Should not has QuickAccess after Create");

try
{
ribbonItem.AddQuickAccessToolBar();
Assert.IsTrue(ribbonItem.HasQuickAccessToolBar(), "Should has QuickAccess after AddQuickAccessToolBar");

ribbonItem.RemoveQuickAccessToolBar();
Assert.IsFalse(ribbonItem.HasQuickAccessToolBar(), "Should has not QuickAccess after RemoveQuickAccessToolBar");
}
finally
{
panel.Remove(true);
}
}

[Test]
public void RemovePanel_QuickAccess_IgnoreIfNull()
{
RibbonPanel panel = null;
Assert.IsNull(panel);
panel.Remove(true);
}
}
}
Loading
Loading