[chronojump] Created a gui test for changeMultitestFirmware
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Created a gui test for changeMultitestFirmware
- Date: Thu, 20 Oct 2016 08:02:08 +0000 (UTC)
commit 2972ec9f1a4cb6fc7449b0976cf66bce0bbe8a07
Author: Xavier de Blas <xaviblas gmail com>
Date: Thu Oct 20 10:01:17 2016 +0200
Created a gui test for changeMultitestFirmware
src/chronopic2016.cs | 6 +++
src/gui/chronojump.cs | 14 +++++-
src/gui/guiTests.cs | 119 +++++++++++++++++++++++++++++++++++++++++++++---
3 files changed, 128 insertions(+), 11 deletions(-)
---
diff --git a/src/chronopic2016.cs b/src/chronopic2016.cs
index 5c76a77..18915ae 100644
--- a/src/chronopic2016.cs
+++ b/src/chronopic2016.cs
@@ -334,6 +334,12 @@ public class Chronopic2016
return -1;
}
+ //public method to access from guiTests.cs
+ public void TestsChangeMultitestFirmwareDo (int debounceChange)
+ {
+ changeMultitestFirmwareDo(debounceChange);
+ }
+
// <----- change multitest firmware END
public void SerialPortsCloseIfNeeded() {
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 5542bda..91b75d7 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -3688,8 +3688,12 @@ public partial class ChronoJumpWindow
if(cp2016.SuccededConnectContactsRealThread) {
LogB.Information("Success at Connecting real! (main GUI)");
- changeMultitestFirmwareIfNeeded();
- on_button_execute_test_accepted();
+ if(testsActive)
+ chronojumpWindowTestsNext();
+ else {
+ changeMultitestFirmwareIfNeeded();
+ on_button_execute_test_accepted();
+ }
} else
LogB.Warning("Failure at Connecting real! (main GUI)");
}
@@ -3995,6 +3999,8 @@ public partial class ChronoJumpWindow
if ( ! currentEventExecute.Cancel )
event_execute_progressbar_time.Fraction = 1;
+
+ //chronojumpWindowTestsNext();
}
@@ -6345,7 +6351,9 @@ 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 -1),
+ CJTests.SequenceChangeMultitest
+ );
}
private void on_button_carles_clicked (object o, EventArgs args) {
diff --git a/src/gui/guiTests.cs b/src/gui/guiTests.cs
index 99ef9ee..97fdfc7 100644
--- a/src/gui/guiTests.cs
+++ b/src/gui/guiTests.cs
@@ -44,10 +44,16 @@ public class CJTests
public enum Types
{
- MODE_POWERGRAVITATORY,
- MODE_POWERINERTIAL,
+ MODE_JUMPSSIMPLE,
+ MODE_RUNSSIMPLE,
+ MODE_POWERGRAVITATORY,
+ MODE_POWERINERTIAL,
SESSION_LOAD,
+ CHRONOPIC_CONNECT_REAL,
PERSON_SELECT,
+ MULTITEST_DO_50,
+ MULTITEST_DO_10,
+ CONTACTS_EXECUTE_TEST,
ENCODER_SIGNAL_LOAD,
ENCODER_ECC_CON_INVERT,
ENCODER_RECALCULATE,
@@ -82,8 +88,8 @@ public class CJTests
CJTests.Types.ENCODER_SET_SAVE_REPS_BUCLE
};
*/
-
- private List<Types> sequenceEncoder2 = new List<Types>
+
+ public static List<Types> SequenceEncoder2 = new List<Types>
{
CJTests.Types.MODE_POWERGRAVITATORY,
CJTests.Types.SESSION_LOAD,
@@ -96,10 +102,42 @@ public class CJTests
CJTests.Types.BUCLE_1_OFF,
CJTests.Types.END
};
+
+ /*
+ * doesn't work properly. Need to force a real GUI update after changing mode JUMPSSIMPLE, RUNSSIMPLE
+ * better us below List SequenceChangeMultitest
+ public static List<Types> SequenceContactsExecute50_10 = new List<Types>
+ {
+ CJTests.Types.MODE_RUNSSIMPLE,
+ CJTests.Types.SESSION_LOAD,
+ CJTests.Types.BUCLE_1_ON,
+ CJTests.Types.PERSON_SELECT, //bucle1startPos //repeat from here //when all persons
have done a jumps/runs test, will end
+ CJTests.Types.MODE_JUMPSSIMPLE,
+ CJTests.Types.CONTACTS_EXECUTE_TEST,
+ CJTests.Types.MODE_RUNSSIMPLE,
+ CJTests.Types.CONTACTS_EXECUTE_TEST,
+ CJTests.Types.BUCLE_1_OFF,
+ CJTests.Types.END
+ };
+ */
- public CJTests()
+ public static List<Types> SequenceChangeMultitest = new List<Types>
{
- sequence = sequenceEncoder2;
+ CJTests.Types.MODE_JUMPSSIMPLE,
+ CJTests.Types.SESSION_LOAD,
+ CJTests.Types.CHRONOPIC_CONNECT_REAL,
+ CJTests.Types.BUCLE_1_ON,
+ CJTests.Types.PERSON_SELECT, //bucle1startPos //repeat from here //when all persons
have done a jumps/runs test, will end
+ CJTests.Types.MULTITEST_DO_50,
+ CJTests.Types.MULTITEST_DO_10,
+ CJTests.Types.BUCLE_1_OFF,
+ CJTests.Types.END
+ };
+
+ public CJTests(List<Types> sequence)
+ {
+ this.sequence = sequence;
+
sequencePos = 0;
bucleCurrent = 0;
}
@@ -187,12 +225,12 @@ public partial class ChronoJumpWindow
private CJTests cjTest;
private int sessionID;
- private void chronojumpWindowTestsStart(int sessionID)
+ private void chronojumpWindowTestsStart(int sessionID, List<CJTests.Types> sequence)
{
testsActive = true;
this.sessionID = sessionID;
- cjTest = new CJTests();
+ cjTest = new CJTests(sequence);
chronojumpWindowTestsDo();
}
@@ -202,6 +240,16 @@ public partial class ChronoJumpWindow
if(! testsActive)
return;
+ //needed for SequenceContactsExecute50_10 (but doesn't work properly). Find other solution:
+ //http://www.mono-project.com/docs/gui/gtksharp/responsive-applications/
+ //
+ //force GUI update
+ //System.Threading.Thread.Sleep(250); //ok there's an sleep, but screen is not updated. Maybe
need to open a new thread before each next call to ensure gui is updated
+ //http://mono.1490590.n4.nabble.com/Force-UI-Update-td3488126.html
+ //while (Gtk.Application.EventsPending ())
+ // Gtk.Application.RunIteration ();
+ //System.Threading.Thread.Sleep(250); //ok there's an sleep, but screen is not updated. Maybe
need to open a new thread before each next call to ensure gui is updated
+
if(cjTest.Next())
chronojumpWindowTestsDo();
else
@@ -218,6 +266,12 @@ public partial class ChronoJumpWindow
switch(cjTest.GetSequencePos())
{
+ case CJTests.Types.MODE_JUMPSSIMPLE:
+ chronojumpWindowTestsMode(Constants.Menuitem_modes.JUMPSSIMPLE);
+ break;
+ case CJTests.Types.MODE_RUNSSIMPLE:
+ chronojumpWindowTestsMode(Constants.Menuitem_modes.RUNSSIMPLE);
+ break;
case CJTests.Types.MODE_POWERGRAVITATORY:
chronojumpWindowTestsMode(Constants.Menuitem_modes.POWERGRAVITATORY);
break;
@@ -227,10 +281,24 @@ public partial class ChronoJumpWindow
case CJTests.Types.SESSION_LOAD:
chronojumpWindowTestsLoadSession(sessionID); //this also selects first person
break;
+ case CJTests.Types.CHRONOPIC_CONNECT_REAL:
+ chronojumpWindowTestsChronopicContactReal();
+ break;
case CJTests.Types.PERSON_SELECT:
bucleContinues = chronojumpWindowTestsSelectPerson(bcount);
callNext = true;
break;
+ case CJTests.Types.MULTITEST_DO_50:
+ bucleContinues = chronojumpWindowTestsMultitestDo(50);
+ callNext = true;
+ break;
+ case CJTests.Types.MULTITEST_DO_10:
+ bucleContinues = chronojumpWindowTestsMultitestDo(10);
+ callNext = true;
+ break;
+ case CJTests.Types.CONTACTS_EXECUTE_TEST:
+ chronojumpWindowTestsContactsExecuteTest();
+ break;
case CJTests.Types.ENCODER_SIGNAL_LOAD:
bucleContinues = chronojumpWindowTestsEncoderLoadSignal(bcount);
if(bucleContinues)
@@ -286,6 +354,21 @@ public partial class ChronoJumpWindow
LogB.TestEnd("chronojumpWindowTestsLoadSession");
}
+
+ private void chronojumpWindowTestsChronopicContactReal()
+ {
+ LogB.TestStart("chronojumpWindowTestsChronopicContactReal");
+
+ ChronopicRegisterPort crp =
chronopicRegister.ConnectedOfType(ChronopicRegisterPort.Types.CONTACTS);
+ if(! cp2016.IsLastConnectedReal(crp)) {
+ cp2016.FakeButtonContactsRealDone.Clicked +=
+ new EventHandler(on_connection_contacts_real_done);
+ cp2016.ConnectContactsReal(app1, crp,
+ "Press TEST button on Chronopic to stablish initial communication");
//TODO: translate this
+ }
+
+ LogB.TestEnd("chronojumpWindowTestsChronopicContactReal");
+ }
private bool chronojumpWindowTestsSelectPerson(int count)
{
@@ -302,6 +385,26 @@ public partial class ChronoJumpWindow
return true;
}
+ private bool chronojumpWindowTestsMultitestDo(int ms)
+ {
+ LogB.TestStart("chronojumpWindowTestsContactsMultitestDo " + ms.ToString());
+
+ cp2016.TestsChangeMultitestFirmwareDo (ms);
+
+ LogB.TestEnd("chronojumpWindowTestsContactsMultitestDo " + ms.ToString());
+ return true;
+ }
+
+ private bool chronojumpWindowTestsContactsExecuteTest()
+ {
+ LogB.TestStart("chronojumpWindowTestsContactsExecuteTest");
+
+ on_button_execute_test_clicked (new object (), new EventArgs ());
+
+ LogB.TestEnd("chronojumpWindowTestsContactsExecuteTest");
+ return true;
+ }
+
private bool chronojumpWindowTestsEncoderLoadSignal(int count)
{
LogB.TestStart("chronojumpWindowTestsLoadSignal");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]