[chronojump] guiTests added SaveReps with Timeout support



commit bc6a831e4207e10a90165141398e4a1f14fdfd76
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Aug 4 01:44:11 2016 +0200

    guiTests added SaveReps with Timeout support

 src/gui/encoder.cs  |    5 ++
 src/gui/guiTests.cs |  109 +++++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 111 insertions(+), 3 deletions(-)
---
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index a537e1c..5bfc352 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -113,6 +113,11 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.ComboBox combo_encoder_laterality;
        [Widget] Gtk.Box hbox_encoder_capture_curves_save_all_none;
        
+       [Widget] Gtk.Button button_encoder_capture_curves_all;
+       [Widget] Gtk.Button button_encoder_capture_curves_best;
+       [Widget] Gtk.Button button_encoder_capture_curves_none;
+       [Widget] Gtk.Button button_encoder_capture_curves_4top;
+       
        [Widget] Gtk.Box hbox_combo_encoder_exercise_analyze;
        [Widget] Gtk.ComboBox combo_encoder_exercise_analyze;
 
diff --git a/src/gui/guiTests.cs b/src/gui/guiTests.cs
index 4693c79..1bac1ba 100644
--- a/src/gui/guiTests.cs
+++ b/src/gui/guiTests.cs
@@ -39,7 +39,9 @@ public partial class ChronoJumpWindow
                PERSON_SELECT,
                ENCODER_SIGNAL_LOAD,
                ENCODER_ECC_CON_INVERT,
-               ENCODER_RECALCULATE
+               ENCODER_RECALCULATE,
+               ENCODER_SET_SAVE_REPS,
+               ENCODER_SET_SAVE_REPS_BUCLE
        }
 
        private List<cjTestTypes> sequenceEncoder1()
@@ -49,14 +51,21 @@ public partial class ChronoJumpWindow
                                cjTestTypes.SESSION_LOAD,
                                cjTestTypes.PERSON_SELECT,
                                cjTestTypes.ENCODER_SIGNAL_LOAD,
-                               cjTestTypes.ENCODER_ECC_CON_INVERT,     //start bucle
+                               cjTestTypes.ENCODER_ECC_CON_INVERT,
                                cjTestTypes.ENCODER_RECALCULATE,
                                cjTestTypes.ENCODER_ECC_CON_INVERT,
                                cjTestTypes.ENCODER_RECALCULATE,
                                cjTestTypes.ENCODER_ECC_CON_INVERT,
                                cjTestTypes.ENCODER_RECALCULATE,
                                cjTestTypes.ENCODER_ECC_CON_INVERT,
-                               cjTestTypes.ENCODER_RECALCULATE         //end bucle
+                               cjTestTypes.ENCODER_RECALCULATE,
+                               /*
+                               cjTestTypes.ENCODER_SET_SAVE_REPS,
+                               cjTestTypes.ENCODER_SET_SAVE_REPS,
+                               cjTestTypes.ENCODER_SET_SAVE_REPS,
+                               cjTestTypes.ENCODER_SET_SAVE_REPS,
+                               */
+                               cjTestTypes.ENCODER_SET_SAVE_REPS_BUCLE
                };
        }
        
@@ -114,6 +123,13 @@ public partial class ChronoJumpWindow
                        case cjTestTypes.ENCODER_RECALCULATE:
                                chronojumpWindowTestsEncoderRecalculate();
                                break;
+                       case cjTestTypes.ENCODER_SET_SAVE_REPS:
+                               chronojumpWindowTestsEncoderSetSaveReps();
+                               callNext = true;
+                               break;
+                       case cjTestTypes.ENCODER_SET_SAVE_REPS_BUCLE:
+                               chronojumpWindowTestsEncoderSetSaveRepsBucle();
+                               break;
                                /*
                                   case 6:
                                   LogB.Information("ALL TESTS DONE");
@@ -192,4 +208,91 @@ public partial class ChronoJumpWindow
 
                LogB.TestEnd("chronojumpWindowTestsEncoderRecalculate");
        }
+
+
+       //saves all best none 4top randomly
+       private void chronojumpWindowTestsEncoderSetSaveReps()
+       {
+               LogB.TestStart("chronojumpWindowTestsEncoderSetSaveReps");
+
+               //Constants.EncoderAutoSaveCurve easc;
+               double d = rand.NextDouble(); //0 - 1
+               if(d < .25)
+                       //easc = Constants.EncoderAutoSaveCurve.ALL;
+                       button_encoder_capture_curves_all.Click();
+               else if(d < .5)
+                       //easc = Constants.EncoderAutoSaveCurve.BEST;
+                       button_encoder_capture_curves_best.Click();
+               else if(d < .75)
+                       //easc = Constants.EncoderAutoSaveCurve.NONE;
+                       button_encoder_capture_curves_none.Click();
+               else
+                       //easc = Constants.EncoderAutoSaveCurve.FROM4TOPENULTIMATE;
+                       button_encoder_capture_curves_4top.Click();
+
+               //encoderCaptureSaveCurvesAllNoneBest(easc, encoderCaptureOptionsWin.GetMainVariable());
+               
+               LogB.TestEnd("chronojumpWindowTestsEncoderSetSaveReps: " + d.ToString());
+       }
+       
+       //saves all best none 4top randomly
+       private void chronojumpWindowTestsEncoderSetSaveRepsBucle()
+       {
+               LogB.TestStart("chronojumpWindowTestsEncoderSetSaveReps");
+
+               saveRepsLastI = -1;
+               saveRepsBucleDoing = true;
+               saveRepsBucleCount = 25;
+
+               //make interval bigger if you cannot see GUI updating
+               GLib.Timeout.Add(500, new 
GLib.TimeoutHandler(chronojumpWindowTestsEncoderSetSaveRepsBucleDo));
+               
+               LogB.TestEnd("chronojumpWindowTestsEncoderSetSaveReps");
+       }
+       bool saveRepsBucleDoing;
+       int saveRepsBucleCount;
+       int saveRepsLastI;
+       private bool chronojumpWindowTestsEncoderSetSaveRepsBucleDo()
+       {
+               if(! saveRepsBucleDoing)
+                       return false;
+               
+               //LogB.Information(" saveReps(" + saveRepsBucleCount.ToString() + ") ");
+
+               //get random value but different than last time
+               int i;
+               do {
+                       i = rand.Next(1,5); //1-4
+               } while(i == saveRepsLastI);
+
+               saveRepsLastI = i;
+               
+               //LogB.Information(" [i=" + i.ToString() + "] ");
+               
+               Constants.EncoderAutoSaveCurve easc;
+               if(i == 1)
+                       //easc = Constants.EncoderAutoSaveCurve.ALL;
+                       button_encoder_capture_curves_all.Click();
+               else if(i == 2)
+                       //easc = Constants.EncoderAutoSaveCurve.BEST;
+                       button_encoder_capture_curves_best.Click();
+               else if(i == 3)
+                       //easc = Constants.EncoderAutoSaveCurve.NONE;
+                       button_encoder_capture_curves_none.Click();
+               else
+                       //easc = Constants.EncoderAutoSaveCurve.FROM4TOPENULTIMATE;
+                       button_encoder_capture_curves_4top.Click();
+
+               //encoderCaptureSaveCurvesAllNoneBest(easc, encoderCaptureOptionsWin.GetMainVariable());
+                       
+               saveRepsBucleCount --;
+               if(saveRepsBucleCount > 0)
+                       return true;
+               else {
+                       saveRepsBucleDoing = false;
+                       chronojumpWindowTestsNext();
+                       return false;
+               }
+       }
+
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]