Skip to content

Commit

Permalink
Merge pull request #27 from ricaun-io/develop
Browse files Browse the repository at this point in the history
Version 0.5.2
  • Loading branch information
ricaun authored Apr 17, 2023
2 parents 095d980 + abc1747 commit 3ded467
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 6 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ 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.2] / 2023-04-17
### UI
- Update `NewPushButtonData` the default `Text` equals to `targetName`.
### Tests
- Add `RevitCreateItemsCommandTests`
- Add `RevitCreateItemsCommandSetTests`
- Update `RevitCreateItemsWithNameTests`

## [0.5.1] / 2023-04-14
### RibbonStackExtension
- Add RowStackedItems
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.1</Version>
<Version>1.5.2</Version>
<ProjectGuid>{f736f68f-7101-4640-9093-8715f88ccb95}</ProjectGuid>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using NUnit.Framework;

namespace ricaun.Revit.UI.Tests.Items.Commands
{
public class RevitCreateItemsCommandSetTests : BaseCreatePanelTests
{
[TestCase("Text")]
[TestCase("Command")]
public void CreatePushButton_Text(string text)
{
var ribbonItem = ribbonPanel.CreatePushButton<BaseCommand>(text);
Assert.AreEqual(text, ribbonItem.ItemText);
}

[TestCase("Text")]
[TestCase("Command")]
public void CreatePushButton_SetText(string text)
{
var ribbonItem = ribbonPanel.CreatePushButton<BaseCommand>()
.SetText(text);
Assert.AreEqual(text, ribbonItem.ItemText);
}

[TestCase("Tip")]
[TestCase("ToolTip")]
public void CreatePushButton_SetToolTip(string toolTip)
{
var ribbonItem = ribbonPanel.CreatePushButton<BaseCommand>()
.SetToolTip(toolTip);
Assert.AreEqual(toolTip, ribbonItem.ToolTip);
}

[TestCase("Description")]
[TestCase("LongDescription")]
public void CreatePushButton_SetLongDescription(string longDescription)
{
var ribbonItem = ribbonPanel.CreatePushButton<BaseCommand>()
.SetLongDescription(longDescription);
Assert.AreEqual(longDescription, ribbonItem.LongDescription);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using NUnit.Framework;
using System;

namespace ricaun.Revit.UI.Tests.Items.Commands
{
public class RevitCreateItemsCommandTests : BaseCreatePanelTests
{
[Test]
public void CreatePushButton()
{
var ribbonItem = ribbonPanel.CreatePushButton<BaseCommand>();
Console.WriteLine(ribbonItem.Name);
Assert.AreEqual(nameof(BaseCommand), ribbonItem.Name);
Assert.AreEqual(nameof(BaseCommand), ribbonItem.ItemText);
}

[Test]
public void NewPushButtonData()
{
var ribbonItem = ribbonPanel.NewPushButtonData<BaseCommand>();
Console.WriteLine(ribbonItem.Name);
Assert.AreEqual(nameof(BaseCommand), ribbonItem.Name);
Assert.AreEqual(nameof(BaseCommand), ribbonItem.Text);
}

[Test]
public void NewPushButtonData_Type()
{
var ribbonItem = ribbonPanel.NewPushButtonData(typeof(BaseCommand));
Console.WriteLine(ribbonItem.Name);
Assert.AreEqual(nameof(BaseCommand), ribbonItem.Name);
Assert.AreEqual(nameof(BaseCommand), ribbonItem.Text);
}

[Test]
public void NewToggleButtonData()
{
var ribbonItem = ribbonPanel.NewToggleButtonData<BaseCommand>();
Console.WriteLine(ribbonItem.Name);
Assert.AreEqual(nameof(BaseCommand), ribbonItem.Name);
Assert.AreEqual(nameof(BaseCommand), ribbonItem.Text);
}
}
}
9 changes: 6 additions & 3 deletions ricaun.Revit.UI.Tests/Items/RevitCreateItemsWithNameTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ namespace ricaun.Revit.UI.Tests.Items
{
public class RevitCreateItemsWithNameTests : BaseCreatePanelTests
{
[TestCase(null)]
[TestCase("")]
[TestCase(" ")]
[TestCase("Name")]
Expand All @@ -12,6 +13,7 @@ public void CreateComboBox(string name)
ribbonPanel.CreateComboBox(name);
}

[TestCase(null)]
[TestCase("")]
[TestCase(" ")]
[TestCase("Name")]
Expand All @@ -20,6 +22,7 @@ public void CreatePulldownButton(string name)
ribbonPanel.CreatePulldownButton(name);
}

[TestCase(null)]
[TestCase("")]
[TestCase(" ")]
[TestCase("Name")]
Expand All @@ -28,6 +31,7 @@ public void CreatePushButton(string name)
ribbonPanel.CreatePushButton<BaseCommand>(name);
}

[TestCase(null)]
[TestCase("")]
[TestCase(" ")]
[TestCase("Name")]
Expand All @@ -36,6 +40,7 @@ public void CreateRadioButtonGroup(string name)
ribbonPanel.CreateRadioButtonGroup(name);
}

[TestCase(null)]
[TestCase("")]
[TestCase(" ")]
[TestCase("Name")]
Expand All @@ -44,6 +49,7 @@ public void CreateSplitButton(string name)
ribbonPanel.CreateSplitButton(name);
}

[TestCase(null)]
[TestCase("")]
[TestCase(" ")]
[TestCase("Name")]
Expand All @@ -52,7 +58,4 @@ public void CreateTextBox(string name)
ribbonPanel.CreateTextBox(name);
}
}



}
2 changes: 1 addition & 1 deletion ricaun.Revit.UI/RibbonSafeExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ internal static T NewPushButtonData<T>(object ribbonItem, Type commandType, stri
buttonData.AvailabilityClassName = commandType.FullName;

if (string.IsNullOrWhiteSpace(text))
buttonData.Text = SafeMinimalText;
buttonData.Text = targetName;

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

<PropertyGroup>
<PackageId>ricaun.Revit.UI</PackageId>
<Version>0.5.1</Version>
<Version>0.5.2</Version>
<ProjectGuid>{2064ba4d-5527-41e9-8b76-0cbfefa35900}</ProjectGuid>
</PropertyGroup>

Expand Down

0 comments on commit 3ded467

Please sign in to comment.