mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-23 20:36:33 +01:00
Small modification to the way the treeview is updated when the View settings change.
Fixed some memory leaks in the wizard and dialog tests. Updated broken Searcher tests. Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
parent
3d8483b9f3
commit
dbf44fff21
@ -179,6 +179,11 @@ namespace XenAdmin.Controls.MainWindowControls
|
||||
return navigationView.TryToSelectNewNode(tagMatch, selectNode, expandNode, ensureNodeVisible);
|
||||
}
|
||||
|
||||
public void UpdateSearch()
|
||||
{
|
||||
navigationView.CurrentSearch = Search;
|
||||
}
|
||||
|
||||
public void RequestRefreshTreeView()
|
||||
{
|
||||
navigationView.RequestRefreshTreeView();
|
||||
@ -194,6 +199,17 @@ namespace XenAdmin.Controls.MainWindowControls
|
||||
navigationView.MajorChange(() => navigationView.SaveAndRestoreTreeViewFocus(f));
|
||||
}
|
||||
|
||||
public void SwitchToNotificationsView(NotificationsSubMode subMode)
|
||||
{
|
||||
//check the button if switching has been requested programmatically
|
||||
if (!buttonNotifyBig.Checked)
|
||||
buttonNotifyBig.Checked = true;
|
||||
|
||||
notificationsView.Visible = true;
|
||||
notificationsView.SelectNotificationsSubMode(subMode);
|
||||
navigationView.Visible = false;
|
||||
}
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void AddNavigationItemPair(INavigationItem bigButton, INavigationItem smallButton)
|
||||
@ -239,13 +255,11 @@ namespace XenAdmin.Controls.MainWindowControls
|
||||
buttonSearchesBig.SetItemList(itemList.ToArray());
|
||||
}
|
||||
|
||||
public void OnSearchChanged()
|
||||
private void OnNavigationModeChanged()
|
||||
{
|
||||
if (currentMode == NavigationMode.Notifications)
|
||||
{
|
||||
notificationsView.Visible = true;
|
||||
notificationsView.SelectNotificationsSubMode(NotificationsSubMode.Alerts);
|
||||
navigationView.Visible = false;
|
||||
SwitchToNotificationsView(NotificationsSubMode.Alerts);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -325,7 +339,7 @@ namespace XenAdmin.Controls.MainWindowControls
|
||||
currentMode = NavigationMode.SavedSearch;
|
||||
}
|
||||
|
||||
OnSearchChanged();
|
||||
OnNavigationModeChanged();
|
||||
}
|
||||
|
||||
private void toolStripBig_LayoutCompleted(object sender, EventArgs e)
|
||||
|
@ -105,7 +105,7 @@ namespace XenAdmin
|
||||
set
|
||||
{
|
||||
if (value)
|
||||
navigationPane_NotificationsSubModeChanged(NotificationsSubMode.Events);
|
||||
navigationPane.SwitchToNotificationsView(NotificationsSubMode.Events);
|
||||
}
|
||||
}
|
||||
private bool ToolbarsEnabled;
|
||||
@ -589,15 +589,7 @@ namespace XenAdmin
|
||||
Launched = true;
|
||||
}
|
||||
|
||||
private void ExpandPanel(UserControl panel)
|
||||
{
|
||||
panel.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
|
||||
panel.Location = new Point(0, 0);
|
||||
panel.Size = new Size(panel.Parent.Width, panel.Parent.Height);
|
||||
}
|
||||
|
||||
// Manages UI and network updates whenever hosts are added and removed
|
||||
|
||||
void XenConnection_CollectionChanged(object sender, CollectionChangeEventArgs e)
|
||||
{
|
||||
if (Program.Exiting)
|
||||
@ -1842,25 +1834,36 @@ namespace XenAdmin
|
||||
private void templatesToolStripMenuItem1_Click(object sender, EventArgs e)
|
||||
{
|
||||
templatesToolStripMenuItem1.Checked = !templatesToolStripMenuItem1.Checked;
|
||||
XenAdmin.Properties.Settings.Default.DefaultTemplatesVisible = templatesToolStripMenuItem1.Checked;
|
||||
Settings.TrySaveSettings();
|
||||
navigationPane.OnSearchChanged();
|
||||
Properties.Settings.Default.DefaultTemplatesVisible = templatesToolStripMenuItem1.Checked;
|
||||
ViewSettingsChanged();
|
||||
}
|
||||
|
||||
private void customTemplatesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
customTemplatesToolStripMenuItem.Checked = !customTemplatesToolStripMenuItem.Checked;
|
||||
XenAdmin.Properties.Settings.Default.UserTemplatesVisible = customTemplatesToolStripMenuItem.Checked;
|
||||
Settings.TrySaveSettings();
|
||||
navigationPane.OnSearchChanged();
|
||||
Properties.Settings.Default.UserTemplatesVisible = customTemplatesToolStripMenuItem.Checked;
|
||||
ViewSettingsChanged();
|
||||
}
|
||||
|
||||
private void localStorageToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
localStorageToolStripMenuItem.Checked = !localStorageToolStripMenuItem.Checked;
|
||||
XenAdmin.Properties.Settings.Default.LocalSRsVisible = localStorageToolStripMenuItem.Checked;
|
||||
Properties.Settings.Default.LocalSRsVisible = localStorageToolStripMenuItem.Checked;
|
||||
ViewSettingsChanged();
|
||||
}
|
||||
|
||||
private void ShowHiddenObjectsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
ShowHiddenObjectsToolStripMenuItem.Checked = !ShowHiddenObjectsToolStripMenuItem.Checked;
|
||||
Properties.Settings.Default.ShowHiddenVMs = ShowHiddenObjectsToolStripMenuItem.Checked;
|
||||
ViewSettingsChanged();
|
||||
}
|
||||
|
||||
private void ViewSettingsChanged()
|
||||
{
|
||||
Settings.TrySaveSettings();
|
||||
navigationPane.OnSearchChanged();
|
||||
navigationPane.UpdateSearch();
|
||||
RequestRefreshTreeView();
|
||||
}
|
||||
|
||||
private void EditSelectedNodeInTreeView()
|
||||
@ -2364,14 +2367,6 @@ namespace XenAdmin
|
||||
Program.Invoke(this, UpdateToolbars);
|
||||
}
|
||||
|
||||
private void ShowHiddenObjectsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
ShowHiddenObjectsToolStripMenuItem.Checked = !ShowHiddenObjectsToolStripMenuItem.Checked;
|
||||
XenAdmin.Properties.Settings.Default.ShowHiddenVMs = ShowHiddenObjectsToolStripMenuItem.Checked;
|
||||
Settings.TrySaveSettings();
|
||||
navigationPane.OnSearchChanged();
|
||||
}
|
||||
|
||||
internal void OpenGlobalImportWizard(string param)
|
||||
{
|
||||
HelpersGUI.BringFormToFront(this);
|
||||
|
2
XenAdmin/TabPages/SearchPage.Designer.cs
generated
2
XenAdmin/TabPages/SearchPage.Designer.cs
generated
@ -153,7 +153,7 @@ namespace XenAdmin.TabPages
|
||||
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel;
|
||||
private XenAdmin.Controls.XenSearch.SearchOutput OutputPanel;
|
||||
public XenAdmin.Controls.XenSearch.Searcher Searcher;
|
||||
private XenAdmin.Controls.XenSearch.Searcher Searcher;
|
||||
private System.Windows.Forms.Panel panel2;
|
||||
private System.Windows.Forms.Panel panel4;
|
||||
private XenAdmin.Controls.DropDownButton ddButtonSavedSearches;
|
||||
|
@ -47,7 +47,7 @@ namespace XenAdminTests.DialogTests
|
||||
{
|
||||
RunBefore();
|
||||
|
||||
dialog = (T)MW<T>(NewDialog);
|
||||
dialog = MW<T>(NewDialog);
|
||||
|
||||
RunBeforeShow();
|
||||
|
||||
@ -60,7 +60,11 @@ namespace XenAdminTests.DialogTests
|
||||
// Any subsequent testing defined in derived class
|
||||
RunAfter();
|
||||
|
||||
MW(dialog.Close);
|
||||
MW(() =>
|
||||
{
|
||||
dialog.Close();
|
||||
dialog.Dispose();
|
||||
});
|
||||
}
|
||||
|
||||
protected abstract T NewDialog();
|
||||
|
@ -1,56 +0,0 @@
|
||||
/* Copyright (c) Citrix Systems Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using XenAdmin.Controls.XenSearch;
|
||||
using System.Windows.Forms;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace XenAdminTests
|
||||
{
|
||||
internal class DropDownComboButtonWrapper : TestWrapper<DropDownComboButton>
|
||||
{
|
||||
public DropDownComboButtonWrapper(DropDownComboButton item)
|
||||
: base(item)
|
||||
{
|
||||
}
|
||||
|
||||
public List<ToolStripItem> Items
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetField<List<ToolStripItem>>("Items");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -222,14 +222,6 @@ namespace XenAdminTests
|
||||
}
|
||||
}
|
||||
|
||||
public SearchPageWrapper SearchPage
|
||||
{
|
||||
get
|
||||
{
|
||||
return new SearchPageWrapper(Item.SearchPage);
|
||||
}
|
||||
}
|
||||
|
||||
public NetworkTabPageWrapper NetworkPage
|
||||
{
|
||||
get
|
||||
|
@ -1,59 +0,0 @@
|
||||
/* Copyright (c) Citrix Systems Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using XenAdmin.Controls.XenSearch;
|
||||
|
||||
namespace XenAdminTests
|
||||
{
|
||||
internal class QueryElementWrapper : TestWrapper<QueryElement>
|
||||
{
|
||||
public QueryElementWrapper(QueryElement item)
|
||||
: base(item)
|
||||
{
|
||||
}
|
||||
|
||||
public DropDownComboButtonWrapper ComboButton
|
||||
{
|
||||
get
|
||||
{
|
||||
return new DropDownComboButtonWrapper(GetField<DropDownComboButton>("ComboButton"));
|
||||
}
|
||||
}
|
||||
|
||||
public DropDownComboButtonWrapper QueryTypeComboButton
|
||||
{
|
||||
get
|
||||
{
|
||||
return new DropDownComboButtonWrapper(Item.queryTypeComboButton);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
/* Copyright (c) Citrix Systems Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using XenAdmin.Controls.XenSearch;
|
||||
|
||||
namespace XenAdminTests
|
||||
{
|
||||
internal class SearchForWrapper : TestWrapper<SearchFor>
|
||||
{
|
||||
public SearchForWrapper(SearchFor searchFor)
|
||||
: base(searchFor)
|
||||
{
|
||||
}
|
||||
|
||||
public DropDownComboButtonWrapper SearchForComboButton
|
||||
{
|
||||
get
|
||||
{
|
||||
return new DropDownComboButtonWrapper(GetField<DropDownComboButton>("searchForComboButton"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
/* Copyright (c) Citrix Systems Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using XenAdmin.TabPages;
|
||||
|
||||
namespace XenAdminTests
|
||||
{
|
||||
internal class SearchPageWrapper : TestWrapper<SearchPage>
|
||||
{
|
||||
public SearchPageWrapper(SearchPage searchPage)
|
||||
: base(searchPage)
|
||||
{
|
||||
}
|
||||
|
||||
public SearcherWrapper Searcher
|
||||
{
|
||||
get
|
||||
{
|
||||
return new SearcherWrapper(Item.Searcher);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
/* Copyright (c) Citrix Systems Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using XenAdmin.Controls.XenSearch;
|
||||
|
||||
namespace XenAdminTests
|
||||
{
|
||||
internal class SearcherWrapper : TestWrapper<Searcher>
|
||||
{
|
||||
public SearcherWrapper(Searcher searcher)
|
||||
: base(searcher)
|
||||
{
|
||||
}
|
||||
|
||||
public SearchForWrapper SearchFor
|
||||
{
|
||||
get
|
||||
{
|
||||
return new SearchForWrapper(GetField<SearchFor>("searchFor"));
|
||||
}
|
||||
}
|
||||
|
||||
public QueryElementWrapper QueryElement
|
||||
{
|
||||
get
|
||||
{
|
||||
return new QueryElementWrapper(Item.QueryElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -30,6 +30,8 @@
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using NUnit.Framework;
|
||||
using XenAdmin.Controls.XenSearch;
|
||||
using XenAdmin.CustomFields;
|
||||
@ -49,14 +51,48 @@ namespace XenAdminTests.SearchTests
|
||||
ApplyTreeSearch(string.Empty);
|
||||
|
||||
// set search to search-for-everything.
|
||||
MWWaitFor(() => Searcher.SearchFor.SearchForComboButton.Item.SelectItem<ObjectTypes>(o => o == ObjectTypes.AllExcFolders), "Couldn't select all-folders");
|
||||
MWWaitFor(() => SearchForComboButton.SelectItem<ObjectTypes>(o => o == ObjectTypes.AllExcFolders),
|
||||
"Couldn't select all-folders");
|
||||
}
|
||||
|
||||
private SearcherWrapper Searcher
|
||||
private Button NewSearchButton
|
||||
{
|
||||
get { return TestUtils.GetButton(MainWindowWrapper.Item, "SearchPage.buttonNewSearch"); }
|
||||
}
|
||||
|
||||
private Searcher SearcherPanel
|
||||
{
|
||||
get
|
||||
{
|
||||
return MainWindowWrapper.SearchPage.Searcher;
|
||||
return TestUtils.GetFieldDeep<Searcher>(MainWindowWrapper.Item,
|
||||
"SearchPage.Searcher");
|
||||
}
|
||||
}
|
||||
|
||||
private DropDownComboButton SearchForComboButton
|
||||
{
|
||||
get
|
||||
{
|
||||
return TestUtils.GetFieldDeep<DropDownComboButton>(SearcherPanel,
|
||||
"searchFor.searchForComboButton");
|
||||
}
|
||||
}
|
||||
|
||||
private DropDownComboButton ComboButton
|
||||
{
|
||||
get
|
||||
{
|
||||
return TestUtils.GetFieldDeep<DropDownComboButton>(SearcherPanel,
|
||||
"QueryElement.ComboButton");
|
||||
}
|
||||
}
|
||||
|
||||
private DropDownComboButton QueryTypeComboButton
|
||||
{
|
||||
get
|
||||
{
|
||||
return TestUtils.GetFieldDeep<DropDownComboButton>(SearcherPanel,
|
||||
"QueryElement.queryTypeComboButton");
|
||||
}
|
||||
}
|
||||
|
||||
@ -67,11 +103,14 @@ namespace XenAdminTests.SearchTests
|
||||
[Test]
|
||||
public void TestSearcherUpdatesWhenTagsChange()
|
||||
{
|
||||
MW(() => NewSearchButton.PerformClick());
|
||||
|
||||
// now test that the filter-value combo updates when the tags change for each of these objects.
|
||||
foreach (IXenObject xenObject in new IXenObject[] { GetAnyHost(), GetAnyNetwork(), GetAnyPool(), GetAnySR(), GetAnyVM() })
|
||||
{
|
||||
// select Tags for the query type
|
||||
MWWaitFor(() => Searcher.QueryElement.QueryTypeComboButton.Item.SelectItem<QueryElement.QueryType>(qt => qt.ToString() == "Tags"), "Couldn't select Tags");
|
||||
MWWaitFor(() => QueryTypeComboButton.SelectItem<QueryElement.QueryType>(qt => qt.ToString() == "Tags"),
|
||||
"Couldn't select Tags");
|
||||
|
||||
string newTag = Guid.NewGuid().ToString();
|
||||
|
||||
@ -79,15 +118,19 @@ namespace XenAdminTests.SearchTests
|
||||
Tags.AddTag(xenObject, newTag);
|
||||
|
||||
// now see if this new tag has been added to the searcher.
|
||||
MWWaitFor(() => null != Searcher.QueryElement.ComboButton.Items.Find(ts => ts.Text == newTag), "New tag not added to the Searcher with " + xenObject.GetType() + " selected.");
|
||||
MWWaitFor(() => null != ComboButton.Items.Find(ts => ts.Text == newTag),
|
||||
"New tag not added to the Searcher with " + xenObject.GetType() + " selected.");
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSearcherDoesntUpdateWhenTagsChangeOnUnsearchableObject()
|
||||
{
|
||||
MW(() => NewSearchButton.PerformClick());
|
||||
|
||||
// select Tags for the query type
|
||||
MWWaitFor(() => Searcher.QueryElement.QueryTypeComboButton.Item.SelectItem<QueryElement.QueryType>(qt => qt.ToString() == "Tags"), "Couldn't select Tags");
|
||||
MWWaitFor(() => QueryTypeComboButton.SelectItem<QueryElement.QueryType>(qt => qt.ToString() == "Tags"),
|
||||
"Couldn't select Tags");
|
||||
|
||||
string newTag = Guid.NewGuid().ToString();
|
||||
|
||||
@ -95,24 +138,28 @@ namespace XenAdminTests.SearchTests
|
||||
Tags.AddTag(GetAnyVBD(), newTag);
|
||||
|
||||
// now check that this new tag has not been added to the searcher.
|
||||
MWWaitFor(() => null == Searcher.QueryElement.ComboButton.Items.Find(ts => ts.Text == newTag), "New tag added to the Searcher with VBD selected.");
|
||||
MWWaitFor(() => null == ComboButton.Items.Find(ts => ts.Text == newTag),
|
||||
"New tag added to the Searcher with VBD selected.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSearcherUpdatesWhenCustomFieldsChange()
|
||||
{
|
||||
MW(() => NewSearchButton.PerformClick());
|
||||
|
||||
// create a new custom field
|
||||
string newCustomField = Guid.NewGuid().ToString();
|
||||
VM vm = GetAnyVM();
|
||||
CustomFieldsManager.AddCustomField(vm.Connection.Session, vm.Connection, new CustomFieldDefinition(newCustomField, CustomFieldDefinition.Types.String));
|
||||
|
||||
CustomFieldsManager.AddCustomField(vm.Connection.Session, vm.Connection,
|
||||
new CustomFieldDefinition(newCustomField, CustomFieldDefinition.Types.String));
|
||||
|
||||
// now see if this new custom field has been added to the searcher.
|
||||
MWWaitFor(delegate
|
||||
{
|
||||
// need to click for repopulate.
|
||||
Searcher.QueryElement.QueryTypeComboButton.Item.PerformClick();
|
||||
return null != Searcher.QueryElement.QueryTypeComboButton.Items.Find(ts => ts.Text == newCustomField);
|
||||
|
||||
QueryTypeComboButton.PerformClick();
|
||||
return null != QueryTypeComboButton.Items.Find(ts => ts.Text == newCustomField);
|
||||
}, "New custom field not added to the Searcher.");
|
||||
}
|
||||
}
|
||||
|
@ -66,17 +66,14 @@ namespace XenAdminTests.WizardTests
|
||||
{
|
||||
RunBefore();
|
||||
|
||||
wizard = (T)MW<T>(NewWizard);
|
||||
wizard = MW<T>(NewWizard);
|
||||
MW(wizard.Show);
|
||||
|
||||
btnNext = TestUtils.GetButton(wizard, "buttonNext");
|
||||
btnPrevious = TestUtils.GetButton(wizard, "buttonPrevious");
|
||||
btnCancel = TestUtils.GetButton(wizard, "buttonCancel");
|
||||
|
||||
|
||||
|
||||
for (
|
||||
int i = 0; i < pageNames.Length; ++i)
|
||||
for (int i = 0; i < pageNames.Length; ++i)
|
||||
{
|
||||
bool lastPage = (i == pageNames.Length - 1);
|
||||
|
||||
@ -124,6 +121,8 @@ namespace XenAdminTests.WizardTests
|
||||
|
||||
// Any subsequent testing defined in derived class
|
||||
RunAfter();
|
||||
|
||||
MW(() => wizard.Dispose());
|
||||
}
|
||||
|
||||
private string CurrentPageName(T wizard)
|
||||
|
@ -71,13 +71,8 @@
|
||||
<Compile Include="MainWindowWrapper\AddServerDialogWrapper.cs" />
|
||||
<Compile Include="MainWindowWrapper\MockMainWindow.cs" />
|
||||
<Compile Include="MainWindowWrapper\NameAndConnectionPromptWrapper.cs" />
|
||||
<Compile Include="MainWindowWrapper\DropDownComboButtonWrapper.cs" />
|
||||
<Compile Include="MainWindowWrapper\HostMenuWrapper.cs" />
|
||||
<Compile Include="MainWindowWrapper\MainToolBarWrapper.cs" />
|
||||
<Compile Include="MainWindowWrapper\QueryElementWrapper.cs" />
|
||||
<Compile Include="MainWindowWrapper\SearcherWrapper.cs" />
|
||||
<Compile Include="MainWindowWrapper\SearchForWrapper.cs" />
|
||||
<Compile Include="MainWindowWrapper\SearchPageWrapper.cs" />
|
||||
<Compile Include="MainWindowWrapper\StartShutdownMenuWrapper.cs" />
|
||||
<Compile Include="MainWindowWrapper\StorageMenuWrapper.cs" />
|
||||
<Compile Include="MainWindowWrapper\ToolsMenuWrapper.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user