From b2112d441c165820169b3cffc136a66b51a9ad80 Mon Sep 17 00:00:00 2001 From: James Friel Date: Fri, 24 Jan 2025 10:35:49 +0000 Subject: [PATCH] update tests --- .../WindowManagement/HomePane/HomeUI.cs | 4 +-- Rdmp.UI.Tests/CatalogueUITests.cs | 16 +++++++--- Rdmp.UI/Collections/CatalogueCollectionUI.cs | 2 -- Rdmp.UI/Collections/DataExportCollectionUI.cs | 3 -- Rdmp.UI/Collections/FavouritesCollectionUI.cs | 1 - .../MainFormUITabs/CatalogueUI.Designer.cs | 31 +++++++++++++++++-- Rdmp.UI/MainFormUITabs/CatalogueUI.cs | 5 +-- .../SimpleControls/MultiSelectChips/Chip.cs | 17 ---------- 8 files changed, 41 insertions(+), 38 deletions(-) diff --git a/Application/ResearchDataManagementPlatform/WindowManagement/HomePane/HomeUI.cs b/Application/ResearchDataManagementPlatform/WindowManagement/HomePane/HomeUI.cs index 232eeac29b..4f57024a56 100644 --- a/Application/ResearchDataManagementPlatform/WindowManagement/HomePane/HomeUI.cs +++ b/Application/ResearchDataManagementPlatform/WindowManagement/HomePane/HomeUI.cs @@ -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(); } } \ No newline at end of file diff --git a/Rdmp.UI.Tests/CatalogueUITests.cs b/Rdmp.UI.Tests/CatalogueUITests.cs index 0630dcaac1..a6175672c4 100644 --- a/Rdmp.UI.Tests/CatalogueUITests.cs +++ b/Rdmp.UI.Tests/CatalogueUITests.cs @@ -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(() => { @@ -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)); }); @@ -51,7 +51,7 @@ 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")); }); @@ -59,14 +59,14 @@ public void Test_CatalogueUI_NormalState() 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")); }); @@ -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); } diff --git a/Rdmp.UI/Collections/CatalogueCollectionUI.cs b/Rdmp.UI/Collections/CatalogueCollectionUI.cs index 2bd6ea9d71..7a1c34deb4 100644 --- a/Rdmp.UI/Collections/CatalogueCollectionUI.cs +++ b/Rdmp.UI/Collections/CatalogueCollectionUI.cs @@ -38,8 +38,6 @@ namespace Rdmp.UI.Collections; /// /// Pressing the Del key will prompt you to delete the selected item. /// -/// By default Deprecated, Internal and ColdStorage Catalogues do not appear, you can turn visibility of these on by selecting the relevant tick boxes. -/// /// 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. /// diff --git a/Rdmp.UI/Collections/DataExportCollectionUI.cs b/Rdmp.UI/Collections/DataExportCollectionUI.cs index cf82915fc4..425a7bca07 100644 --- a/Rdmp.UI/Collections/DataExportCollectionUI.cs +++ b/Rdmp.UI/Collections/DataExportCollectionUI.cs @@ -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() diff --git a/Rdmp.UI/Collections/FavouritesCollectionUI.cs b/Rdmp.UI/Collections/FavouritesCollectionUI.cs index 57a9c1d233..0609422418 100644 --- a/Rdmp.UI/Collections/FavouritesCollectionUI.cs +++ b/Rdmp.UI/Collections/FavouritesCollectionUI.cs @@ -57,7 +57,6 @@ public override void SetItemActivator(IActivateItems activator) public void RefreshBus_RefreshObject(object sender, RefreshObjectEventArgs e) { - //maybe this? RefreshFavourites(); } diff --git a/Rdmp.UI/MainFormUITabs/CatalogueUI.Designer.cs b/Rdmp.UI/MainFormUITabs/CatalogueUI.Designer.cs index d8908aaa42..d4408732e4 100644 --- a/Rdmp.UI/MainFormUITabs/CatalogueUI.Designer.cs +++ b/Rdmp.UI/MainFormUITabs/CatalogueUI.Designer.cs @@ -41,6 +41,8 @@ private void InitializeComponent() ticketingControl1 = new TicketingControlUI(); tabControl1 = new TabControl(); tabPage1 = new TabPage(); + groupBox23 = new GroupBox(); + tbAcronym = new TextBox(); groupBox16 = new GroupBox(); tbDescription = new TextBox(); groupBox15 = new GroupBox(); @@ -101,6 +103,7 @@ private void InitializeComponent() splitContainer1.SuspendLayout(); tabControl1.SuspendLayout(); tabPage1.SuspendLayout(); + groupBox23.SuspendLayout(); groupBox16.SuspendLayout(); groupBox15.SuspendLayout(); tabPage2.SuspendLayout(); @@ -229,6 +232,7 @@ private void InitializeComponent() // tabPage1 // tabPage1.BackColor = System.Drawing.Color.WhiteSmoke; + tabPage1.Controls.Add(groupBox23); tabPage1.Controls.Add(groupBox16); tabPage1.Controls.Add(groupBox15); tabPage1.Location = new System.Drawing.Point(4, 24); @@ -239,10 +243,27 @@ private void InitializeComponent() tabPage1.Text = "Descriptions"; tabPage1.Click += tabPage1_Click; // + // groupBox23 + // + groupBox23.Controls.Add(tbAcronym); + groupBox23.Location = new System.Drawing.Point(7, 6); + groupBox23.Name = "groupBox23"; + groupBox23.Size = new System.Drawing.Size(231, 56); + groupBox23.TabIndex = 6; + groupBox23.TabStop = false; + groupBox23.Text = "Acronym"; + // + // tbAcronym + // + tbAcronym.Location = new System.Drawing.Point(6, 22); + tbAcronym.Name = "tbAcronym"; + tbAcronym.Size = new System.Drawing.Size(201, 23); + tbAcronym.TabIndex = 0; + // // groupBox16 // groupBox16.Controls.Add(tbDescription); - groupBox16.Location = new System.Drawing.Point(7, 167); + groupBox16.Location = new System.Drawing.Point(7, 225); groupBox16.Name = "groupBox16"; groupBox16.Size = new System.Drawing.Size(866, 165); groupBox16.TabIndex = 5; @@ -261,7 +282,7 @@ private void InitializeComponent() // groupBox15 // groupBox15.Controls.Add(tbAbstract); - groupBox15.Location = new System.Drawing.Point(7, 6); + groupBox15.Location = new System.Drawing.Point(7, 64); groupBox15.Name = "groupBox15"; groupBox15.Size = new System.Drawing.Size(863, 155); groupBox15.TabIndex = 4; @@ -795,6 +816,8 @@ private void InitializeComponent() splitContainer1.ResumeLayout(false); tabControl1.ResumeLayout(false); tabPage1.ResumeLayout(false); + groupBox23.ResumeLayout(false); + groupBox23.PerformLayout(); groupBox16.ResumeLayout(false); groupBox16.PerformLayout(); groupBox15.ResumeLayout(false); @@ -861,7 +884,7 @@ private void InitializeComponent() private TabPage tabPage4; private TabPage tabPage5; private TabPage tabPage6; - private TextBox tbDescription; + public TextBox tbDescription; private TextBox tbDataSource; private ComboBox cb_resourceType; private TextBox tbDataSourceSetting; @@ -910,5 +933,7 @@ private void InitializeComponent() private SimpleControls.MultiSelectChips.DropdownOptionsChipDisplay ddDatasetSubtype; private SimpleControls.MultiSelectChips.DropdownOptionsChipDisplay ddDatasetType; private TableLayoutPanel tableLayoutPanel2; + private GroupBox groupBox23; + public TextBox tbAcronym; } } diff --git a/Rdmp.UI/MainFormUITabs/CatalogueUI.cs b/Rdmp.UI/MainFormUITabs/CatalogueUI.cs index e6c087f345..c9563b460f 100644 --- a/Rdmp.UI/MainFormUITabs/CatalogueUI.cs +++ b/Rdmp.UI/MainFormUITabs/CatalogueUI.cs @@ -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; } @@ -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) diff --git a/Rdmp.UI/SimpleControls/MultiSelectChips/Chip.cs b/Rdmp.UI/SimpleControls/MultiSelectChips/Chip.cs index 26a71f08bd..0d755a131e 100644 --- a/Rdmp.UI/SimpleControls/MultiSelectChips/Chip.cs +++ b/Rdmp.UI/SimpleControls/MultiSelectChips/Chip.cs @@ -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();