Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JFriel committed Jan 24, 2025
1 parent 46404a7 commit b2112d4
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ protected override void OnLoad(EventArgs e)

public void RefreshBus_RefreshObject(object sender, RefreshObjectEventArgs e)
{

//todo what does this do?
//BuildCommandLists();
BuildCommandLists();
}
}
16 changes: 11 additions & 5 deletions Rdmp.UI.Tests/CatalogueUITests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void Test_CatalogueUI_NormalState()
Assert.That(cata.HasLocalChanges().Evaluation, Is.EqualTo(ChangeDescription.NoChanges));

//but when I type text
ui._scintillaDescription.Text = "amagad zombies";
ui.tbDescription.Text = "amagad zombies";

Assert.Multiple(() =>
{
Expand All @@ -42,7 +42,7 @@ public void Test_CatalogueUI_NormalState()
Assert.Multiple(() =>
{
//it should set the text editor back to blank
Assert.That(ui._scintillaDescription.Text, Is.EqualTo(""));
Assert.That(ui.tbDescription.Text, Is.EqualTo(""));
//and clear my class property
Assert.That(cata.Description, Is.EqualTo(null));
});
Expand All @@ -51,22 +51,22 @@ public void Test_CatalogueUI_NormalState()
saver.Redo();
Assert.Multiple(() =>
{
Assert.That(ui._scintillaDescription.Text, Is.EqualTo("amagad zombies"));
Assert.That(ui.tbDescription.Text, Is.EqualTo("amagad zombies"));
Assert.That(cata.Description, Is.EqualTo("amagad zombies"));
});

//undo a redo should still be valid
saver.Undo();
Assert.Multiple(() =>
{
Assert.That(ui._scintillaDescription.Text, Is.EqualTo(""));
Assert.That(ui.tbDescription.Text, Is.EqualTo(""));
Assert.That(cata.Description, Is.EqualTo(null));
});

saver.Redo();
Assert.Multiple(() =>
{
Assert.That(ui._scintillaDescription.Text, Is.EqualTo("amagad zombies"));
Assert.That(ui.tbDescription.Text, Is.EqualTo("amagad zombies"));
Assert.That(cata.Description, Is.EqualTo("amagad zombies"));
});

Expand Down Expand Up @@ -113,9 +113,15 @@ public void Test_CatalogueUI_AcronymDuplicates()

AssertNoErrors(ExpectedErrorType.Any);

//when I type the Acronym of another Catalogue
ui.tbAcronym.Text = "AB";

//it tells me that I have to make it unique
AssertErrorWasShown(ExpectedErrorType.ErrorProvider, "Must be unique");

//so I make it unique
ui.tbAcronym.Text = "ABC";

//and all is good again
AssertNoErrors(ExpectedErrorType.Any);
}
Expand Down
2 changes: 0 additions & 2 deletions Rdmp.UI/Collections/CatalogueCollectionUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ namespace Rdmp.UI.Collections;
///
/// <para>Pressing the Del key will prompt you to delete the selected item.</para>
///
/// <para>By default Deprecated, Internal and ColdStorage Catalogues do not appear, you can turn visibility of these on by selecting the relevant tick boxes.</para>
///
/// <para>Finally you can launch 'Checking' for every dataset, this will attempt to verify the extraction SQL you
/// have configured for each dataset and to ensure that it runs and that at least 1 row of data is returned. Checking all the datasets can take a while so runs asynchronously.</para>
/// </summary>
Expand Down
3 changes: 0 additions & 3 deletions Rdmp.UI/Collections/DataExportCollectionUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,7 @@ public override void SetItemActivator(IActivateItems activator)

public void RefreshBus_RefreshObject(object sender, RefreshObjectEventArgs e)
{
if (e.Object.GetType() == typeof(Project))
{
SetupToolStrip();
}
}

private void SetupToolStrip()
Expand Down
1 change: 0 additions & 1 deletion Rdmp.UI/Collections/FavouritesCollectionUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ public override void SetItemActivator(IActivateItems activator)

public void RefreshBus_RefreshObject(object sender, RefreshObjectEventArgs e)
{
//maybe this?
RefreshFavourites();
}

Expand Down
31 changes: 28 additions & 3 deletions Rdmp.UI/MainFormUITabs/CatalogueUI.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions Rdmp.UI/MainFormUITabs/CatalogueUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@ public CatalogueUI()

AssociatedCollection = RDMPCollection.Catalogue;

//c_ddType.DataSource = Enum.GetValues(typeof(Catalogue.CatalogueType));
//c_ddPeriodicity.DataSource = Enum.GetValues(typeof(Catalogue.CataloguePeriodicity));
//c_ddGranularity.DataSource = Enum.GetValues(typeof(Catalogue.CatalogueGranularity));

UseCommitSystem = true;
}

Expand Down Expand Up @@ -340,6 +336,7 @@ private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
{
item.Visible = false;
}
Bind(tbAcronym, "Text", "Acronym", c => c.Acronym);
Bind(tbAbstract, "Text", "ShortDescription", c => c.ShortDescription);
Bind(tbDescription, "Text", "Description", c => c.Description);
foreach (Control item in tabPage1.Controls)
Expand Down
17 changes: 0 additions & 17 deletions Rdmp.UI/SimpleControls/MultiSelectChips/Chip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,27 +44,10 @@ public int Radius
private static extern IntPtr CreateRoundRectRgn(int nLeftRect, int nTopRect,
int nRightRect, int nBottomRect, int nWidthEllipse, int nHeightEllipse);

private GraphicsPath GetRoundRectagle(Rectangle bounds, int radius)
{
float r = radius;
GraphicsPath path = new GraphicsPath();
path.StartFigure();
path.AddArc(bounds.Left, bounds.Top, r, r, 180, 90);
path.AddArc(bounds.Right - r, bounds.Top, r, r, 270, 90);
path.AddArc(bounds.Right - r, bounds.Bottom - r, r, r, 0, 90);
path.AddArc(bounds.Left, bounds.Bottom - r, r, r, 90, 90);
path.CloseFigure();
return path;
}

private void RecreateRegion()
{
var bounds = ClientRectangle;

//using (var path = GetRoundRectagle(bounds, this.Radius))
// this.Region = new Region(path);

//Better round rectangle
this.Region = Region.FromHrgn(CreateRoundRectRgn(bounds.Left, bounds.Top,
bounds.Right, bounds.Bottom, Radius, radius));
this.Invalidate();
Expand Down

0 comments on commit b2112d4

Please sign in to comment.