Index: /trunk/autoquest-core-events-test/.classpath
===================================================================
--- /trunk/autoquest-core-events-test/.classpath	(revision 892)
+++ /trunk/autoquest-core-events-test/.classpath	(revision 892)
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java">
+		<attributes>
+			<attribute name="optional" value="true"/>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="src" output="target/classes" path="src/main/java">
+		<attributes>
+			<attribute name="optional" value="true"/>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
+		<attributes>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+		<attributes>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>
Index: /trunk/autoquest-core-events-test/.project
===================================================================
--- /trunk/autoquest-core-events-test/.project	(revision 892)
+++ /trunk/autoquest-core-events-test/.project	(revision 892)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>quest-core-events-test</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.m2e.core.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.m2e.core.maven2Nature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>
Index: /trunk/autoquest-core-events-test/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- /trunk/autoquest-core-events-test/.settings/org.eclipse.jdt.core.prefs	(revision 892)
+++ /trunk/autoquest-core-events-test/.settings/org.eclipse.jdt.core.prefs	(revision 892)
@@ -0,0 +1,5 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.6
Index: /trunk/autoquest-core-events-test/.settings/org.eclipse.m2e.core.prefs
===================================================================
--- /trunk/autoquest-core-events-test/.settings/org.eclipse.m2e.core.prefs	(revision 892)
+++ /trunk/autoquest-core-events-test/.settings/org.eclipse.m2e.core.prefs	(revision 892)
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
Index: /trunk/autoquest-core-events-test/pom.xml
===================================================================
--- /trunk/autoquest-core-events-test/pom.xml	(revision 892)
+++ /trunk/autoquest-core-events-test/pom.xml	(revision 892)
@@ -0,0 +1,34 @@
+<project
+    xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+>
+    <parent>
+        <groupId>de.ugoe.cs.quest</groupId>
+        <artifactId>quest-test</artifactId>
+        <version>0.0.1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>quest-core-events-test</artifactId>
+    <properties>
+        <tested-artifactId>quest-core-events</tested-artifactId>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>junit-addons</groupId>
+            <artifactId>junit-addons</artifactId>
+            <version>1.4</version>
+        </dependency>
+        <dependency>
+            <groupId>nl.jqno.equalsverifier</groupId>
+            <artifactId>equalsverifier</artifactId>
+            <version>1.1.3</version>
+        </dependency>
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-core</artifactId>
+            <version>1.9.0</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+</project>
Index: /trunk/autoquest-core-events-test/src/test/java/de/ugoe/cs/quest/SequenceInstanceOfTest.java
===================================================================
--- /trunk/autoquest-core-events-test/src/test/java/de/ugoe/cs/quest/SequenceInstanceOfTest.java	(revision 892)
+++ /trunk/autoquest-core-events-test/src/test/java/de/ugoe/cs/quest/SequenceInstanceOfTest.java	(revision 892)
@@ -0,0 +1,102 @@
+package de.ugoe.cs.quest;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.junit.*;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.*;
+
+import de.ugoe.cs.quest.SequenceInstanceOf;
+import de.ugoe.cs.quest.eventcore.Event;
+import de.ugoe.cs.quest.eventcore.IEventType;
+
+
+/**
+ * The class <code>SequenceInstanceOfTest</code> contains tests for the
+ * class <code>{@link SequenceInstanceOf}</code>.
+ * 
+ * @author Steffen Herbold
+ * @version 1.0
+ */
+public class SequenceInstanceOfTest {
+	
+	@Test
+	public void TestIsCollectionOfSequences_1() throws Exception {
+		Collection<List<Event>> sequences = new LinkedList<List<Event>>();
+		List<Event> sequence1 = new ArrayList<Event>();
+		sequence1.add(new Event(mock(IEventType.class)));
+		sequences.add(sequence1);
+		
+		boolean result = SequenceInstanceOf.isCollectionOfSequences(sequences);
+		assertTrue(result);
+	}
+	
+	@Test
+	public void TestIsCollectionOfSequences_2() throws Exception {
+		Collection<List<Event>> sequences = new LinkedList<List<Event>>();
+		List<Event> sequence1 = new ArrayList<Event>();
+		sequences.add(sequence1);
+		
+		boolean result = SequenceInstanceOf.isCollectionOfSequences(sequences);
+		assertFalse(result);
+	}
+	
+	@Test
+	public void TestIsCollectionOfSequences_3() throws Exception {
+		Collection<List<Event>> sequences = new LinkedList<List<Event>>();
+		
+		boolean result = SequenceInstanceOf.isCollectionOfSequences(sequences);
+		assertFalse(result);
+	}
+	
+	@Test
+	public void TestIsCollectionOfSequences_4() throws Exception {
+		boolean result = SequenceInstanceOf.isCollectionOfSequences(null);
+		assertFalse(result);
+	}
+	
+	@Test
+	public void TestIsCollectionOfSequences_5() throws Exception {
+		boolean result = SequenceInstanceOf.isCollectionOfSequences(new Object());
+		assertFalse(result);
+	}
+	
+	@Test
+	public void TestIsEventSequence_1() throws Exception {
+		List<Event> sequence = new ArrayList<Event>();
+		sequence.add(new Event(mock(IEventType.class)));
+		
+		boolean result = SequenceInstanceOf.isEventSequence(sequence);
+		assertTrue(result);
+	}
+	
+	@Test
+	public void TestIsEventSequence_2() throws Exception {
+		List<Event> sequence = new ArrayList<Event>();
+		
+		boolean result = SequenceInstanceOf.isEventSequence(sequence);
+		assertFalse(result);
+	}
+	
+	@Test
+	public void TestIsEventSequence_3() throws Exception {
+		boolean result = SequenceInstanceOf.isEventSequence(null);
+		assertFalse(result);
+	}
+	
+	@Test
+	public void TestIsEventSequence_4() throws Exception {
+		boolean result = SequenceInstanceOf.isEventSequence(new Object());
+		assertFalse(result);
+	}
+	
+	
+	
+	public static void main(String[] args) {
+		new org.junit.runner.JUnitCore().run(SequenceInstanceOfTest.class);
+	}
+}
Index: /trunk/autoquest-core-events-test/src/test/java/de/ugoe/cs/quest/eventcore/EventTest.java
===================================================================
--- /trunk/autoquest-core-events-test/src/test/java/de/ugoe/cs/quest/eventcore/EventTest.java	(revision 892)
+++ /trunk/autoquest-core-events-test/src/test/java/de/ugoe/cs/quest/eventcore/EventTest.java	(revision 892)
@@ -0,0 +1,301 @@
+package de.ugoe.cs.quest.eventcore;
+
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.junit.*;
+
+import de.ugoe.cs.quest.eventcore.Event;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.*;
+
+/**
+ * The class <code>EventTest</code> contains tests for the class <code>{@link Event}</code>.
+ * 
+ * @author Steffen Herbold
+ * @version 1.0
+ */
+public class EventTest {
+
+    @Test
+    public void testEvent_1() throws Exception {
+        Event result = new Event(mock(IEventType.class));
+
+        assertNotNull(result);
+    }
+
+    @Test(expected = java.lang.IllegalArgumentException.class)
+    public void testEvent_2() throws Exception {
+        new Event(null);
+    }
+
+    /*
+    @Test
+    public void testEquals_1() throws Exception {
+        IEventType type1 = mock(IEventType.class);
+        IEventType type2 = mock(IEventType.class);
+        // when(type1.equals(type2)).thenReturn(true);
+        Event fixture = new Event(type1);
+        Event other = new Event(type2);
+
+        boolean result = fixture.equals(other);
+
+        assertTrue(result);
+    }
+
+    @Test
+    public void testEquals_2() throws Exception {
+        String type1 = "typeString1";
+        String type2 = "typeString2";
+        Event fixture = new Event(type1);
+        Event other = new Event(type2);
+
+        boolean result = fixture.equals(other);
+
+        assertFalse(result);
+    }
+
+    @Test
+    public void testEquals_3() throws Exception {
+        String type1 = "typeString";
+        String type2 = "typeString";
+        String target1 = "target";
+        String target2 = "target";
+        Event fixture = new Event(type1);
+        fixture.target = target1;
+        Event other = new Event(type2);
+        other.target = target2;
+
+        boolean result = fixture.equals(other);
+
+        assertTrue(result);
+    }
+
+    @Test
+    public void testEquals_4() throws Exception {
+        String type1 = "typeString1";
+        String type2 = "typeString2";
+        String target1 = "target";
+        String target2 = "target";
+        Event fixture = new Event(type1);
+        fixture.target = target1;
+        Event other = new Event(type2);
+        other.target = target2;
+
+        boolean result = fixture.equals(other);
+
+        assertFalse(result);
+    }
+
+    @Test
+    public void testEquals_5() throws Exception {
+        String type1 = "typeString";
+        String type2 = "typeString";
+        String target1 = "target1";
+        String target2 = "target2";
+        Event fixture = new Event(type1);
+        fixture.target = target1;
+        Event other = new Event(type2);
+        other.target = target2;
+
+        boolean result = fixture.equals(other);
+
+        assertFalse(result);
+    }
+
+    @Test
+    public void testEquals_6() throws Exception {
+        String type = "typeString";
+        Event fixture = new Event(type);
+
+        boolean result = fixture.equals(fixture);
+
+        assertTrue(result);
+    }
+
+    @Test
+    public void testEqualsContract() throws Exception {
+        EqualsVerifier.forClass(Event.class).suppress(Warning.NONFINAL_FIELDS)
+            .withRedefinedSubclass(ReplayableEvent.class).verify();
+    }
+    */
+
+    @Test
+    public void testGetTarget_1() throws Exception {
+        IEventType type = mock(IEventType.class);
+        IEventTarget target = mock(IEventTarget.class);
+        
+        Event fixture = new Event(type);
+        fixture.setTarget(target);
+
+        IEventTarget result = fixture.getTarget();
+
+        assertSame(target, result);
+    }
+    
+    
+
+    @Test
+    public void testGetTarget_2() throws Exception {
+        IEventType type = mock(IEventType.class);
+        IEventTarget target = mock(IEventTarget.class);
+        
+        Event fixture = new Event(type, target);
+
+        IEventTarget result = fixture.getTarget();
+
+        assertSame(target, result);
+    }
+    
+    @Test
+    public void testGetTarget_3() throws Exception {
+        IEventType type = mock(IEventType.class);
+        
+        Event fixture = new Event(type);
+
+        IEventTarget result = fixture.getTarget();
+
+        assertNull(result);
+    }
+
+    @Test
+    public void testGetType_1() throws Exception {
+        IEventType type = mock(IEventType.class);
+        
+        Event fixture = new Event(type);
+
+        IEventType result = fixture.getType();
+
+        assertEquals(type, result);
+    }
+
+    @Test
+    public void testSetTarget_1() throws Exception {
+        IEventType type = mock(IEventType.class);
+        IEventTarget target = mock(IEventTarget.class);
+        
+        Event fixture = new Event(type);
+
+        boolean result = fixture.setTarget(target);
+
+        assertTrue(result);
+        assertEquals(target, fixture.getTarget());
+    }
+
+    @Test
+    public void testSetTarget_2() throws Exception {
+        IEventType type = mock(IEventType.class);
+        IEventTarget target1 = mock(IEventTarget.class);
+        IEventTarget target2 = mock(IEventTarget.class);
+        
+        Event fixture = new Event(type);
+
+        fixture.setTarget(target1);
+        boolean result = fixture.setTarget(target2);
+        
+        assertFalse(result);
+        assertEquals(target1, fixture.target);
+    }
+    
+    @Test
+    public void testSetTarget_3() throws Exception {
+        IEventType type = mock(IEventType.class);
+        IEventTarget target1 = mock(IEventTarget.class);
+        IEventTarget target2 = mock(IEventTarget.class);
+        
+        Event fixture = new Event(type, target1);
+
+        boolean result = fixture.setTarget(target2);
+        
+        assertFalse(result);
+        assertEquals(target1, fixture.target);
+    }
+
+    @Test
+    public void testGetId_1() throws Exception {
+        IEventType type = mock(IEventType.class);
+        when(type.toString()).thenReturn("typeString");
+        IEventTarget target = mock(IEventTarget.class);
+        when(target.getStringIdentifier()).thenReturn("targetString");
+        
+        Event fixture = new Event(type, target);
+
+        String result = fixture.toString();
+
+        assertEquals("typeString.targetString", result);
+    }
+    
+    @Test
+    public void testGetId_2() throws Exception {
+        IEventType type = mock(IEventType.class);
+        when(type.toString()).thenReturn("typeString");
+        
+        Event fixture = new Event(type);
+        
+        String result = fixture.toString();
+        
+        assertEquals("typeString", result);
+    }
+    
+    @Test
+    public void testAddReplayable_1() throws Exception {
+        IReplayable replayable = mock(IReplayable.class);
+
+        Event fixture = new Event(mock(IEventType.class));
+        fixture.addReplayable(replayable);
+
+        assertEquals(1, fixture.getReplayables().size());
+        assertEquals(replayable, fixture.getReplayables().get(0));
+    }
+
+    @Test
+    public void testAddReplayEvent_2() throws Exception {
+        IReplayable replayable1 = mock(IReplayable.class);
+        IReplayable replayable2 = mock(IReplayable.class);
+
+        Event fixture = new Event(mock(IEventType.class));
+        fixture.addReplayable(replayable1);
+        fixture.addReplayable(replayable2);
+
+        assertEquals(2, fixture.getReplayables().size());
+        assertEquals(replayable1, fixture.getReplayables().get(0));
+        assertEquals(replayable2, fixture.getReplayables().get(1));
+    }
+
+    @Test(expected = java.lang.IllegalArgumentException.class)
+    public void testAddReplayEvent_fixture_3() throws Exception {
+        Event fixture = new Event(mock(IEventType.class));
+        fixture.addReplayable(null);
+    }
+
+    @Test
+    public void testAddReplaySequence_1() throws Exception {
+        IReplayable replayable1 = mock(IReplayable.class);
+        IReplayable replayable2 = mock(IReplayable.class);
+
+        List<IReplayable> replayableSequences = new LinkedList<IReplayable>();
+        replayableSequences.add(replayable1);
+        replayableSequences.add(replayable2);
+
+        Event fixture = new Event(mock(IEventType.class));
+
+        fixture.addReplayableSequence(replayableSequences);
+
+        assertEquals(2, fixture.getReplayables().size());
+        assertEquals(replayable1, fixture.getReplayables().get(0));
+        assertEquals(replayable2, fixture.getReplayables().get(1));
+    }
+
+    @Test(expected = java.lang.IllegalArgumentException.class)
+    public void testAddReplaySequence_2() throws Exception {
+        Event fixture = new Event(mock(IEventType.class));
+
+        fixture.addReplayableSequence(null);
+    }
+
+    public static void main(String[] args) {
+        new org.junit.runner.JUnitCore().run(EventTest.class);
+    }
+}
Index: /trunk/autoquest-core-events-test/src/test/java/de/ugoe/cs/quest/eventcore/gui/KeyInteractionCorrectorTest.java
===================================================================
--- /trunk/autoquest-core-events-test/src/test/java/de/ugoe/cs/quest/eventcore/gui/KeyInteractionCorrectorTest.java	(revision 892)
+++ /trunk/autoquest-core-events-test/src/test/java/de/ugoe/cs/quest/eventcore/gui/KeyInteractionCorrectorTest.java	(revision 892)
@@ -0,0 +1,432 @@
+
+package de.ugoe.cs.quest.eventcore.gui;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.LinkedList;
+import java.util.List;
+import java.util.logging.Level;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+import static org.mockito.Mockito.*;
+
+import de.ugoe.cs.quest.eventcore.Event;
+import de.ugoe.cs.quest.eventcore.gui.KeyInteractionCorrector.CleanupMode;
+import de.ugoe.cs.quest.eventcore.gui.MouseButtonInteraction.Button;
+import de.ugoe.cs.quest.eventcore.guimodel.IGUIElement;
+import de.ugoe.cs.tasktree.keyboardmaps.VirtualKey;
+import de.ugoe.cs.util.console.Console;
+import de.ugoe.cs.util.console.TextConsole;
+
+/**
+ * @author Patrick Harms, Steffen Herbold
+ */
+public class KeyInteractionCorrectorTest {
+
+    @Test
+    public void testSortKeyInteractions_1() {
+        List<Event> input = new LinkedList<Event>();
+        List<Event> expected = new LinkedList<Event>();
+
+        KeyInteractionCorrector sorter = new KeyInteractionCorrector();
+
+        IGUIElement guiElement = mock(IGUIElement.class);
+
+        // Normal pressing and releasing of A and B
+        input.add(new Event(new KeyPressed(VirtualKey.LETTER_A), guiElement));
+        input.add(new Event(new KeyReleased(VirtualKey.LETTER_A), guiElement));
+        input.add(new Event(new KeyPressed(VirtualKey.LETTER_B), guiElement));
+        input.add(new Event(new KeyReleased(VirtualKey.LETTER_B), guiElement));
+
+        expected.add(new Event(new KeyTyped(VirtualKey.LETTER_A), guiElement));
+        expected.add(new Event(new KeyTyped(VirtualKey.LETTER_B), guiElement));
+
+        List<Event> output = sorter.sortKeyInteractions(input);
+
+        assertEquals(expected, output);
+    }
+
+    @Test
+    public void testSortKeyInteractions_2() {
+        List<Event> input = new LinkedList<Event>();
+        List<Event> expected = new LinkedList<Event>();
+
+        KeyInteractionCorrector sorter = new KeyInteractionCorrector();
+
+        IGUIElement guiElement = mock(IGUIElement.class);
+
+        // A is pressed and not released before B is pressed
+        input.add(new Event(new KeyPressed(VirtualKey.LETTER_A), guiElement));
+        input.add(new Event(new KeyPressed(VirtualKey.LETTER_B), guiElement));
+        input.add(new Event(new KeyReleased(VirtualKey.LETTER_A), guiElement));
+        input.add(new Event(new KeyReleased(VirtualKey.LETTER_B), guiElement));
+
+        expected.add(new Event(new KeyTyped(VirtualKey.LETTER_A), guiElement));
+        expected.add(new Event(new KeyTyped(VirtualKey.LETTER_B), guiElement));
+
+        List<Event> output = sorter.sortKeyInteractions(input);
+
+        assertEquals(expected, output);
+    }
+
+    @Test
+    public void testSortKeyInteractions_3() {
+        List<Event> input = new LinkedList<Event>();
+        List<Event> expected = new LinkedList<Event>();
+
+        KeyInteractionCorrector sorter = new KeyInteractionCorrector();
+
+        IGUIElement guiElement = mock(IGUIElement.class);
+
+        // SHIFT is pressed and released after all keys are pressed
+        input.add(new Event(new KeyPressed(VirtualKey.SHIFT), guiElement));
+        input.add(new Event(new KeyPressed(VirtualKey.LETTER_A), guiElement));
+        input.add(new Event(new KeyReleased(VirtualKey.LETTER_A), guiElement));
+        input.add(new Event(new KeyPressed(VirtualKey.LETTER_B), guiElement));
+        input.add(new Event(new KeyReleased(VirtualKey.LETTER_B), guiElement));
+        input.add(new Event(new KeyReleased(VirtualKey.SHIFT), guiElement));
+
+        expected.add(new Event(new KeyPressed(VirtualKey.SHIFT), guiElement));
+        expected.add(new Event(new KeyTyped(VirtualKey.LETTER_A), guiElement));
+        expected.add(new Event(new KeyTyped(VirtualKey.LETTER_B), guiElement));
+        expected.add(new Event(new KeyReleased(VirtualKey.SHIFT), guiElement));
+
+        List<Event> output = sorter.sortKeyInteractions(input);
+
+        assertEquals(expected, output);
+    }
+
+    @Test
+    public void testSortKeyInteractions_4() {
+        List<Event> input = new LinkedList<Event>();
+        List<Event> expected = new LinkedList<Event>();
+
+        KeyInteractionCorrector sorter = new KeyInteractionCorrector();
+
+        IGUIElement guiElement = mock(IGUIElement.class);
+
+        // SHIFT is released before the last key is released
+        input.add(new Event(new KeyPressed(VirtualKey.SHIFT), guiElement));
+        input.add(new Event(new KeyPressed(VirtualKey.LETTER_A), guiElement));
+        input.add(new Event(new KeyReleased(VirtualKey.LETTER_A), guiElement));
+        input.add(new Event(new KeyPressed(VirtualKey.LETTER_B), guiElement));
+        input.add(new Event(new KeyReleased(VirtualKey.SHIFT), guiElement));
+        input.add(new Event(new KeyReleased(VirtualKey.LETTER_B), guiElement));
+
+        expected.add(new Event(new KeyPressed(VirtualKey.SHIFT), guiElement));
+        expected.add(new Event(new KeyTyped(VirtualKey.LETTER_A), guiElement));
+        expected.add(new Event(new KeyTyped(VirtualKey.LETTER_B), guiElement));
+        expected.add(new Event(new KeyReleased(VirtualKey.SHIFT), guiElement));
+
+        List<Event> output = sorter.sortKeyInteractions(input);
+
+        assertEquals(expected, output);
+    }
+
+    @Test
+    public void testSortKeyInteractions_5() {
+        List<Event> input = new LinkedList<Event>();
+        List<Event> expected = new LinkedList<Event>();
+
+        KeyInteractionCorrector sorter = new KeyInteractionCorrector();
+
+        IGUIElement guiElement = mock(IGUIElement.class);
+
+        // SHIFT is released before all other keys are released
+        input.add(new Event(new KeyPressed(VirtualKey.SHIFT), guiElement));
+        input.add(new Event(new KeyPressed(VirtualKey.LETTER_A), guiElement));
+        input.add(new Event(new KeyPressed(VirtualKey.LETTER_B), guiElement));
+        input.add(new Event(new KeyPressed(VirtualKey.LETTER_C), guiElement));
+        input.add(new Event(new KeyReleased(VirtualKey.SHIFT), guiElement));
+        input.add(new Event(new KeyReleased(VirtualKey.LETTER_A), guiElement));
+        input.add(new Event(new KeyReleased(VirtualKey.LETTER_B), guiElement));
+        input.add(new Event(new KeyReleased(VirtualKey.LETTER_C), guiElement));
+
+        expected.add(new Event(new KeyPressed(VirtualKey.SHIFT), guiElement));
+        expected.add(new Event(new KeyTyped(VirtualKey.LETTER_A), guiElement));
+        expected.add(new Event(new KeyTyped(VirtualKey.LETTER_B), guiElement));
+        expected.add(new Event(new KeyTyped(VirtualKey.LETTER_C), guiElement));
+        expected.add(new Event(new KeyReleased(VirtualKey.SHIFT), guiElement));
+
+        List<Event> output = sorter.sortKeyInteractions(input);
+
+        assertEquals(expected, output);
+    }
+
+    @Test
+    public void testSortKeyInteractions_6() {
+        List<Event> input = new LinkedList<Event>();
+        List<Event> expected = new LinkedList<Event>();
+
+        KeyInteractionCorrector sorter = new KeyInteractionCorrector();
+
+        IGUIElement guiElement = mock(IGUIElement.class);
+
+        // SHIFT, CTRL and ALT are pressed and released after all keys are pressed
+        input.add(new Event(new KeyPressed(VirtualKey.SHIFT), guiElement));
+        input.add(new Event(new KeyPressed(VirtualKey.CONTROL), guiElement));
+        input.add(new Event(new KeyPressed(VirtualKey.ALT), guiElement));
+        input.add(new Event(new KeyPressed(VirtualKey.LETTER_A), guiElement));
+        input.add(new Event(new KeyReleased(VirtualKey.LETTER_A), guiElement));
+        input.add(new Event(new KeyPressed(VirtualKey.LETTER_B), guiElement));
+        input.add(new Event(new KeyReleased(VirtualKey.LETTER_B), guiElement));
+        input.add(new Event(new KeyReleased(VirtualKey.ALT), guiElement));
+        input.add(new Event(new KeyReleased(VirtualKey.CONTROL), guiElement));
+        input.add(new Event(new KeyReleased(VirtualKey.SHIFT), guiElement));
+
+        expected.add(new Event(new KeyPressed(VirtualKey.SHIFT), guiElement));
+        expected.add(new Event(new KeyPressed(VirtualKey.CONTROL), guiElement));
+        expected.add(new Event(new KeyPressed(VirtualKey.ALT), guiElement));
+        expected.add(new Event(new KeyTyped(VirtualKey.LETTER_A), guiElement));
+        expected.add(new Event(new KeyTyped(VirtualKey.LETTER_B), guiElement));
+        expected.add(new Event(new KeyReleased(VirtualKey.ALT), guiElement));
+        expected.add(new Event(new KeyReleased(VirtualKey.CONTROL), guiElement));
+        expected.add(new Event(new KeyReleased(VirtualKey.SHIFT), guiElement));
+
+        List<Event> output = sorter.sortKeyInteractions(input);
+
+        assertEquals(expected, output);
+    }
+
+    @Test
+    public void testSortKeyInteractions_7() {
+        List<Event> input = new LinkedList<Event>();
+        List<Event> expected = new LinkedList<Event>();
+
+        KeyInteractionCorrector sorter = new KeyInteractionCorrector();
+
+        IGUIElement guiElement = mock(IGUIElement.class);
+
+        // now SHIFT, CTRL and ALT are released before the last key is released
+        input.add(new Event(new KeyPressed(VirtualKey.SHIFT), guiElement));
+        input.add(new Event(new KeyPressed(VirtualKey.CONTROL), guiElement));
+        input.add(new Event(new KeyPressed(VirtualKey.ALT), guiElement));
+        input.add(new Event(new KeyPressed(VirtualKey.LETTER_A), guiElement));
+        input.add(new Event(new KeyReleased(VirtualKey.LETTER_A), guiElement));
+        input.add(new Event(new KeyPressed(VirtualKey.LETTER_B), guiElement));
+        input.add(new Event(new KeyReleased(VirtualKey.ALT), guiElement));
+        input.add(new Event(new KeyReleased(VirtualKey.CONTROL), guiElement));
+        input.add(new Event(new KeyReleased(VirtualKey.SHIFT), guiElement));
+        input.add(new Event(new KeyReleased(VirtualKey.LETTER_B), guiElement));
+
+        expected.add(new Event(new KeyPressed(VirtualKey.SHIFT), guiElement));
+        expected.add(new Event(new KeyPressed(VirtualKey.CONTROL), guiElement));
+        expected.add(new Event(new KeyPressed(VirtualKey.ALT), guiElement));
+        expected.add(new Event(new KeyTyped(VirtualKey.LETTER_A), guiElement));
+        expected.add(new Event(new KeyTyped(VirtualKey.LETTER_B), guiElement));
+        expected.add(new Event(new KeyReleased(VirtualKey.ALT), guiElement));
+        expected.add(new Event(new KeyReleased(VirtualKey.CONTROL), guiElement));
+        expected.add(new Event(new KeyReleased(VirtualKey.SHIFT), guiElement));
+
+        List<Event> output = sorter.sortKeyInteractions(input);
+
+        assertEquals(expected, output);
+    }
+
+    @Test
+    public void testSortKeyInteractions_8() {
+        List<Event> input = new LinkedList<Event>();
+        List<Event> expected = new LinkedList<Event>();
+
+        KeyInteractionCorrector sorter = new KeyInteractionCorrector();
+
+        IGUIElement guiElement = mock(IGUIElement.class);
+
+        // SHIFT, CTRL and ALT are released in another order and before some other keys are
+        // released
+        input.add(new Event(new KeyPressed(VirtualKey.SHIFT), guiElement));
+        input.add(new Event(new KeyPressed(VirtualKey.CONTROL), guiElement));
+        input.add(new Event(new KeyPressed(VirtualKey.ALT), guiElement));
+        input.add(new Event(new KeyPressed(VirtualKey.LETTER_A), guiElement));
+        input.add(new Event(new KeyReleased(VirtualKey.LETTER_A), guiElement));
+        input.add(new Event(new KeyPressed(VirtualKey.LETTER_B), guiElement));
+        input.add(new Event(new KeyPressed(VirtualKey.LETTER_C), guiElement));
+        input.add(new Event(new KeyReleased(VirtualKey.SHIFT), guiElement));
+        input.add(new Event(new KeyReleased(VirtualKey.ALT), guiElement));
+        input.add(new Event(new KeyReleased(VirtualKey.CONTROL), guiElement));
+        input.add(new Event(new KeyReleased(VirtualKey.LETTER_B), guiElement));
+        input.add(new Event(new KeyReleased(VirtualKey.LETTER_C), guiElement));
+
+        expected.add(new Event(new KeyPressed(VirtualKey.SHIFT), guiElement));
+        expected.add(new Event(new KeyPressed(VirtualKey.CONTROL), guiElement));
+        expected.add(new Event(new KeyPressed(VirtualKey.ALT), guiElement));
+        expected.add(new Event(new KeyTyped(VirtualKey.LETTER_A), guiElement));
+        expected.add(new Event(new KeyTyped(VirtualKey.LETTER_B), guiElement));
+        expected.add(new Event(new KeyTyped(VirtualKey.LETTER_C), guiElement));
+        expected.add(new Event(new KeyReleased(VirtualKey.ALT), guiElement));
+        expected.add(new Event(new KeyReleased(VirtualKey.CONTROL), guiElement));
+        expected.add(new Event(new KeyReleased(VirtualKey.SHIFT), guiElement));
+
+        List<Event> output = sorter.sortKeyInteractions(input);
+
+        assertEquals(expected, output);
+    }
+
+    @Test
+    public void testSortKeyInteractions_9() {
+        List<Event> input = new LinkedList<Event>();
+        List<Event> expected = new LinkedList<Event>();
+
+        KeyInteractionCorrector sorter = new KeyInteractionCorrector();
+
+        IGUIElement guiElement = mock(IGUIElement.class);
+
+        // holding of A
+        input.add(new Event(new KeyPressed(VirtualKey.LETTER_A), guiElement));
+        input.add(new Event(new KeyPressed(VirtualKey.LETTER_A), guiElement));
+        input.add(new Event(new KeyPressed(VirtualKey.LETTER_A), guiElement));
+        input.add(new Event(new KeyPressed(VirtualKey.LETTER_A), guiElement));
+        input.add(new Event(new KeyPressed(VirtualKey.LETTER_A), guiElement));
+        input.add(new Event(new KeyPressed(VirtualKey.LETTER_A), guiElement));
+        input.add(new Event(new KeyPressed(VirtualKey.LETTER_A), guiElement));
+        input.add(new Event(new KeyPressed(VirtualKey.LETTER_A), guiElement));
+        input.add(new Event(new KeyPressed(VirtualKey.LETTER_A), guiElement));
+        input.add(new Event(new KeyReleased(VirtualKey.LETTER_A), guiElement));
+
+        expected.add(new Event(new KeyTyped(VirtualKey.LETTER_A), guiElement));
+        expected.add(new Event(new KeyTyped(VirtualKey.LETTER_A), guiElement));
+        expected.add(new Event(new KeyTyped(VirtualKey.LETTER_A), guiElement));
+        expected.add(new Event(new KeyTyped(VirtualKey.LETTER_A), guiElement));
+        expected.add(new Event(new KeyTyped(VirtualKey.LETTER_A), guiElement));
+        expected.add(new Event(new KeyTyped(VirtualKey.LETTER_A), guiElement));
+        expected.add(new Event(new KeyTyped(VirtualKey.LETTER_A), guiElement));
+        expected.add(new Event(new KeyTyped(VirtualKey.LETTER_A), guiElement));
+        expected.add(new Event(new KeyTyped(VirtualKey.LETTER_A), guiElement));
+
+        List<Event> output = sorter.sortKeyInteractions(input);
+
+        assertEquals(expected, output);
+    }
+
+    @Test
+    public void testSortKeyInteractions_10() {
+        List<Event> input = new LinkedList<Event>();
+        List<Event> expected = new LinkedList<Event>();
+
+        KeyInteractionCorrector sorter = new KeyInteractionCorrector();
+
+        IGUIElement guiElement = mock(IGUIElement.class);
+
+        // holding of shift and meanwhile pressing of A
+        input.add(new Event(new KeyPressed(VirtualKey.SHIFT), guiElement));
+        input.add(new Event(new KeyPressed(VirtualKey.SHIFT), guiElement));
+        input.add(new Event(new KeyPressed(VirtualKey.SHIFT), guiElement));
+        input.add(new Event(new KeyPressed(VirtualKey.SHIFT), guiElement));
+        input.add(new Event(new KeyPressed(VirtualKey.SHIFT), guiElement));
+        input.add(new Event(new KeyPressed(VirtualKey.SHIFT), guiElement));
+        input.add(new Event(new KeyPressed(VirtualKey.SHIFT), guiElement));
+        input.add(new Event(new KeyPressed(VirtualKey.SHIFT), guiElement));
+        input.add(new Event(new KeyPressed(VirtualKey.SHIFT), guiElement));
+        input.add(new Event(new KeyPressed(VirtualKey.LETTER_A), guiElement));
+        input.add(new Event(new KeyReleased(VirtualKey.LETTER_A), guiElement));
+        input.add(new Event(new KeyReleased(VirtualKey.SHIFT), guiElement));
+
+        expected.add(new Event(new KeyPressed(VirtualKey.SHIFT), guiElement));
+        expected.add(new Event(new KeyTyped(VirtualKey.LETTER_A), guiElement));
+        expected.add(new Event(new KeyReleased(VirtualKey.SHIFT), guiElement));
+
+        List<Event> output = sorter.sortKeyInteractions(input);
+
+        assertEquals(expected, output);
+    }
+
+    @Test
+    public void testSortKeyInteractions_11() {
+        List<Event> input = new LinkedList<Event>();
+        List<Event> expected = new LinkedList<Event>();
+
+        KeyInteractionCorrector sorter = new KeyInteractionCorrector();
+
+        IGUIElement guiElement = mock(IGUIElement.class);
+
+        // Check if keyboard focus change is moved in front of a sequence in case it is in between a
+        // pressed
+        // released pair
+        input.add(new Event(new KeyPressed(VirtualKey.LETTER_A), guiElement));
+        input.add(new Event(new KeyboardFocusChange(), guiElement));
+        input.add(new Event(new KeyReleased(VirtualKey.LETTER_A), guiElement));
+
+        expected.add(new Event(new KeyboardFocusChange(), guiElement));
+        expected.add(new Event(new KeyTyped(VirtualKey.LETTER_A), guiElement));
+
+        List<Event> output = sorter.sortKeyInteractions(input);
+
+        assertEquals(expected, output);
+    }
+
+    @Test
+    public void testSortKeyInteractions_12() {
+        List<Event> input = new LinkedList<Event>();
+        List<Event> expected = new LinkedList<Event>();
+
+        KeyInteractionCorrector sorter = new KeyInteractionCorrector();
+
+        IGUIElement guiElement = mock(IGUIElement.class);
+
+        // Check if mouse events stay where they are
+        input.add(new Event(new KeyPressed(VirtualKey.LETTER_A), guiElement));
+        input.add(new Event(new MouseButtonDown(Button.LEFT), guiElement));
+        input.add(new Event(new MouseButtonUp(Button.LEFT), guiElement));
+        input.add(new Event(new MouseClick(Button.LEFT), guiElement));
+        input.add(new Event(new KeyReleased(VirtualKey.LETTER_A), guiElement));
+
+        expected.add(new Event(new KeyTyped(VirtualKey.LETTER_A), guiElement));
+        expected.add(new Event(new MouseButtonDown(Button.LEFT), guiElement));
+        expected.add(new Event(new MouseButtonUp(Button.LEFT), guiElement));
+        expected.add(new Event(new MouseClick(Button.LEFT), guiElement));
+
+        List<Event> output = sorter.sortKeyInteractions(input);
+
+        assertEquals(expected, output);
+    }
+
+    @Test
+    public void testSortKeyInteractions_13() {
+        List<Event> input = new LinkedList<Event>();
+        List<Event> expected = new LinkedList<Event>();
+
+        KeyInteractionCorrector sorter = new KeyInteractionCorrector(CleanupMode.REMOVAL);
+
+        IGUIElement guiElement = mock(IGUIElement.class);
+
+        // Check if mouse events stay where they are
+        input.add(new Event(new KeyPressed(VirtualKey.LETTER_A), guiElement));
+        input.add(new Event(new KeyReleased(VirtualKey.LETTER_A), guiElement));
+        input.add(new Event(new KeyReleased(VirtualKey.LETTER_B), guiElement));
+
+        expected.add(new Event(new KeyTyped(VirtualKey.LETTER_A), guiElement));
+
+        List<Event> output = sorter.sortKeyInteractions(input);
+
+        assertEquals(expected, output);
+    }
+
+    @Test
+    public void testSortKeyInteractions_14() {
+        List<Event> input = new LinkedList<Event>();
+        List<Event> expected = new LinkedList<Event>();
+
+        KeyInteractionCorrector sorter = new KeyInteractionCorrector(CleanupMode.ADDITION);
+
+        IGUIElement guiElement = mock(IGUIElement.class);
+
+        // Check if mouse events stay where they are
+        input.add(new Event(new KeyPressed(VirtualKey.LETTER_A), guiElement));
+        input.add(new Event(new KeyReleased(VirtualKey.LETTER_A), guiElement));
+        input.add(new Event(new KeyReleased(VirtualKey.LETTER_B), guiElement));
+
+        expected.add(new Event(new KeyTyped(VirtualKey.LETTER_A), guiElement));
+        expected.add(new Event(new KeyTyped(VirtualKey.LETTER_B), guiElement));
+
+        List<Event> output = sorter.sortKeyInteractions(input);
+
+        assertEquals(expected, output);
+    }
+
+    @BeforeClass
+    public static void setUpBeforeClass() {
+        Console.reset();
+        Console.getInstance().registerTraceListener(new TextConsole(Level.INFO));
+    }
+}
Index: /trunk/autoquest-core-events-test/src/test/java/de/ugoe/cs/quest/eventcore/gui/MouseClickCondenserTest.java
===================================================================
--- /trunk/autoquest-core-events-test/src/test/java/de/ugoe/cs/quest/eventcore/gui/MouseClickCondenserTest.java	(revision 892)
+++ /trunk/autoquest-core-events-test/src/test/java/de/ugoe/cs/quest/eventcore/gui/MouseClickCondenserTest.java	(revision 892)
@@ -0,0 +1,109 @@
+package de.ugoe.cs.quest.eventcore.gui;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Test;
+
+import de.ugoe.cs.quest.eventcore.Event;
+import de.ugoe.cs.quest.eventcore.IEventType;
+import de.ugoe.cs.quest.eventcore.gui.MouseButtonDown;
+import de.ugoe.cs.quest.eventcore.gui.MouseButtonInteraction;
+import de.ugoe.cs.quest.eventcore.gui.MouseButtonUp;
+import de.ugoe.cs.quest.eventcore.gui.MouseClick;
+import de.ugoe.cs.quest.eventcore.guimodel.IGUIElement;
+import de.ugoe.cs.quest.test.DummyGUIElement;
+import de.ugoe.cs.quest.test.DummyInteraction;
+
+/**
+ * @author Patrick Harms
+ */
+public class MouseClickCondenserTest {
+
+    /** */
+    private List<Event> events = new ArrayList<Event>();
+
+    /**
+     *
+     */
+    @Test
+    public void testMouseClickInOneSequenceElement() {
+        MouseButtonInteraction.Button leftBtn = MouseButtonInteraction.Button.LEFT;
+        MouseButtonInteraction.Button middleBtn = MouseButtonInteraction.Button.MIDDLE;
+        MouseButtonInteraction.Button rightBtn = MouseButtonInteraction.Button.RIGHT;
+
+        IGUIElement element1 = new DummyGUIElement("elem1");
+        IGUIElement element2 = new DummyGUIElement("elem2");
+
+        simulateEvent(new MouseButtonDown(leftBtn), element1);
+        simulateEvent(new MouseButtonUp(leftBtn), element1);
+        simulateEvent(new MouseClick(leftBtn), element1);
+        assertCondensedMouseClicks("elem1");
+
+        simulateEvent(new DummyInteraction("bla", 1), element1);
+        simulateEvent(new DummyInteraction("bli", 1), element1);
+        simulateEvent(new MouseButtonDown(middleBtn), element1);
+        simulateEvent(new MouseButtonUp(middleBtn), element1);
+        simulateEvent(new MouseClick(middleBtn), element1);
+        simulateEvent(new DummyInteraction("blo", 1), element1);
+        simulateEvent(new DummyInteraction("blu", 1), element1);
+        assertCondensedMouseClicks("elem1", "", "", "elem1", "", "");
+
+        simulateEvent(new DummyInteraction("bla", 1), element2);
+        simulateEvent(new DummyInteraction("bli", 1), element2);
+        simulateEvent(new MouseButtonDown(rightBtn), element2);
+        simulateEvent(new MouseButtonUp(rightBtn), element2);
+        simulateEvent(new MouseClick(rightBtn), element2);
+        simulateEvent(new DummyInteraction("blo", 1), element2);
+        simulateEvent(new DummyInteraction("blu", 1), element2);
+        assertCondensedMouseClicks("elem1", "", "", "elem1", "", "", "", "", "elem2", "", "");
+
+        simulateEvent(new MouseButtonDown(leftBtn), element1);
+        simulateEvent(new MouseButtonUp(leftBtn), element1);
+        simulateEvent(new MouseClick(leftBtn), element2);
+        assertCondensedMouseClicks("elem1", "", "", "elem1", "", "", "", "", "elem2", "", "",
+                                   "", "", "elem2");
+
+        simulateEvent(new MouseButtonDown(middleBtn), element1);
+        simulateEvent(new MouseButtonUp(middleBtn), element1);
+        simulateEvent(new MouseClick(rightBtn), element1);
+        simulateEvent(new DummyInteraction("bla", 1), element2);
+        assertCondensedMouseClicks("elem1", "", "", "elem1", "", "", "", "", "elem2", "", "",
+                                   "", "", "elem2", "", "", "elem1", "");
+    }
+
+    /**
+     *
+     */
+    private void simulateEvent(IEventType eventType, IGUIElement guiElement) {
+        events.add(new Event(eventType, guiElement));
+    }
+
+    /**
+    *
+    */
+   private void assertCondensedMouseClicks(String... clickedTargets) {
+       MouseClickCondenser condenser = new MouseClickCondenser();
+       List<Event> result = condenser.condenseMouseClicks(events);
+       
+       assertEquals(clickedTargets.length, result.size());
+       
+       for (int i = 0; i < clickedTargets.length; i++) {
+           String clickedTarget = clickedTargets[i];
+           
+           if ((clickedTarget != null) && (!"".equals(clickedTarget))) {
+               assertTrue(result.get(i).getType() instanceof MouseClick);
+               assertTrue(result.get(i).getTarget() instanceof DummyGUIElement);
+               assertEquals
+                 (clickedTarget, ((DummyGUIElement) result.get(i).getTarget()).getStringIdentifier());
+           }
+           else {
+               assertFalse(result.get(i).getType() instanceof MouseClick);
+           }
+       }
+   }
+}
Index: /trunk/autoquest-core-events-test/src/test/java/de/ugoe/cs/quest/eventcore/gui/TextInputDetectorTest.java
===================================================================
--- /trunk/autoquest-core-events-test/src/test/java/de/ugoe/cs/quest/eventcore/gui/TextInputDetectorTest.java	(revision 892)
+++ /trunk/autoquest-core-events-test/src/test/java/de/ugoe/cs/quest/eventcore/gui/TextInputDetectorTest.java	(revision 892)
@@ -0,0 +1,217 @@
+package de.ugoe.cs.quest.eventcore.gui;
+
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Test;
+
+import de.ugoe.cs.quest.eventcore.Event;
+import de.ugoe.cs.quest.eventcore.IEventType;
+import de.ugoe.cs.quest.eventcore.guimodel.IGUIElement;
+import de.ugoe.cs.quest.test.DummyGUIElement;
+import de.ugoe.cs.quest.test.DummyTextField;
+import de.ugoe.cs.tasktree.keyboardmaps.VirtualKey;
+
+/**
+ * @author Patrick Harms
+ */
+public class TextInputDetectorTest {
+
+    /** */
+    private List<Event> events = new ArrayList<Event>();
+
+    /**
+     *
+     */
+    @Test
+    public void testSimpleTextEntry() {
+        IGUIElement element1 = new DummyTextField("elem1");
+        simulateEvent(new KeyPressed(VirtualKey.LETTER_A), element1);
+        simulateEvent(new KeyReleased(VirtualKey.LETTER_A), element1);
+        assertTextInput("a");
+
+        simulateEvent(new KeyPressed(VirtualKey.LETTER_B), element1);
+        simulateEvent(new KeyReleased(VirtualKey.LETTER_B), element1);
+        assertTextInput("ab");
+
+        simulateEvent(new KeyPressed(VirtualKey.SHIFT), element1);
+        simulateEvent(new KeyPressed(VirtualKey.LETTER_C), element1);
+        simulateEvent(new KeyReleased(VirtualKey.LETTER_C), element1);
+        simulateEvent(new KeyReleased(VirtualKey.SHIFT), element1);
+        assertTextInput("abC");
+
+        simulateEvent(new KeyPressed(VirtualKey.SHIFT), element1);
+        simulateEvent(new KeyPressed(VirtualKey.LETTER_D), element1);
+        simulateEvent(new KeyReleased(VirtualKey.LETTER_D), element1);
+        simulateEvent(new KeyPressed(VirtualKey.LETTER_E), element1);
+        simulateEvent(new KeyReleased(VirtualKey.LETTER_E), element1);
+        simulateEvent(new KeyPressed(VirtualKey.LETTER_F), element1);
+        simulateEvent(new KeyReleased(VirtualKey.LETTER_F), element1);
+        simulateEvent(new KeyReleased(VirtualKey.SHIFT), element1);
+        assertTextInput("abCDEF");
+
+        simulateEvent(new KeyPressed(VirtualKey.SHIFT), element1);
+        simulateEvent(new KeyPressed(VirtualKey.SHIFT), element1);
+        simulateEvent(new KeyPressed(VirtualKey.LETTER_G), element1);
+        simulateEvent(new KeyReleased(VirtualKey.LETTER_G), element1);
+        simulateEvent(new KeyReleased(VirtualKey.SHIFT), element1);
+        simulateEvent(new KeyReleased(VirtualKey.SHIFT), element1);
+        assertTextInput("abCDEFg");
+
+    }
+
+    /**
+     *
+     */
+    @Test
+    public void testTextEntryOnDifferentGuiElements() {
+        IGUIElement element1 = new DummyTextField("elem1");
+        IGUIElement element2 = new DummyTextField("elem2");
+        simulateEvent(new KeyPressed(VirtualKey.LETTER_A), element1);
+        simulateEvent(new KeyReleased(VirtualKey.LETTER_A), element1);
+        assertTextInput("a");
+
+        simulateEvent(new KeyPressed(VirtualKey.LETTER_B), element2);
+        simulateEvent(new KeyReleased(VirtualKey.LETTER_B), element2);
+        assertTextInput("a", "b");
+
+        simulateEvent(new KeyPressed(VirtualKey.SHIFT), element1);
+        simulateEvent(new KeyPressed(VirtualKey.LETTER_C), element1);
+        simulateEvent(new KeyReleased(VirtualKey.LETTER_C), element1);
+        simulateEvent(new KeyReleased(VirtualKey.SHIFT), element1);
+        assertTextInput("a", "b", "C");
+
+        simulateEvent(new KeyPressed(VirtualKey.SHIFT), element2);
+        simulateEvent(new KeyPressed(VirtualKey.LETTER_D), element2);
+        simulateEvent(new KeyReleased(VirtualKey.LETTER_D), element2);
+        simulateEvent(new KeyPressed(VirtualKey.LETTER_E), element2);
+        simulateEvent(new KeyReleased(VirtualKey.LETTER_E), element2);
+        simulateEvent(new KeyPressed(VirtualKey.LETTER_F), element2);
+        simulateEvent(new KeyReleased(VirtualKey.LETTER_F), element2);
+        simulateEvent(new KeyReleased(VirtualKey.SHIFT), element2);
+        assertTextInput("a", "b", "C", "DEF");
+
+        simulateEvent(new KeyPressed(VirtualKey.SHIFT), element1);
+        simulateEvent(new KeyPressed(VirtualKey.SHIFT), element1);
+        simulateEvent(new KeyPressed(VirtualKey.LETTER_G), element1);
+        simulateEvent(new KeyReleased(VirtualKey.LETTER_G), element1);
+        simulateEvent(new KeyReleased(VirtualKey.SHIFT), element1);
+        simulateEvent(new KeyReleased(VirtualKey.SHIFT), element1);
+        assertTextInput("a", "b", "C", "DEF", "g");
+
+    }
+
+    /**
+     *
+     */
+    @Test
+    public void testUsageOfBackspace() {
+        IGUIElement element1 = new DummyTextField("elem1");
+        simulateEvent(new KeyPressed(VirtualKey.LETTER_A), element1);
+        simulateEvent(new KeyReleased(VirtualKey.LETTER_A), element1);
+        simulateEvent(new KeyPressed(VirtualKey.LETTER_B), element1);
+        simulateEvent(new KeyReleased(VirtualKey.LETTER_B), element1);
+        simulateEvent(new KeyPressed(VirtualKey.LETTER_C), element1);
+        simulateEvent(new KeyReleased(VirtualKey.LETTER_C), element1);
+        simulateEvent(new KeyPressed(VirtualKey.LETTER_D), element1);
+        simulateEvent(new KeyReleased(VirtualKey.LETTER_D), element1);
+        simulateEvent(new KeyPressed(VirtualKey.BACK_SPACE), element1);
+        simulateEvent(new KeyReleased(VirtualKey.BACK_SPACE), element1);
+        simulateEvent(new KeyPressed(VirtualKey.LETTER_E), element1);
+        simulateEvent(new KeyReleased(VirtualKey.LETTER_E), element1);
+        simulateEvent(new KeyPressed(VirtualKey.LETTER_F), element1);
+        simulateEvent(new KeyReleased(VirtualKey.LETTER_F), element1);
+        assertTextInput("abcef");
+
+        simulateEvent(new KeyPressed(VirtualKey.BACK_SPACE), element1);
+        simulateEvent(new KeyReleased(VirtualKey.BACK_SPACE), element1);
+        simulateEvent(new KeyPressed(VirtualKey.BACK_SPACE), element1);
+        simulateEvent(new KeyReleased(VirtualKey.BACK_SPACE), element1);
+        simulateEvent(new KeyPressed(VirtualKey.BACK_SPACE), element1);
+        simulateEvent(new KeyReleased(VirtualKey.BACK_SPACE), element1);
+        assertTextInput("ab");
+
+    }
+
+    /**
+     *
+     */
+    @Test
+    public void testOtherInteractionsInBetween() {
+        IGUIElement element1 = new DummyTextField("elem1");
+        IGUIElement element2 = new DummyGUIElement("elem2");
+        IGUIElement element3 = new DummyGUIElement("elem3");
+        
+        simulateEvent(new MouseClick(MouseClick.Button.LEFT), element2);
+        simulateEvent(new KeyPressed(VirtualKey.LETTER_A), element1);
+        simulateEvent(new KeyReleased(VirtualKey.LETTER_A), element1);
+        simulateEvent(new KeyPressed(VirtualKey.LETTER_B), element1);
+        simulateEvent(new KeyReleased(VirtualKey.LETTER_B), element1);
+        simulateEvent(new KeyPressed(VirtualKey.LETTER_C), element1);
+        simulateEvent(new KeyReleased(VirtualKey.LETTER_C), element1);
+        assertTextInput("", "abc");
+
+        simulateEvent(new MouseClick(MouseClick.Button.LEFT), element2);
+        simulateEvent(new MouseClick(MouseClick.Button.LEFT), element3);
+        simulateEvent(new KeyPressed(VirtualKey.LETTER_A), element1);
+        simulateEvent(new KeyReleased(VirtualKey.LETTER_A), element1);
+        simulateEvent(new KeyPressed(VirtualKey.LETTER_B), element1);
+        simulateEvent(new KeyReleased(VirtualKey.LETTER_B), element1);
+        simulateEvent(new KeyPressed(VirtualKey.LETTER_C), element1);
+        simulateEvent(new KeyReleased(VirtualKey.LETTER_C), element1);
+        simulateEvent(new MouseClick(MouseClick.Button.LEFT), element3);
+        assertTextInput("", "abc", "", "", "abc", "");
+
+        simulateEvent(new MouseClick(MouseClick.Button.LEFT), element2);
+        simulateEvent(new MouseClick(MouseClick.Button.LEFT), element3);
+        simulateEvent(new KeyPressed(VirtualKey.LETTER_A), element1);
+        simulateEvent(new KeyReleased(VirtualKey.LETTER_A), element1);
+        simulateEvent(new KeyPressed(VirtualKey.LETTER_B), element1);
+        simulateEvent(new KeyReleased(VirtualKey.LETTER_B), element1);
+        simulateEvent(new KeyPressed(VirtualKey.LETTER_C), element1);
+        simulateEvent(new MouseClick(MouseClick.Button.LEFT), element3);
+        simulateEvent(new KeyReleased(VirtualKey.LETTER_C), element1);
+        
+        // the pressing of the c is not completed. So it must be included in the resulting
+        // text input event but it may only be followed by the mouse click. The subsequent release
+        // of the c key is ignored and results in a removal of the event.
+        assertTextInput("", "abc", "", "", "abc", "", "", "", "abc", "");
+    }
+
+    /**
+     *
+     */
+    private void simulateEvent(IEventType eventType, IGUIElement guiElement) {
+        events.add(new Event(eventType, guiElement));
+    }
+
+    /**
+     *
+     */
+    private void assertTextInput(String... enteredTexts) {
+        TextInputDetector detector = new TextInputDetector();
+        List<Event> result = detector.detectTextInputs(events);
+        
+        assertEquals(enteredTexts.length, result.size());
+        
+        for (int i = 0; i < enteredTexts.length; i++) {
+            String enteredText = enteredTexts[i];
+            
+            if ((enteredText != null) && (!"".equals(enteredText))) {
+                assertTrue(result.get(i).getType() instanceof TextInput);
+                assertNotNull(((TextInput) result.get(i).getType()).getEnteredText());
+                assertEquals(enteredText, ((TextInput) result.get(i).getType()).getEnteredText());
+            
+                assertNotNull(((TextInput) result.get(i).getType()).getTextInputEvents());
+                assertTrue(((TextInput) result.get(i).getType()).getTextInputEvents().size() > 0);
+                //assertTrue
+                //    ((((TextInput) result.get(i).getType()).getTextInputEvents().size() % 2) == 0);
+            }
+            else {
+                assertFalse(result.get(i).getType() instanceof TextInput);
+            }
+        }
+    }
+}
Index: /trunk/autoquest-core-events-test/src/test/java/de/ugoe/cs/quest/eventcore/guimodel/AbstractDefaultGUIElementTest.java
===================================================================
--- /trunk/autoquest-core-events-test/src/test/java/de/ugoe/cs/quest/eventcore/guimodel/AbstractDefaultGUIElementTest.java	(revision 892)
+++ /trunk/autoquest-core-events-test/src/test/java/de/ugoe/cs/quest/eventcore/guimodel/AbstractDefaultGUIElementTest.java	(revision 892)
@@ -0,0 +1,132 @@
+package de.ugoe.cs.quest.eventcore.guimodel;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+/**
+ * <p>
+ * TODO comment
+ * </p>
+ * 
+ * @version $Revision: $ $Date: 24.08.2012$
+ * @author 2012, last modified by $Author: pharms$
+ */
+public class AbstractDefaultGUIElementTest {
+
+    /**
+     * <p>
+     * TODO: comment
+     * </p>
+     */
+    @Test
+    public void testRegisteringEqualGuiElements() {
+        IGUIElement guiElement1 = new AbstractDefaultGUIElementTestImpl();
+        IGUIElement guiElement2 = new AbstractDefaultGUIElementTestImpl();
+        
+        assertCompletelyUnequal(guiElement1, guiElement2);
+        
+        guiElement1.addEqualGUIElement(guiElement2);
+        assertCompletelyEqual(guiElement1, guiElement2);
+        
+        IGUIElement guiElement3 = new AbstractDefaultGUIElementTestImpl();
+        
+        assertCompletelyEqual(guiElement1, guiElement2);
+        assertCompletelyUnequal(guiElement1, guiElement3);
+        assertCompletelyUnequal(guiElement2, guiElement3);
+        
+        guiElement1.addEqualGUIElement(guiElement3);
+        assertCompletelyEqual(guiElement1, guiElement2, guiElement3);
+
+        IGUIElement guiElement4 = new AbstractDefaultGUIElementTestImpl();
+        
+        assertCompletelyEqual(guiElement1, guiElement2, guiElement3);
+        assertCompletelyUnequal(guiElement1, guiElement4);
+        assertCompletelyUnequal(guiElement2, guiElement4);
+        assertCompletelyUnequal(guiElement3, guiElement4);
+        
+        guiElement3.addEqualGUIElement(guiElement4);
+        assertCompletelyEqual(guiElement1, guiElement2, guiElement3, guiElement4);
+    }
+    
+    /**
+     * <p>
+     * 
+     * </p>
+     */
+    private void assertCompletelyUnequal(IGUIElement... guiElements) {
+        for (int i = 0; i < guiElements.length; i++) {
+            for (int j = i + 1; j < guiElements.length; j++) {
+                assertFalse(guiElements[i].equals(guiElements[j]));
+                assertFalse(guiElements[j].equals(guiElements[i]));
+                assertNotSame(guiElements[i].hashCode(), guiElements[j].hashCode());
+            }
+        }
+    }
+
+    /**
+     * <p>
+     * 
+     * </p>
+     */
+    private void assertCompletelyEqual(IGUIElement... guiElements) {
+        for (int i = 0; i < guiElements.length; i++) {
+            for (int j = i; j < guiElements.length; j++) {
+                assertTrue(guiElements[i].equals(guiElements[j]));
+                assertTrue(guiElements[j].equals(guiElements[i]));
+                assertEquals(guiElements[i].hashCode(), guiElements[j].hashCode());
+            }
+        }
+    }
+
+    /**
+     * <p>
+     * TODO comment
+     * </p>
+     * 
+     * @version $Revision: $ $Date: 24.08.2012$
+     * @author 2012, last modified by $Author: pharms$
+     */
+    public class AbstractDefaultGUIElementTestImpl extends AbstractDefaultGUIElement
+        implements IGUIElement
+    {
+
+        /**
+         * <p>
+         * TODO: comment
+         * </p>
+         *
+         * @param specification
+         * @param parent
+         */
+        public AbstractDefaultGUIElementTestImpl() {
+            super(null, null);
+        }
+
+        /**  */
+        private static final long serialVersionUID = 1L;
+
+        /* (non-Javadoc)
+         * @see de.ugoe.cs.quest.eventcore.IEventTarget#getPlatform()
+         */
+        @Override
+        public String getPlatform() {
+            return "TEST";
+        }
+
+        /* (non-Javadoc)
+         * @see de.ugoe.cs.quest.eventcore.guimodel.IGUIElement#updateSpecification(de.ugoe.cs.quest.eventcore.guimodel.IGUIElementSpec)
+         */
+        @Override
+        public void updateSpecification(IGUIElementSpec furtherSpec) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public String getStringIdentifier() {
+            return "DUMMY";
+        }
+
+    }
+
+}
