diff options
author | neothemachine <[email protected]> | 2013-02-21 16:40:08 +0100 |
---|---|---|
committer | neothemachine <[email protected]> | 2013-02-21 16:40:08 +0100 |
commit | f774bd917e9dfd8cf46e5ed66d41aad64477a238 (patch) | |
tree | 8d33aa0cf24165710d420c677f3336641223cff8 /ardor3d-swt | |
parent | edbc5c757c66d56eb2cffffa4076f0f2bfd6e748 (diff) |
normalized line endings
see
http://www.hanselman.com/blog/YoureJustAnotherCarriageReturnLineFeedInTheWall.aspx
and https://help.github.com/articles/dealing-with-line-endings
Diffstat (limited to 'ardor3d-swt')
-rw-r--r-- | ardor3d-swt/.settings/org.eclipse.jdt.ui.prefs | 226 | ||||
-rw-r--r-- | ardor3d-swt/pom.xml | 306 | ||||
-rw-r--r-- | ardor3d-swt/src/test/java/com/ardor3d/input/swt/TestSwtKeyboardWrapper.java | 234 | ||||
-rw-r--r-- | ardor3d-swt/src/test/java/com/ardor3d/input/swt/TestSwtMouseWrapper.java | 470 |
4 files changed, 618 insertions, 618 deletions
diff --git a/ardor3d-swt/.settings/org.eclipse.jdt.ui.prefs b/ardor3d-swt/.settings/org.eclipse.jdt.ui.prefs index 7588391..2cb0f4c 100644 --- a/ardor3d-swt/.settings/org.eclipse.jdt.ui.prefs +++ b/ardor3d-swt/.settings/org.eclipse.jdt.ui.prefs @@ -1,113 +1,113 @@ -cleanup.add_default_serial_version_id=true
-cleanup.add_generated_serial_version_id=false
-cleanup.add_missing_annotations=true
-cleanup.add_missing_deprecated_annotations=true
-cleanup.add_missing_methods=true
-cleanup.add_missing_nls_tags=false
-cleanup.add_missing_override_annotations=true
-cleanup.add_serial_version_id=true
-cleanup.always_use_blocks=true
-cleanup.always_use_parentheses_in_expressions=true
-cleanup.always_use_this_for_non_static_field_access=false
-cleanup.always_use_this_for_non_static_method_access=false
-cleanup.convert_to_enhanced_for_loop=false
-cleanup.correct_indentation=true
-cleanup.format_source_code=true
-cleanup.format_source_code_changes_only=false
-cleanup.make_local_variable_final=true
-cleanup.make_parameters_final=true
-cleanup.make_private_fields_final=true
-cleanup.make_type_abstract_if_missing_method=false
-cleanup.make_variable_declarations_final=true
-cleanup.never_use_blocks=false
-cleanup.never_use_parentheses_in_expressions=false
-cleanup.organize_imports=true
-cleanup.qualify_static_field_accesses_with_declaring_class=false
-cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-cleanup.qualify_static_member_accesses_with_declaring_class=true
-cleanup.qualify_static_method_accesses_with_declaring_class=false
-cleanup.remove_private_constructors=true
-cleanup.remove_trailing_whitespaces=true
-cleanup.remove_trailing_whitespaces_all=true
-cleanup.remove_trailing_whitespaces_ignore_empty=false
-cleanup.remove_unnecessary_casts=true
-cleanup.remove_unnecessary_nls_tags=true
-cleanup.remove_unused_imports=true
-cleanup.remove_unused_local_variables=false
-cleanup.remove_unused_private_fields=true
-cleanup.remove_unused_private_members=false
-cleanup.remove_unused_private_methods=true
-cleanup.remove_unused_private_types=true
-cleanup.sort_members=false
-cleanup.sort_members_all=false
-cleanup.use_blocks=true
-cleanup.use_blocks_only_for_return_and_throw=false
-cleanup.use_parentheses_in_expressions=false
-cleanup.use_this_for_non_static_field_access=true
-cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-cleanup.use_this_for_non_static_method_access=true
-cleanup.use_this_for_non_static_method_access_only_if_necessary=true
-cleanup_profile=_ArdorLabs
-cleanup_settings_version=2
-eclipse.preferences.version=1
-editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
-formatter_profile=_ArdorLabs
-formatter_settings_version=11
-org.eclipse.jdt.ui.exception.name=ex
-org.eclipse.jdt.ui.gettersetter.use.is=true
-org.eclipse.jdt.ui.javadoc=false
-org.eclipse.jdt.ui.keywordthis=false
-org.eclipse.jdt.ui.overrideannotation=true
-org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/**\r\n * Copyright (c) 2008-2010 Ardor Labs, Inc.\r\n *\r\n * This file is part of Ardor3D.\r\n *\r\n * Ardor3D is free software\: you can redistribute it and/or modify it \r\n * under the terms of its license which may be found in the accompanying\r\n * LICENSE file or at <http\://www.ardor3d.com/LICENSE>.\r\n */\r\n\r\n${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
-sp_cleanup.add_default_serial_version_id=true
-sp_cleanup.add_generated_serial_version_id=false
-sp_cleanup.add_missing_annotations=true
-sp_cleanup.add_missing_deprecated_annotations=true
-sp_cleanup.add_missing_methods=false
-sp_cleanup.add_missing_nls_tags=false
-sp_cleanup.add_missing_override_annotations=true
-sp_cleanup.add_serial_version_id=false
-sp_cleanup.always_use_blocks=true
-sp_cleanup.always_use_parentheses_in_expressions=false
-sp_cleanup.always_use_this_for_non_static_field_access=false
-sp_cleanup.always_use_this_for_non_static_method_access=false
-sp_cleanup.convert_to_enhanced_for_loop=false
-sp_cleanup.correct_indentation=true
-sp_cleanup.format_source_code=true
-sp_cleanup.format_source_code_changes_only=false
-sp_cleanup.make_local_variable_final=true
-sp_cleanup.make_parameters_final=true
-sp_cleanup.make_private_fields_final=true
-sp_cleanup.make_type_abstract_if_missing_method=false
-sp_cleanup.make_variable_declarations_final=true
-sp_cleanup.never_use_blocks=false
-sp_cleanup.never_use_parentheses_in_expressions=true
-sp_cleanup.on_save_use_additional_actions=true
-sp_cleanup.organize_imports=true
-sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_with_declaring_class=true
-sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
-sp_cleanup.remove_private_constructors=true
-sp_cleanup.remove_trailing_whitespaces=true
-sp_cleanup.remove_trailing_whitespaces_all=true
-sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
-sp_cleanup.remove_unnecessary_casts=true
-sp_cleanup.remove_unnecessary_nls_tags=true
-sp_cleanup.remove_unused_imports=true
-sp_cleanup.remove_unused_local_variables=false
-sp_cleanup.remove_unused_private_fields=true
-sp_cleanup.remove_unused_private_members=false
-sp_cleanup.remove_unused_private_methods=true
-sp_cleanup.remove_unused_private_types=true
-sp_cleanup.sort_members=false
-sp_cleanup.sort_members_all=false
-sp_cleanup.use_blocks=true
-sp_cleanup.use_blocks_only_for_return_and_throw=false
-sp_cleanup.use_parentheses_in_expressions=false
-sp_cleanup.use_this_for_non_static_field_access=true
-sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-sp_cleanup.use_this_for_non_static_method_access=true
-sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+cleanup.add_default_serial_version_id=true +cleanup.add_generated_serial_version_id=false +cleanup.add_missing_annotations=true +cleanup.add_missing_deprecated_annotations=true +cleanup.add_missing_methods=true +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=true +cleanup.add_serial_version_id=true +cleanup.always_use_blocks=true +cleanup.always_use_parentheses_in_expressions=true +cleanup.always_use_this_for_non_static_field_access=false +cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_to_enhanced_for_loop=false +cleanup.correct_indentation=true +cleanup.format_source_code=true +cleanup.format_source_code_changes_only=false +cleanup.make_local_variable_final=true +cleanup.make_parameters_final=true +cleanup.make_private_fields_final=true +cleanup.make_type_abstract_if_missing_method=false +cleanup.make_variable_declarations_final=true +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=false +cleanup.organize_imports=true +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.qualify_static_member_accesses_with_declaring_class=true +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_private_constructors=true +cleanup.remove_trailing_whitespaces=true +cleanup.remove_trailing_whitespaces_all=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_casts=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_imports=true +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=true +cleanup.remove_unused_private_members=false +cleanup.remove_unused_private_methods=true +cleanup.remove_unused_private_types=true +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.use_blocks=true +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_parentheses_in_expressions=false +cleanup.use_this_for_non_static_field_access=true +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_method_access=true +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +cleanup_profile=_ArdorLabs +cleanup_settings_version=2 +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_ArdorLabs +formatter_settings_version=11 +org.eclipse.jdt.ui.exception.name=ex +org.eclipse.jdt.ui.gettersetter.use.is=true +org.eclipse.jdt.ui.javadoc=false +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/**\r\n * Copyright (c) 2008-2010 Ardor Labs, Inc.\r\n *\r\n * This file is part of Ardor3D.\r\n *\r\n * Ardor3D is free software\: you can redistribute it and/or modify it \r\n * under the terms of its license which may be found in the accompanying\r\n * LICENSE file or at <http\://www.ardor3d.com/LICENSE>.\r\n */\r\n\r\n${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=true +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=true +sp_cleanup.make_parameters_final=true +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=true +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=true +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=true +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=true +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/ardor3d-swt/pom.xml b/ardor3d-swt/pom.xml index 42bc5de..1252ca3 100644 --- a/ardor3d-swt/pom.xml +++ b/ardor3d-swt/pom.xml @@ -1,153 +1,153 @@ -
-<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/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>com.ardor3d</groupId>
- <artifactId>ardor3d</artifactId>
- <relativePath>../pom.xml</relativePath>
- <version>0.9-SNAPSHOT</version>
- </parent>
-
- <artifactId>ardor3d-swt</artifactId>
- <packaging>bundle</packaging>
- <name>Ardor 3D SWT</name>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.6</source>
- <target>1.6</target>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>ardor3d-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymockclassextension</artifactId>
- </dependency>
- <dependency>
- <groupId>org.eclipse.swt</groupId>
- <artifactId>swt</artifactId>
- <classifier>${swt.classifier}</classifier>
- </dependency>
- </dependencies>
-
-
- <repositories>
- <!-- The current version of swt isn't on central yet. -->
- <repository>
- <id>ardor3d</id>
- <url>http://ardor3d.com:8081/nexus/content/groups/public</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- </repositories>
-
- <profiles>
- <profile>
- <id>linux-x86</id>
- <activation>
- <os>
- <arch>i386</arch>
- <name>linux</name>
- </os>
- </activation>
- <properties>
- <swt.classifier>linux-x86</swt.classifier>
- </properties>
- </profile>
- <profile>
- <id>linux-x86_64</id>
- <activation>
- <os>
- <arch>amd64</arch>
- <name>Linux</name>
- </os>
- </activation>
- <properties>
- <swt.classifier>linux-x86_64</swt.classifier>
- </properties>
- </profile>
- <profile>
- <id>solaris-sparc</id>
- <activation>
- <os>
- <arch>sparc</arch>
- <name>SunOS</name>
- </os>
- </activation>
- <properties>
- <swt.classifier>solaris-sparc</swt.classifier>
- </properties>
- </profile>
- <profile>
- <id>solaris-x86</id>
- <activation>
- <os>
- <arch>x86</arch>
- <name>SunOS</name>
- </os>
- </activation>
- <properties>
- <swt.classifier>solaris-x86</swt.classifier>
- </properties>
- </profile>
- <profile>
- <id>macosx-cocoa-64</id>
- <activation>
- <os>
- <arch>x86_64</arch>
- <family>mac</family>
- </os>
- </activation>
- <properties>
- <swt.classifier>mac-x86_64</swt.classifier>
- </properties>
- </profile>
- <profile>
- <id>macosx-cocoa</id>
- <activation>
- <os>
- <arch>x86</arch>
- <family>mac</family>
- </os>
- </activation>
- <properties>
- <swt.classifier>mac-x86</swt.classifier>
- </properties>
- </profile>
- <profile>
- <id>win32</id>
- <activation>
- <os>
- <arch>x86</arch>
- <family>windows</family>
- </os>
- </activation>
- <properties>
- <swt.classifier>win32-x86</swt.classifier>
- </properties>
- </profile>
- <profile>
- <id>win64</id>
- <activation>
- <os>
- <arch>amd64</arch>
- <family>windows</family>
- </os>
- </activation>
- <properties>
- <swt.classifier>win32-x86_64</swt.classifier>
- </properties>
- </profile>
- </profiles>
-</project>
+ +<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/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.ardor3d</groupId> + <artifactId>ardor3d</artifactId> + <relativePath>../pom.xml</relativePath> + <version>0.9-SNAPSHOT</version> + </parent> + + <artifactId>ardor3d-swt</artifactId> + <packaging>bundle</packaging> + <name>Ardor 3D SWT</name> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.6</source> + <target>1.6</target> + </configuration> + </plugin> + </plugins> + </build> + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>ardor3d-core</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.easymock</groupId> + <artifactId>easymockclassextension</artifactId> + </dependency> + <dependency> + <groupId>org.eclipse.swt</groupId> + <artifactId>swt</artifactId> + <classifier>${swt.classifier}</classifier> + </dependency> + </dependencies> + + + <repositories> + <!-- The current version of swt isn't on central yet. --> + <repository> + <id>ardor3d</id> + <url>http://ardor3d.com:8081/nexus/content/groups/public</url> + <snapshots> + <enabled>false</enabled> + </snapshots> + </repository> + </repositories> + + <profiles> + <profile> + <id>linux-x86</id> + <activation> + <os> + <arch>i386</arch> + <name>linux</name> + </os> + </activation> + <properties> + <swt.classifier>linux-x86</swt.classifier> + </properties> + </profile> + <profile> + <id>linux-x86_64</id> + <activation> + <os> + <arch>amd64</arch> + <name>Linux</name> + </os> + </activation> + <properties> + <swt.classifier>linux-x86_64</swt.classifier> + </properties> + </profile> + <profile> + <id>solaris-sparc</id> + <activation> + <os> + <arch>sparc</arch> + <name>SunOS</name> + </os> + </activation> + <properties> + <swt.classifier>solaris-sparc</swt.classifier> + </properties> + </profile> + <profile> + <id>solaris-x86</id> + <activation> + <os> + <arch>x86</arch> + <name>SunOS</name> + </os> + </activation> + <properties> + <swt.classifier>solaris-x86</swt.classifier> + </properties> + </profile> + <profile> + <id>macosx-cocoa-64</id> + <activation> + <os> + <arch>x86_64</arch> + <family>mac</family> + </os> + </activation> + <properties> + <swt.classifier>mac-x86_64</swt.classifier> + </properties> + </profile> + <profile> + <id>macosx-cocoa</id> + <activation> + <os> + <arch>x86</arch> + <family>mac</family> + </os> + </activation> + <properties> + <swt.classifier>mac-x86</swt.classifier> + </properties> + </profile> + <profile> + <id>win32</id> + <activation> + <os> + <arch>x86</arch> + <family>windows</family> + </os> + </activation> + <properties> + <swt.classifier>win32-x86</swt.classifier> + </properties> + </profile> + <profile> + <id>win64</id> + <activation> + <os> + <arch>amd64</arch> + <family>windows</family> + </os> + </activation> + <properties> + <swt.classifier>win32-x86_64</swt.classifier> + </properties> + </profile> + </profiles> +</project> diff --git a/ardor3d-swt/src/test/java/com/ardor3d/input/swt/TestSwtKeyboardWrapper.java b/ardor3d-swt/src/test/java/com/ardor3d/input/swt/TestSwtKeyboardWrapper.java index 6586584..ec93b17 100644 --- a/ardor3d-swt/src/test/java/com/ardor3d/input/swt/TestSwtKeyboardWrapper.java +++ b/ardor3d-swt/src/test/java/com/ardor3d/input/swt/TestSwtKeyboardWrapper.java @@ -1,117 +1,117 @@ -/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
- *
- * This file is part of Ardor3D.
- *
- * Ardor3D is free software: you can redistribute it and/or modify it
- * under the terms of its license which may be found in the accompanying
- * LICENSE file or at <http://www.ardor3d.com/LICENSE>.
- */
-
-package com.ardor3d.input.swt;
-
-import static org.easymock.classextension.EasyMock.createMock;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-
-import java.util.Iterator;
-
-import org.eclipse.swt.widgets.Event;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.ardor3d.framework.swt.SwtCanvas;
-import com.ardor3d.input.Key;
-import com.ardor3d.input.KeyEvent;
-import com.ardor3d.input.KeyState;
-
-public class TestSwtKeyboardWrapper {
- SwtKeyboardWrapper kw;
-
- SwtCanvas control;
-
- org.eclipse.swt.events.KeyEvent e1, e2;
-
- @Before
- public void setup() throws Exception {
- control = createMock("control", SwtCanvas.class);
-
- kw = new SwtKeyboardWrapper(control);
-
- final Event event = new Event();
- event.widget = control;
-
- e1 = new org.eclipse.swt.events.KeyEvent(event);
- e2 = new org.eclipse.swt.events.KeyEvent(event);
- }
-
- @Test
- public void testKeys1() throws Exception {
-
- e1.keyCode = 'a';
-
- kw.keyPressed(e1);
- kw.keyReleased(e1);
-
- final Iterator<KeyEvent> events = kw.getEvents();
-
- final KeyEvent event1 = events.next();
- final KeyEvent event2 = events.next();
-
- assertFalse("no more", events.hasNext());
- assertFalse("no more", kw.getEvents().hasNext());
-
- assertEquals("key a", Key.A, event1.getKey());
- assertEquals("down", KeyState.DOWN, event1.getState());
-
- assertEquals("key a", Key.A, event2.getKey());
- assertEquals("up", KeyState.UP, event2.getState());
- }
-
- @Test
- public void testKeys2() throws Exception {
- e1.keyCode = 'a';
- e2.keyCode = 'b';
-
- kw.keyPressed(e1);
- kw.keyPressed(e2);
-
- final Iterator<KeyEvent> events = kw.getEvents();
-
- final KeyEvent event1 = events.next();
- final KeyEvent event2 = events.next();
- final KeyEvent event3 = events.next();
-
- assertFalse("no more", events.hasNext());
- assertFalse("no more", kw.getEvents().hasNext());
-
- assertEquals("key a", Key.A, event1.getKey());
- assertEquals("down", KeyState.DOWN, event1.getState());
-
- assertEquals("key a", Key.A, event2.getKey());
- assertEquals("up", KeyState.UP, event2.getState());
-
- assertEquals("key b", Key.B, event3.getKey());
- assertEquals("down", KeyState.DOWN, event3.getState());
- }
-
- @Test
- public void testKeysRepeat() throws Exception {
-
- e1.keyCode = 'a';
-
- kw.keyPressed(e1);
- kw.keyPressed(e1);
-
- final Iterator<KeyEvent> events = kw.getEvents();
-
- final KeyEvent event1 = events.next();
-
- assertFalse("no more", events.hasNext());
- assertFalse("no more", kw.getEvents().hasNext());
-
- assertEquals("key a", Key.A, event1.getKey());
- assertEquals("down", KeyState.DOWN, event1.getState());
- }
-
-}
+/** + * Copyright (c) 2008-2012 Ardor Labs, Inc. + * + * This file is part of Ardor3D. + * + * Ardor3D is free software: you can redistribute it and/or modify it + * under the terms of its license which may be found in the accompanying + * LICENSE file or at <http://www.ardor3d.com/LICENSE>. + */ + +package com.ardor3d.input.swt; + +import static org.easymock.classextension.EasyMock.createMock; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; + +import java.util.Iterator; + +import org.eclipse.swt.widgets.Event; +import org.junit.Before; +import org.junit.Test; + +import com.ardor3d.framework.swt.SwtCanvas; +import com.ardor3d.input.Key; +import com.ardor3d.input.KeyEvent; +import com.ardor3d.input.KeyState; + +public class TestSwtKeyboardWrapper { + SwtKeyboardWrapper kw; + + SwtCanvas control; + + org.eclipse.swt.events.KeyEvent e1, e2; + + @Before + public void setup() throws Exception { + control = createMock("control", SwtCanvas.class); + + kw = new SwtKeyboardWrapper(control); + + final Event event = new Event(); + event.widget = control; + + e1 = new org.eclipse.swt.events.KeyEvent(event); + e2 = new org.eclipse.swt.events.KeyEvent(event); + } + + @Test + public void testKeys1() throws Exception { + + e1.keyCode = 'a'; + + kw.keyPressed(e1); + kw.keyReleased(e1); + + final Iterator<KeyEvent> events = kw.getEvents(); + + final KeyEvent event1 = events.next(); + final KeyEvent event2 = events.next(); + + assertFalse("no more", events.hasNext()); + assertFalse("no more", kw.getEvents().hasNext()); + + assertEquals("key a", Key.A, event1.getKey()); + assertEquals("down", KeyState.DOWN, event1.getState()); + + assertEquals("key a", Key.A, event2.getKey()); + assertEquals("up", KeyState.UP, event2.getState()); + } + + @Test + public void testKeys2() throws Exception { + e1.keyCode = 'a'; + e2.keyCode = 'b'; + + kw.keyPressed(e1); + kw.keyPressed(e2); + + final Iterator<KeyEvent> events = kw.getEvents(); + + final KeyEvent event1 = events.next(); + final KeyEvent event2 = events.next(); + final KeyEvent event3 = events.next(); + + assertFalse("no more", events.hasNext()); + assertFalse("no more", kw.getEvents().hasNext()); + + assertEquals("key a", Key.A, event1.getKey()); + assertEquals("down", KeyState.DOWN, event1.getState()); + + assertEquals("key a", Key.A, event2.getKey()); + assertEquals("up", KeyState.UP, event2.getState()); + + assertEquals("key b", Key.B, event3.getKey()); + assertEquals("down", KeyState.DOWN, event3.getState()); + } + + @Test + public void testKeysRepeat() throws Exception { + + e1.keyCode = 'a'; + + kw.keyPressed(e1); + kw.keyPressed(e1); + + final Iterator<KeyEvent> events = kw.getEvents(); + + final KeyEvent event1 = events.next(); + + assertFalse("no more", events.hasNext()); + assertFalse("no more", kw.getEvents().hasNext()); + + assertEquals("key a", Key.A, event1.getKey()); + assertEquals("down", KeyState.DOWN, event1.getState()); + } + +} diff --git a/ardor3d-swt/src/test/java/com/ardor3d/input/swt/TestSwtMouseWrapper.java b/ardor3d-swt/src/test/java/com/ardor3d/input/swt/TestSwtMouseWrapper.java index 5e2dfeb..9af464d 100644 --- a/ardor3d-swt/src/test/java/com/ardor3d/input/swt/TestSwtMouseWrapper.java +++ b/ardor3d-swt/src/test/java/com/ardor3d/input/swt/TestSwtMouseWrapper.java @@ -1,235 +1,235 @@ -/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
- *
- * This file is part of Ardor3D.
- *
- * Ardor3D is free software: you can redistribute it and/or modify it
- * under the terms of its license which may be found in the accompanying
- * LICENSE file or at <http://www.ardor3d.com/LICENSE>.
- */
-
-package com.ardor3d.input.swt;
-
-import static org.easymock.EasyMock.expect;
-import static org.easymock.classextension.EasyMock.createMock;
-import static org.easymock.classextension.EasyMock.replay;
-import static org.easymock.classextension.EasyMock.verify;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Iterator;
-
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Event;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.ardor3d.framework.swt.SwtCanvas;
-import com.ardor3d.input.ButtonState;
-import com.ardor3d.input.MouseButton;
-import com.ardor3d.input.MouseState;
-
-public class TestSwtMouseWrapper {
- SwtMouseWrapper wrapper;
-
- SwtCanvas control;
-
- MouseEvent e1, e2;
-
- Object[] mocks;
-
- @Before
- public void setup() throws Exception {
- control = createMock("control", SwtCanvas.class);
-
- wrapper = new SwtMouseWrapper(control);
- final Event event = new Event();
- event.widget = control;
-
- e1 = new MouseEvent(event);
- e2 = new MouseEvent(event);
-
- mocks = new Object[] { control };
- }
-
- @After
- public void verifyMocks() throws Exception {
- verify(mocks);
- }
-
- @Test
- public void testMove1() throws Exception {
- control.addMouseListener(wrapper);
- control.addMouseMoveListener(wrapper);
- control.addMouseWheelListener(wrapper);
-
- expect(control.getSize()).andReturn(new Point(100, 100)).atLeastOnce();
-
- replay(mocks);
-
- wrapper.init();
-
- setXY(e1, 2, 0);
-
- wrapper.mouseMove(e1);
-
- MouseState state = wrapper.getEvents().next();
-
- assertFalse("no more events", wrapper.getEvents().hasNext());
-
- assertEquals("x", 2, state.getX());
- assertEquals("dx", 0, state.getDx());
- assertEquals("y", 100, state.getY());
- assertEquals("dy", 0, state.getDy());
-
- for (final ButtonState bs : state.getButtonStates().values()) {
- assertEquals("up", ButtonState.UP, bs);
- }
-
- setXY(e1, 4, 0);
-
- wrapper.mouseMove(e1);
-
- state = wrapper.getEvents().next();
-
- assertFalse("no more events", wrapper.getEvents().hasNext());
-
- assertEquals("x", 4, state.getX());
- assertEquals("dx", 2, state.getDx());
- assertEquals("y", 100, state.getY());
- assertEquals("dy", 0, state.getDy());
-
- for (final ButtonState bs : state.getButtonStates().values()) {
- assertEquals("up", ButtonState.UP, bs);
- }
-
- setXY(e1, 2, 4);
-
- wrapper.mouseMove(e1);
-
- state = wrapper.getEvents().next();
-
- assertFalse("no more events", wrapper.getEvents().hasNext());
-
- assertEquals("x", 2, state.getX());
- assertEquals("dx", -2, state.getDx());
- assertEquals("y", 96, state.getY());
- assertEquals("dy", -4, state.getDy());
-
- for (final ButtonState bs : state.getButtonStates().values()) {
- assertEquals("up", ButtonState.UP, bs);
- }
- }
-
- @Test
- public void testButtons() throws Exception {
- control.addMouseListener(wrapper);
- control.addMouseMoveListener(wrapper);
- control.addMouseWheelListener(wrapper);
-
- expect(control.getSize()).andReturn(new Point(100, 100)).atLeastOnce();
-
- replay(mocks);
-
- wrapper.init();
-
- // mouse down, then drag
- setWithButtons(e1, 0, 0, 1);
- wrapper.mouseDown(e1);
-
- setXY(e2, 2, 4);
- wrapper.mouseMove(e2);
-
- final Iterator<MouseState> events = wrapper.getEvents();
-
- MouseState s1 = events.next();
- final MouseState s2 = events.next();
-
- assertFalse("more events", events.hasNext());
- assertFalse("more events", wrapper.getEvents().hasNext());
-
- assertEquals("x", 0, s1.getX());
- assertEquals("dx", 0, s1.getDx());
- assertEquals("y", 100, s1.getY());
- assertEquals("dy", 0, s1.getDy());
- assertTrue("left down", s1.getButtonState(MouseButton.LEFT) == ButtonState.DOWN);
- assertFalse("right down", s1.getButtonState(MouseButton.RIGHT) == ButtonState.DOWN);
-
- assertEquals("x", 2, s2.getX());
- assertEquals("dx", 2, s2.getDx());
- assertEquals("y", 96, s2.getY());
- assertEquals("dy", -4, s2.getDy());
- assertTrue("left down", s2.getButtonState(MouseButton.LEFT) == ButtonState.DOWN);
- assertFalse("right down", s2.getButtonState(MouseButton.RIGHT) == ButtonState.DOWN);
-
- // press right button
- setWithButtons(e1, 2, 4, 3);
- wrapper.mouseDown(e1);
-
- s1 = wrapper.getEvents().next();
-
- assertFalse("more events", wrapper.getEvents().hasNext());
-
- assertEquals("x", 2, s1.getX());
- assertEquals("dx", 0, s1.getDx());
- assertEquals("y", 96, s1.getY());
- assertEquals("dy", 0, s1.getDy());
- assertTrue("left down", s1.getButtonState(MouseButton.LEFT) == ButtonState.DOWN);
- assertTrue("right down", s1.getButtonState(MouseButton.RIGHT) == ButtonState.DOWN);
-
- // release left button
- setWithButtons(e1, 3, 5, 1);
- wrapper.mouseUp(e1);
-
- s1 = wrapper.getEvents().next();
-
- // Because we moved the mouse, there should not be a click count for the left button release...
- assertTrue("clicked", s1.getClickCount(MouseButton.LEFT) == 0);
-
- assertFalse("more events", wrapper.getEvents().hasNext());
-
- assertEquals("x", 3, s1.getX());
- assertEquals("dx", 1, s1.getDx());
- assertEquals("y", 95, s1.getY());
- assertEquals("dy", -1, s1.getDy());
- assertFalse("left down", s1.getButtonState(MouseButton.LEFT) == ButtonState.DOWN);
- assertTrue("right down", s1.getButtonState(MouseButton.RIGHT) == ButtonState.DOWN);
-
- // release right button
- setWithButtons(e1, 3, 5, 3);
- wrapper.mouseUp(e1);
-
- // We expect two state, one with a clickcount of 1,
- s1 = wrapper.getEvents().next();
-
- assertTrue("clicked", s1.getClickCount(MouseButton.RIGHT) == 1);
-
- // and then the same state, but with clickcount of 0
- s1 = wrapper.getEvents().next();
-
- assertFalse("more events", wrapper.getEvents().hasNext());
-
- assertEquals("x", 3, s1.getX());
- assertEquals("dx", 0, s1.getDx());
- assertEquals("y", 95, s1.getY());
- assertEquals("dy", 0, s1.getDy());
- assertFalse("left down", s1.getButtonState(MouseButton.LEFT) == ButtonState.DOWN);
- assertFalse("right down", s1.getButtonState(MouseButton.RIGHT) == ButtonState.DOWN);
-
- }
-
- private void setWithButtons(final MouseEvent event, final int x, final int y, final int button) {
- event.x = x;
- event.y = y;
- event.button = button;
- }
-
- private void setXY(final MouseEvent event, final int x, final int y) {
- event.x = x;
- event.y = y;
- }
-
-}
+/** + * Copyright (c) 2008-2012 Ardor Labs, Inc. + * + * This file is part of Ardor3D. + * + * Ardor3D is free software: you can redistribute it and/or modify it + * under the terms of its license which may be found in the accompanying + * LICENSE file or at <http://www.ardor3d.com/LICENSE>. + */ + +package com.ardor3d.input.swt; + +import static org.easymock.EasyMock.expect; +import static org.easymock.classextension.EasyMock.createMock; +import static org.easymock.classextension.EasyMock.replay; +import static org.easymock.classextension.EasyMock.verify; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.util.Iterator; + +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.widgets.Event; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import com.ardor3d.framework.swt.SwtCanvas; +import com.ardor3d.input.ButtonState; +import com.ardor3d.input.MouseButton; +import com.ardor3d.input.MouseState; + +public class TestSwtMouseWrapper { + SwtMouseWrapper wrapper; + + SwtCanvas control; + + MouseEvent e1, e2; + + Object[] mocks; + + @Before + public void setup() throws Exception { + control = createMock("control", SwtCanvas.class); + + wrapper = new SwtMouseWrapper(control); + final Event event = new Event(); + event.widget = control; + + e1 = new MouseEvent(event); + e2 = new MouseEvent(event); + + mocks = new Object[] { control }; + } + + @After + public void verifyMocks() throws Exception { + verify(mocks); + } + + @Test + public void testMove1() throws Exception { + control.addMouseListener(wrapper); + control.addMouseMoveListener(wrapper); + control.addMouseWheelListener(wrapper); + + expect(control.getSize()).andReturn(new Point(100, 100)).atLeastOnce(); + + replay(mocks); + + wrapper.init(); + + setXY(e1, 2, 0); + + wrapper.mouseMove(e1); + + MouseState state = wrapper.getEvents().next(); + + assertFalse("no more events", wrapper.getEvents().hasNext()); + + assertEquals("x", 2, state.getX()); + assertEquals("dx", 0, state.getDx()); + assertEquals("y", 100, state.getY()); + assertEquals("dy", 0, state.getDy()); + + for (final ButtonState bs : state.getButtonStates().values()) { + assertEquals("up", ButtonState.UP, bs); + } + + setXY(e1, 4, 0); + + wrapper.mouseMove(e1); + + state = wrapper.getEvents().next(); + + assertFalse("no more events", wrapper.getEvents().hasNext()); + + assertEquals("x", 4, state.getX()); + assertEquals("dx", 2, state.getDx()); + assertEquals("y", 100, state.getY()); + assertEquals("dy", 0, state.getDy()); + + for (final ButtonState bs : state.getButtonStates().values()) { + assertEquals("up", ButtonState.UP, bs); + } + + setXY(e1, 2, 4); + + wrapper.mouseMove(e1); + + state = wrapper.getEvents().next(); + + assertFalse("no more events", wrapper.getEvents().hasNext()); + + assertEquals("x", 2, state.getX()); + assertEquals("dx", -2, state.getDx()); + assertEquals("y", 96, state.getY()); + assertEquals("dy", -4, state.getDy()); + + for (final ButtonState bs : state.getButtonStates().values()) { + assertEquals("up", ButtonState.UP, bs); + } + } + + @Test + public void testButtons() throws Exception { + control.addMouseListener(wrapper); + control.addMouseMoveListener(wrapper); + control.addMouseWheelListener(wrapper); + + expect(control.getSize()).andReturn(new Point(100, 100)).atLeastOnce(); + + replay(mocks); + + wrapper.init(); + + // mouse down, then drag + setWithButtons(e1, 0, 0, 1); + wrapper.mouseDown(e1); + + setXY(e2, 2, 4); + wrapper.mouseMove(e2); + + final Iterator<MouseState> events = wrapper.getEvents(); + + MouseState s1 = events.next(); + final MouseState s2 = events.next(); + + assertFalse("more events", events.hasNext()); + assertFalse("more events", wrapper.getEvents().hasNext()); + + assertEquals("x", 0, s1.getX()); + assertEquals("dx", 0, s1.getDx()); + assertEquals("y", 100, s1.getY()); + assertEquals("dy", 0, s1.getDy()); + assertTrue("left down", s1.getButtonState(MouseButton.LEFT) == ButtonState.DOWN); + assertFalse("right down", s1.getButtonState(MouseButton.RIGHT) == ButtonState.DOWN); + + assertEquals("x", 2, s2.getX()); + assertEquals("dx", 2, s2.getDx()); + assertEquals("y", 96, s2.getY()); + assertEquals("dy", -4, s2.getDy()); + assertTrue("left down", s2.getButtonState(MouseButton.LEFT) == ButtonState.DOWN); + assertFalse("right down", s2.getButtonState(MouseButton.RIGHT) == ButtonState.DOWN); + + // press right button + setWithButtons(e1, 2, 4, 3); + wrapper.mouseDown(e1); + + s1 = wrapper.getEvents().next(); + + assertFalse("more events", wrapper.getEvents().hasNext()); + + assertEquals("x", 2, s1.getX()); + assertEquals("dx", 0, s1.getDx()); + assertEquals("y", 96, s1.getY()); + assertEquals("dy", 0, s1.getDy()); + assertTrue("left down", s1.getButtonState(MouseButton.LEFT) == ButtonState.DOWN); + assertTrue("right down", s1.getButtonState(MouseButton.RIGHT) == ButtonState.DOWN); + + // release left button + setWithButtons(e1, 3, 5, 1); + wrapper.mouseUp(e1); + + s1 = wrapper.getEvents().next(); + + // Because we moved the mouse, there should not be a click count for the left button release... + assertTrue("clicked", s1.getClickCount(MouseButton.LEFT) == 0); + + assertFalse("more events", wrapper.getEvents().hasNext()); + + assertEquals("x", 3, s1.getX()); + assertEquals("dx", 1, s1.getDx()); + assertEquals("y", 95, s1.getY()); + assertEquals("dy", -1, s1.getDy()); + assertFalse("left down", s1.getButtonState(MouseButton.LEFT) == ButtonState.DOWN); + assertTrue("right down", s1.getButtonState(MouseButton.RIGHT) == ButtonState.DOWN); + + // release right button + setWithButtons(e1, 3, 5, 3); + wrapper.mouseUp(e1); + + // We expect two state, one with a clickcount of 1, + s1 = wrapper.getEvents().next(); + + assertTrue("clicked", s1.getClickCount(MouseButton.RIGHT) == 1); + + // and then the same state, but with clickcount of 0 + s1 = wrapper.getEvents().next(); + + assertFalse("more events", wrapper.getEvents().hasNext()); + + assertEquals("x", 3, s1.getX()); + assertEquals("dx", 0, s1.getDx()); + assertEquals("y", 95, s1.getY()); + assertEquals("dy", 0, s1.getDy()); + assertFalse("left down", s1.getButtonState(MouseButton.LEFT) == ButtonState.DOWN); + assertFalse("right down", s1.getButtonState(MouseButton.RIGHT) == ButtonState.DOWN); + + } + + private void setWithButtons(final MouseEvent event, final int x, final int y, final int button) { + event.x = x; + event.y = y; + event.button = button; + } + + private void setXY(final MouseEvent event, final int x, final int y) { + event.x = x; + event.y = y; + } + +} |