[chronojump] GuiTests to allow encoder load and graph bars. WIP.



commit bba2839afd92de844adc59db7928b7832c8d800c
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri Dec 11 13:31:33 2020 +0100

    GuiTests to allow encoder load and graph bars. WIP.

 glade/app1.glade           | 56 ++++++++++++++++++++++++++++--------
 src/config.cs              |  5 +++-
 src/gui/app1/chronojump.cs | 20 +++++++++++--
 src/gui/app1/menu.cs       |  1 +
 src/gui/guiTests.cs        | 72 ++++++++++++++++++++++++++++++++++++++++++++++
 src/gui/networks.cs        |  6 ++++
 6 files changed, 145 insertions(+), 15 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index 14933a1d..fd3c9635 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -325,6 +325,19 @@
                                         <property name="position">3</property>
                                       </packing>
                                     </child>
+                                    <child>
+                                      <widget class="GtkButton" id="button_menu_guiTest1">
+                                        <property name="label">GuiTest</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="receives_default">True</property>
+                                        <signal name="clicked" handler="on_button_gui_tests_clicked" 
swapped="no"/>
+                                      </widget>
+                                      <packing>
+                                        <property name="expand">False</property>
+                                        <property name="fill">False</property>
+                                        <property name="position">4</property>
+                                      </packing>
+                                    </child>
                                   </widget>
                                   <packing>
                                     <property name="expand">True</property>
@@ -976,6 +989,19 @@
                                                             <property name="position">3</property>
                                                             </packing>
                                                             </child>
+                                                            <child>
+                                                            <widget class="GtkButton" 
id="button_menu_guiTest">
+                                                            <property name="label">Gui test start</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property name="receives_default">True</property>
+                                                            <signal name="clicked" 
handler="on_button_gui_tests_clicked" swapped="no"/>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">4</property>
+                                                            </packing>
+                                                            </child>
                                                           </widget>
                                                         </child>
                                                       </widget>
@@ -23316,6 +23342,9 @@ Concentric</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -28137,6 +28166,18 @@ Concentric</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">6</property>
                                                             <child>
+                                                            <widget class="GtkLabel" 
id="label_video_encoder_tests_will_be_filmed">
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" translatable="yes">Tests 
will be filmed</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="pack_type">end</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
                                                             <widget class="GtkHBox" 
id="hbox_video_encoder_capturing">
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">4</property>
@@ -28173,18 +28214,6 @@ Concentric</property>
                                                             </packing>
                                                             </child>
                                                             <child>
-                                                            <widget class="GtkLabel" 
id="label_video_encoder_tests_will_be_filmed">
-                                                            <property name="can_focus">False</property>
-                                                            <property name="label" translatable="yes">Tests 
will be filmed</property>
-                                                            </widget>
-                                                            <packing>
-                                                            <property name="expand">False</property>
-                                                            <property name="fill">False</property>
-                                                            <property name="pack_type">end</property>
-                                                            <property name="position">0</property>
-                                                            </packing>
-                                                            </child>
-                                                            <child>
                                                             <widget class="GtkHBox" 
id="hbox_video_encoder_no_capturing">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
@@ -36395,6 +36424,9 @@ then click this button.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
diff --git a/src/config.cs b/src/config.cs
index 41eddc78..e143654d 100644
--- a/src/config.cs
+++ b/src/config.cs
@@ -57,6 +57,7 @@ public class Config
        public bool Exhibition; //like YOMO. does not have rfid capture, user autologout management, and 
automatic configuration of gui
        public ExhibitionTest.testTypes ExhibitionStationType;
        public bool Raspberry;
+       public bool GuiTest;
        /*
         * unused because the default serverURL chronojump.org is ok:
         * public string ExhibitionServerURL = "";
@@ -134,8 +135,10 @@ public class Config
                                        else if(parts[0] == "ExhibitionStationID" && parts[1] != "" && 
Util.IsNumber(parts[1], false))
                                                ExhibitionStationID = Convert.ToInt32(parts[1]);
                                                */
-                                       if(parts[0] == "Raspberry" && Util.StringToBool(parts[1])) 
//Raspberry: small screens, could be networks or not. They are usually disconnected by cable removal, so do 
not show send log at start
+                                       else if(parts[0] == "Raspberry" && Util.StringToBool(parts[1])) 
//Raspberry: small screens, could be networks or not. They are usually disconnected by cable removal, so do 
not show send log at start
                                                Raspberry = true;
+                                       else if(parts[0] == "GuiTest" && Util.StringToBool(parts[1]))
+                                               GuiTest = true;
                                } while(true);
                        }
                }
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index e626ee21..33ed7fa4 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -6829,7 +6829,23 @@ LogB.Debug("mc finished 5");
                        setApp1Title(currentSession.Name, current_menuitem_mode);
        }
 
+       //use chronojumpConfig
        private void on_button_gui_tests_clicked (object o, EventArgs args)
+       {
+               if(currentSession == null)
+               {
+                       new DialogMessage(Constants.MessageTypes.WARNING, "Need to open a session");
+                       return;
+               }
+
+               chronojumpWindowTestsStart(
+                               currentSession.UniqueID,
+                               CJTests.SequenceEncoderGraphSetBars);
+       }
+
+       //use DEBUG and selector on main gui (previous to 2.0)
+       /*
+       private void on_button_gui_tests_old_clicked (object o, EventArgs args)
        {
                string selected = UtilGtk.ComboGetActive(combo_gui_tests);
                if(selected == "")
@@ -6858,11 +6874,11 @@ LogB.Debug("mc finished 5");
                else
                        new DialogMessage(Constants.MessageTypes.WARNING, "Selected test: " + selected);
 
-               /* other tests:
+               // other tests:
                //CJTests.SequenceChangeMultitest
                //CJTests.SequenceRJsSimulatedFinishCancel
-               */
        }
+       */
        
        private void on_button_carles_clicked (object o, EventArgs args)
        {
diff --git a/src/gui/app1/menu.cs b/src/gui/app1/menu.cs
index 3c9cd37d..caac2c16 100644
--- a/src/gui/app1/menu.cs
+++ b/src/gui/app1/menu.cs
@@ -65,6 +65,7 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Button button_menu_help_documents;
        [Widget] Gtk.Button button_menu_help_shortcuts;
        [Widget] Gtk.Button button_menu_help_about;
+       [Widget] Gtk.Button button_menu_guiTest;
 
        //just to manage width
        [Widget] Gtk.HButtonBox hbuttonbox_person_admin_create;
diff --git a/src/gui/guiTests.cs b/src/gui/guiTests.cs
index e0a37f4c..ad964225 100644
--- a/src/gui/guiTests.cs
+++ b/src/gui/guiTests.cs
@@ -61,6 +61,8 @@ public class CJTests
                ENCODER_CAPTURE,
                ENCODER_CAPTURE_CALIBRATE,
                ENCODER_RECALCULATE,
+               //ENCODER_SET_SAVE_GRAPH,
+               ENCODER_SIGNAL_LOAD_AND_GRAPH_BARS,
                ENCODER_SET_SAVE_REPS,
                ENCODER_SET_SAVE_REPS_BUCLE,
                WAIT_5_SECONDS,
@@ -108,6 +110,20 @@ public class CJTests
                CJTests.Types.END
        };
 
+       public static List<Types> SequenceEncoderGraphSetBars = new List<Types>
+       {
+               //CJTests.Types.MODE_POWERGRAVITATORY, 
+               CJTests.Types.SESSION_LOAD,
+               CJTests.Types.BUCLE_1_ON,
+                       CJTests.Types.PERSON_SELECT, //bucle1startPos //repeat from here
+                       CJTests.Types.BUCLE_2_ON,
+                               CJTests.Types.ENCODER_SIGNAL_LOAD_AND_GRAPH_BARS, //bucle2startPos
+               //              CJTests.Types.ENCODER_SET_SAVE_GRAPH,
+                       CJTests.Types.BUCLE_2_OFF,
+               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
@@ -210,6 +226,7 @@ public class CJTests
 
                if(sequence[sequencePos] == Types.BUCLE_1_ON) 
                {
+                       LogB.Information("BUCLE_1_ON");
                        bucleCurrent = 1;
                        bucle1ended = false;
                        bucle1count = 0;
@@ -219,6 +236,7 @@ public class CJTests
                
                if(sequence[sequencePos] == Types.BUCLE_2_ON) 
                {
+                       LogB.Information("BUCLE_2_ON");
                        bucleCurrent = 2;
                        bucle2ended = false;
                        bucle2count = 0;
@@ -228,6 +246,7 @@ public class CJTests
                
                if(sequence[sequencePos] == Types.BUCLE_2_OFF) 
                {
+                       LogB.Information("BUCLE_2_OFF");
                        if(bucle2ended) {
                                bucleCurrent --;
                                sequencePos ++;
@@ -239,6 +258,7 @@ public class CJTests
                
                if(sequence[sequencePos] == Types.BUCLE_1_OFF) 
                {
+                       LogB.Information("BUCLE_1_OFF");
                        if(bucle1ended) {
                                bucleCurrent --;
                                sequencePos ++;
@@ -250,7 +270,10 @@ public class CJTests
                } 
                
                if(sequence[sequencePos] == CJTests.Types.END)
+               {
+                       LogB.Information("SEQUENCE END");
                        return false;
+               }
 
                return true;
        }
@@ -291,6 +314,7 @@ public partial class ChronoJumpWindow
 
        private void chronojumpWindowTestsStart(int sessionID, List<CJTests.Types> sequence)
        {
+               LogB.Information("At chronojumpWindowTestsStart");
                testsActive = true;
                this.sessionID = sessionID;
 
@@ -338,6 +362,7 @@ public partial class ChronoJumpWindow
                
                bool bucleContinues = true;
                int bcount = cjTest.GetBucleCount();
+               LogB.Information(cjTest.GetSequencePos().ToString());
 
                switch(cjTest.GetSequencePos()) 
                {
@@ -386,6 +411,11 @@ public partial class ChronoJumpWindow
                                if(bucleContinues)
                                        callNext = true;
                                break;
+                       case CJTests.Types.ENCODER_SIGNAL_LOAD_AND_GRAPH_BARS:
+                               bucleContinues = chronojumpWindowTestsEncoderLoadSignalAndGraphBars(bcount);
+//                             if(bucleContinues)
+                                       callNext = true;
+                               break;
                        case CJTests.Types.ENCODER_ECC_CON_INVERT:
                                chronojumpWindowTestsEncoderEccConInvert();
                                callNext = true;
@@ -400,6 +430,10 @@ public partial class ChronoJumpWindow
                        case CJTests.Types.ENCODER_RECALCULATE:
                                chronojumpWindowTestsEncoderRecalculate();
                                break;
+//                     case CJTests.Types.ENCODER_SET_SAVE_GRAPH:
+//                             chronojumpWindowTestsEncoderSetSaveGraph();
+//                             callNext = true;
+//                             break;
                        case CJTests.Types.ENCODER_SET_SAVE_REPS:
                                chronojumpWindowTestsEncoderSetSaveReps();
                                callNext = true;
@@ -413,6 +447,9 @@ public partial class ChronoJumpWindow
                                break;
                }
 
+               LogB.Information("bucleContinues: " + bucleContinues.ToString());
+               LogB.Information("callNext: " + callNext.ToString());
+
                if(! bucleContinues)
                        cjTest.EndBucleCurrent();
 
@@ -568,6 +605,31 @@ public partial class ChronoJumpWindow
                LogB.TestEnd("chronojumpWindowTestsLoadSignal_continuing");
                return true;
        }
+       private bool chronojumpWindowTestsEncoderLoadSignalAndGraphBars(int count)
+       {
+               LogB.TestStart("chronojumpWindowTestsLoadSignal");
+
+               ArrayList data = encoderLoadSignalData(); //selects signals of this person, this session, 
this encoderGI
+
+               /*
+               if(count >= data.Count) {
+                       LogB.TestEnd("chronojumpWindowTestsLoadSignal_ended");
+                       return false;
+               }
+               */
+               
+               EncoderSQL es = (EncoderSQL) data[count]; //first is 0
+
+               on_encoder_load_signal_clicked (Convert.ToInt32(es.uniqueID)); //opens load window with first 
selected
+
+               genericWin.Button_accept.Click(); //this will call accepted
+
+               chronojumpWindowTestsEncoderSetSaveGraph();
+
+               LogB.TestEnd("chronojumpWindowTestsLoadSignal_continuing");
+               return true;
+       }
+       
        
        private void chronojumpWindowTestsEncoderEccConInvert()
        {
@@ -606,6 +668,16 @@ public partial class ChronoJumpWindow
        }
 
 
+       private void chronojumpWindowTestsEncoderSetSaveGraph()
+       {
+               LogB.TestStart("chronojumpWindowTestsEncoderSetSaveGraph");
+
+//TODO: but have a checkFile that can have a path and writes without asking about rewrite if file exists
+               on_button_encoder_capture_image_save_clicked (new Object (), new EventArgs ());
+
+               LogB.TestEnd("chronojumpWindowTestsEncoderSetSaveGraph");
+       }
+
        //saves all best none 4top randomly
        private void chronojumpWindowTestsEncoderSetSaveReps()
        {
diff --git a/src/gui/networks.cs b/src/gui/networks.cs
index f1861fe7..a5d9c15c 100644
--- a/src/gui/networks.cs
+++ b/src/gui/networks.cs
@@ -242,6 +242,12 @@ public partial class ChronoJumpWindow
                        hbox_persons_raspberry.Visible = true;
                }
 
+               if(configChronojump.GuiTest)
+               {
+                       button_menu_guiTest.Visible = true;
+                       button_menu_guiTest1.Visible = true;
+               }
+
                if(configChronojump.Exhibition)
                {
                        exhibitionGuiAtStart(configChronojump.ExhibitionStationType);


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