[chronojump] GuiTests select sessions by uniqueID
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] GuiTests select sessions by uniqueID
- Date: Fri, 21 Oct 2016 08:44:18 +0000 (UTC)
commit b0ac446c6e983b59b47a453d8ca3883e133dabb7
Author: Xavier de Blas <xaviblas gmail com>
Date: Fri Oct 21 10:42:50 2016 +0200
GuiTests select sessions by uniqueID
src/gui/chronojump.cs | 2 +-
src/gui/guiTests.cs | 8 +++++++-
src/gui/session.cs | 8 +++++++-
src/utilGtk.cs | 9 +++++----
4 files changed, 20 insertions(+), 7 deletions(-)
---
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 4500b43..9c2cc43 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -6351,7 +6351,7 @@ LogB.Debug("X");
}
private void on_button_gui_tests_clicked (object o, EventArgs args) {
- chronojumpWindowTestsStart(Convert.ToInt32(spin_gui_tests.Value -1),
+ chronojumpWindowTestsStart(Convert.ToInt32(spin_gui_tests.Value),
CJTests.SequenceChangeMultitest
);
}
diff --git a/src/gui/guiTests.cs b/src/gui/guiTests.cs
index 07003ea..132cfbb 100644
--- a/src/gui/guiTests.cs
+++ b/src/gui/guiTests.cs
@@ -356,7 +356,13 @@ public partial class ChronoJumpWindow
LogB.TestStart("chronojumpWindowTestsLoadSession");
on_open_activate(new Object(), new EventArgs());
- sessionLoadWin.SelectRow(sID); //0 is the first
+ bool exists = sessionLoadWin.SelectRowByID(sID); //0 is the first
+ if(! exists) {
+ testsActive = false;
+ new DialogMessage(Constants.MessageTypes.WARNING, "Warning, This session ID does not
exists");
+ return;
+ }
+
sessionLoadWin.Button_accept.Click();
LogB.TestEnd("chronojumpWindowTestsLoadSession");
diff --git a/src/gui/session.cs b/src/gui/session.cs
index 69fa878..d3573d6 100644
--- a/src/gui/session.cs
+++ b/src/gui/session.cs
@@ -921,7 +921,7 @@ public class SessionLoadWindow {
}
//pass 0 for first row
- public void SelectRow(int rowNumber)
+ public void SelectRowByPos(int rowNumber)
{
TreeIter iter;
bool iterOk = store.GetIterFirst(out iter);
@@ -934,6 +934,12 @@ public class SessionLoadWindow {
treeview_session_load.Selection.SelectIter(iter);
}
}
+
+ public bool SelectRowByID(int searchedID)
+ {
+ return UtilGtk.TreeviewSelectRowWithID(
+ treeview_session_load, store, 0, searchedID, false);
+ }
private void onSelectionEntry (object o, EventArgs args)
{
diff --git a/src/utilGtk.cs b/src/utilGtk.cs
index 3a366fa..894c600 100644
--- a/src/utilGtk.cs
+++ b/src/utilGtk.cs
@@ -263,14 +263,14 @@ public class UtilGtk
}
//selects a row that has an uniqueID (usually at col 0)
- public static void TreeviewSelectRowWithID(Gtk.TreeView tv, Gtk.TreeStore store, int colNum, int id,
bool scrollToRow)
+ public static bool TreeviewSelectRowWithID(Gtk.TreeView tv, Gtk.TreeStore store, int colNum, int id,
bool scrollToRow)
{
if(id <= 0)
- return;
+ return false;
int rowNum = getRowNumOfThisID(store, colNum, id);
if(rowNum == -1)
- return;
+ return false;
//set the selected
int count = 0;
@@ -288,12 +288,13 @@ public class UtilGtk
tv.ScrollToCell (path, tv.Columns[0], true, 0, 0);
}
- return;
+ return true;
}
count ++;
store.IterNext(ref iter);
}
+ return false;
}
public static Gtk.TreeStore RemoveRow (Gtk.TreeView tv, Gtk.TreeStore store) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]