Ignore:
Timestamp:
08/17/12 08:33:29 (12 years ago)
Author:
pharms
Message:
  • adapted task tree creation stuff to more general event handling
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/temporalrelation/TrackBarSelectionDetectionRuleTest.java

    r468 r557  
    1 //------------------------------------------------------------------------------------------------- 
    21// Module    : $RCSfile: DefaultIterationDetectionRuleTest.java,v $ 
    32// Version   : $Revision: 0.0 $  $Author: patrick $  $Date: 28.04.2012 $ 
     
    54// Creation  : 2012 by patrick 
    65// Copyright : Patrick Harms, 2012 
    7 //------------------------------------------------------------------------------------------------- 
     6 
    87package de.ugoe.cs.quest.tasktrees.temporalrelation; 
    98 
    109import org.junit.Test; 
    1110 
    12 import de.ugoe.cs.quest.eventcore.guimodel.GUIElement; 
    13 import de.ugoe.cs.quest.eventcore.guimodel.TrackBar; 
    14 import de.ugoe.cs.quest.eventcore.userinteraction.ValueSelection; 
     11import de.ugoe.cs.quest.eventcore.gui.ValueSelection; 
     12import de.ugoe.cs.quest.eventcore.guimodel.IGUIElement; 
     13import de.ugoe.cs.quest.eventcore.guimodel.ITrackBar; 
    1514import de.ugoe.cs.quest.tasktrees.testutils.DummyGUIElement; 
    1615import de.ugoe.cs.quest.tasktrees.testutils.DummyInteraction; 
    1716import de.ugoe.cs.quest.tasktrees.testutils.TaskTreeChecker; 
    1817 
    19 //------------------------------------------------------------------------------------------------- 
    2018/** 
    2119 * TODO comment 
     
    2422 * @author 2012, last modified by $Author: patrick$ 
    2523 */ 
    26 //------------------------------------------------------------------------------------------------- 
    27 public class TrackBarSelectionDetectionRuleTest extends AbstractTemporalRelationshipTC 
    28 { 
     24public class TrackBarSelectionDetectionRuleTest extends AbstractTemporalRelationshipTC { 
    2925 
    30   //----------------------------------------------------------------------------------------------- 
    31   /** 
    32    * 
    33    */ 
    34   //----------------------------------------------------------------------------------------------- 
    35   @Test 
    36   public void testSimpleDetection() throws Exception 
    37   { 
    38     GUIElement element1 = new DummyTrackBar(); 
    39     simulateInteraction(element1, new ValueSelection<Integer>(1)); 
    40     new TaskTreeChecker().assertTaskTree 
    41       ("Sequence sequence1 {" + 
    42        "  Iteration interation1 {" + 
    43        "    Selection selection1 {" + 
    44        "      Interaction ValueSelection {}" + 
    45        "    }" + 
    46        "  }" + 
    47        "}", getTaskTree());     
    48  
    49     simulateInteraction(element1, new ValueSelection<Integer>(2)); 
    50     new TaskTreeChecker().assertTaskTree 
    51       ("Sequence sequence1 {" + 
    52        "  Iteration interation1 {" + 
    53        "    Selection selection1 {" + 
    54        "      Interaction ValueSelection {}" + 
    55        "      Interaction ValueSelection {}" + 
    56        "    }" + 
    57        "  }" + 
    58        "}", getTaskTree());     
    59  
    60     simulateInteraction(element1, new ValueSelection<Integer>(3)); 
    61     new TaskTreeChecker().assertTaskTree 
    62       ("Sequence sequence1 {" + 
    63        "  Iteration interation1 {" + 
    64        "    Selection selection1 {" + 
    65        "      Interaction ValueSelection {}" + 
    66        "      Interaction ValueSelection {}" + 
    67        "      Interaction ValueSelection {}" + 
    68        "    }" + 
    69        "  }" + 
    70        "}", getTaskTree());     
    71  
    72     simulateInteraction(element1, new ValueSelection<Integer>(2)); 
    73     new TaskTreeChecker().assertTaskTree 
    74       ("Sequence sequence1 {" + 
    75        "  Iteration interation1 {" + 
    76        "    Selection selection1 {" + 
    77        "      Interaction ValueSelection {}" + 
    78        "      Interaction ValueSelection {}" + 
    79        "      Interaction ValueSelection {}" + 
    80        "    }" + 
    81        "  }" + 
    82        "}", getTaskTree());     
    83  
    84     simulateInteraction(element1, new ValueSelection<Integer>(3)); 
    85     new TaskTreeChecker().assertTaskTree 
    86       ("Sequence sequence1 {" + 
    87        "  Iteration interation1 {" + 
    88        "    Selection selection1 {" + 
    89        "      Interaction ValueSelection {}" + 
    90        "      Interaction ValueSelection {}" + 
    91        "      Interaction ValueSelection {}" + 
    92        "    }" + 
    93        "  }" + 
    94        "}", getTaskTree()); 
    95  
    96   } 
    97    
    98   //----------------------------------------------------------------------------------------------- 
    99   /** 
    100    * 
    101    */ 
    102   //----------------------------------------------------------------------------------------------- 
    103   @Test 
    104   public void testComplexDetection() throws Exception 
    105   { 
    106     GUIElement element1 = new DummyTrackBar(); 
    107     simulateInteraction(element1, new ValueSelection<Integer>(1)); 
    108     simulateInteraction(element1, new ValueSelection<Integer>(2)); 
    109     simulateInteraction(element1, new ValueSelection<Integer>(3)); 
    110     simulateInteraction(element1, new ValueSelection<Integer>(1)); 
    111     simulateInteraction(element1, new DummyInteraction("bla", 1)); 
    112     simulateInteraction(element1, new DummyInteraction("bla", 2)); 
    113     simulateInteraction(element1, new ValueSelection<Integer>(2)); 
    114     simulateInteraction(element1, new ValueSelection<Integer>(1)); 
    115     simulateInteraction(element1, new DummyInteraction("bla", 3)); 
    116     simulateInteraction(element1, new ValueSelection<Integer>(3)); 
    117     simulateInteraction(element1, new ValueSelection<Integer>(2)); 
    118     simulateInteraction(element1, new ValueSelection<Integer>(3)); 
    119     simulateInteraction(element1, new DummyInteraction("bla", 1)); 
    120     simulateInteraction(element1, new DummyInteraction("bla", 2)); 
    121     simulateInteraction(element1, new ValueSelection<Integer>(1)); 
    122     simulateInteraction(element1, new ValueSelection<Integer>(1)); 
    123      
    124     new TaskTreeChecker().assertTaskTree 
    125       ("Sequence sequence1 {" + 
    126        "  Iteration interation1 {" + 
    127        "    Selection selection1 {" + 
    128        "      Interaction ValueSelection {}" + 
    129        "      Interaction ValueSelection {}" + 
    130        "      Interaction ValueSelection {}" + 
    131        "    }" + 
    132        "  }" + 
    133        "  Interaction bla {}" + 
    134        "  Interaction bla {}" + 
    135        "  Iteration interation2 {" + 
    136        "    Selection selection2 {" + 
    137        "      Interaction ValueSelection {}" + 
    138        "      Interaction ValueSelection {}" + 
    139        "    }" + 
    140        "  }" + 
    141        "  Interaction bla {}" + 
    142        "  Iteration interation3 {" + 
    143        "    Selection selection3 {" + 
    144        "      Interaction ValueSelection {}" + 
    145        "      Interaction ValueSelection {}" + 
    146        "    }" + 
    147        "  }" + 
    148        "  Interaction bla {}" + 
    149        "  Interaction bla {}" + 
    150        "  Iteration interation4 {" + 
    151        "    Selection selection4 {" + 
    152        "      Interaction ValueSelection {}" + 
    153        "    }" + 
    154        "  }" + 
    155        "}", getTaskTree());     
    156   } 
    157    
    158   //----------------------------------------------------------------------------------------------- 
    159   /** 
    160    * TODO comment 
    161    *  
    162    * @version $Revision: $ $Date: 28.04.2012$ 
    163    * @author 2012, last modified by $Author: patrick$ 
    164    */ 
    165   //----------------------------------------------------------------------------------------------- 
    166   public class DummyTrackBar extends DummyGUIElement implements TrackBar 
    167   { 
    168  
    169     //--------------------------------------------------------------------------------------------- 
    17026    /** 
    17127     * 
    17228     */ 
    173     //--------------------------------------------------------------------------------------------- 
    174     public DummyTrackBar() 
    175     { 
    176       super("DummyTrackBar"); 
     29    @Test 
     30    public void testSimpleDetection() throws Exception { 
     31        IGUIElement element1 = new DummyTrackBar(); 
     32        simulateEvent(new ValueSelection<Integer>(1), element1); 
     33        new TaskTreeChecker().assertTaskTree 
     34            ("Sequence sequence1 {" + 
     35             "  Iteration interation1 {" + 
     36             "    Selection selection1 {" + 
     37             "      Event ValueSelection {}" + 
     38             "    }" + 
     39             "  }" + 
     40             "}", getTaskTree()); 
     41 
     42        simulateEvent(new ValueSelection<Integer>(2), element1); 
     43        new TaskTreeChecker().assertTaskTree 
     44            ("Sequence sequence1 {" + 
     45             "  Iteration interation1 {" + 
     46             "    Selection selection1 {" + 
     47             "      Event ValueSelection {}" + 
     48             "      Event ValueSelection {}" + 
     49             "    }" + 
     50             "  }" + 
     51             "}", getTaskTree()); 
     52 
     53        simulateEvent(new ValueSelection<Integer>(3), element1); 
     54        new TaskTreeChecker().assertTaskTree 
     55            ("Sequence sequence1 {" + 
     56             "  Iteration interation1 {" + 
     57             "    Selection selection1 {" + 
     58             "      Event ValueSelection {}" + 
     59             "      Event ValueSelection {}" + 
     60             "      Event ValueSelection {}" + 
     61             "    }" + 
     62             "  }" + 
     63             "}", getTaskTree()); 
     64 
     65        simulateEvent(new ValueSelection<Integer>(2), element1); 
     66        new TaskTreeChecker().assertTaskTree 
     67            ("Sequence sequence1 {" + 
     68             "  Iteration interation1 {" + 
     69             "    Selection selection1 {" + 
     70             "      Event ValueSelection {}" + 
     71             "      Event ValueSelection {}" + 
     72             "      Event ValueSelection {}" + 
     73             "    }" + 
     74             "  }" + 
     75             "}", getTaskTree()); 
     76 
     77        simulateEvent(new ValueSelection<Integer>(3), element1); 
     78        new TaskTreeChecker().assertTaskTree 
     79            ("Sequence sequence1 {" + 
     80             "  Iteration interation1 {" + 
     81             "    Selection selection1 {" + 
     82             "      Event ValueSelection {}" + 
     83             "      Event ValueSelection {}" + 
     84             "      Event ValueSelection {}" + 
     85             "    }" + 
     86             "  }" + 
     87             "}", getTaskTree()); 
     88 
    17789    } 
    178   } 
     90 
     91    /** 
     92     * 
     93     */ 
     94    @Test 
     95    public void testComplexDetection() throws Exception { 
     96        IGUIElement element1 = new DummyTrackBar(); 
     97        simulateEvent(new ValueSelection<Integer>(1), element1); 
     98        simulateEvent(new ValueSelection<Integer>(2), element1); 
     99        simulateEvent(new ValueSelection<Integer>(3), element1); 
     100        simulateEvent(new ValueSelection<Integer>(1), element1); 
     101        simulateEvent(new DummyInteraction("bla", 1), element1); 
     102        simulateEvent(new DummyInteraction("bla", 2), element1); 
     103        simulateEvent(new ValueSelection<Integer>(2), element1); 
     104        simulateEvent(new ValueSelection<Integer>(1), element1); 
     105        simulateEvent(new DummyInteraction("bla", 3), element1); 
     106        simulateEvent(new ValueSelection<Integer>(3), element1); 
     107        simulateEvent(new ValueSelection<Integer>(2), element1); 
     108        simulateEvent(new ValueSelection<Integer>(3), element1); 
     109        simulateEvent(new DummyInteraction("bla", 1), element1); 
     110        simulateEvent(new DummyInteraction("bla", 2), element1); 
     111        simulateEvent(new ValueSelection<Integer>(1), element1); 
     112        simulateEvent(new ValueSelection<Integer>(1), element1); 
     113 
     114        new TaskTreeChecker().assertTaskTree 
     115            ("Sequence sequence1 {" + 
     116             "  Iteration interation1 {" + 
     117             "    Selection selection1 {" + 
     118             "      Event ValueSelection {}" + 
     119             "      Event ValueSelection {}" + 
     120             "      Event ValueSelection {}" + 
     121             "    }" + 
     122             "  }" + 
     123             "  Event bla {}" + 
     124             "  Event bla {}" + 
     125             "  Iteration interation2 {" + 
     126             "    Selection selection2 {" + 
     127             "      Event ValueSelection {}" + 
     128             "      Event ValueSelection {}" + 
     129             "    }" + 
     130             "  }" + 
     131             "  Event bla {}" + 
     132             "  Iteration interation3 {" + 
     133             "    Selection selection3 {" + 
     134             "      Event ValueSelection {}" + 
     135             "      Event ValueSelection {}" + 
     136             "    }" + 
     137             "  }" + 
     138             "  Event bla {}" + 
     139             "  Event bla {}" + 
     140             "  Iteration interation4 {" + 
     141             "    Selection selection4 {" + 
     142             "      Event ValueSelection {}" + 
     143             "    }" + 
     144             "  }" + 
     145             "}", getTaskTree()); 
     146    } 
     147 
     148    /** 
     149     * TODO comment 
     150     *  
     151     * @version $Revision: $ $Date: 28.04.2012$ 
     152     * @author 2012, last modified by $Author: patrick$ 
     153     */ 
     154    public class DummyTrackBar extends DummyGUIElement implements ITrackBar { 
     155 
     156        /**  */ 
     157        private static final long serialVersionUID = 1L; 
     158 
     159         /** 
     160          * 
     161          */ 
     162         public DummyTrackBar() { 
     163            super("DummyTrackBar"); 
     164        } 
     165    } 
    179166 
    180167} 
Note: See TracChangeset for help on using the changeset viewer.