cutedriver-driver 2.0.0.20210120164037
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
 - data/README.md +16 -0
 - data/bin/start_app_perf +200 -0
 - data/bin/tdriver-devtools +3 -0
 - data/config/sut_parameters.rb +52 -0
 - data/config/sut_setup.rb +32 -0
 - data/config/sut_teardown.rb +32 -0
 - data/config/tdriver_custom_error_recovery.rb +83 -0
 - data/ext/extconf.rb +70 -0
 - data/ext/native_extensions.c +315 -0
 - data/lib/matti.rb +25 -0
 - data/lib/tdriver-devtools/behaviour/old/xml/example/flick-example.rb +120 -0
 - data/lib/tdriver-devtools/behaviour/old/xml/example/impl.rb_invalid +194 -0
 - data/lib/tdriver-devtools/behaviour/old/xml/generate_behaviour_xml.rb +95 -0
 - data/lib/tdriver-devtools/behaviour/old/xml/lib/tdriver_generator.rb +722 -0
 - data/lib/tdriver-devtools/behaviour/old/xml/qdoc_generator.rb +321 -0
 - data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.method.template +43 -0
 - data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.module.template +54 -0
 - data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.argument.template +7 -0
 - data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.argument_type.template +7 -0
 - data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.exception.template +5 -0
 - data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.howto.line.template +2 -0
 - data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.howto.template +5 -0
 - data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.method.template +23 -0
 - data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.template +14 -0
 - data/lib/tdriver-devtools/behaviour/old/xml/update +3 -0
 - data/lib/tdriver-devtools/behaviour/xml/generate.rb +88 -0
 - data/lib/tdriver-devtools/behaviour/xml/rdoc_behaviour_xml_generator.rb +1945 -0
 - data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.argument.default.template +1 -0
 - data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.argument.template +3 -0
 - data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.argument_type.template +4 -0
 - data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.exception.template +4 -0
 - data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.arguments.template +4 -0
 - data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.deprecated.template +3 -0
 - data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.exceptions.template +3 -0
 - data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.info.template +1 -0
 - data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.returns.template +3 -0
 - data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.tables.template +3 -0
 - data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.template +12 -0
 - data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.returns.template +5 -0
 - data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.table.item.template +1 -0
 - data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.table.row.template +2 -0
 - data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.table.template +8 -0
 - data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.template +14 -0
 - data/lib/tdriver-devtools/doc/behaviour_xml/QtExampleGestureBehaviour.xml +138 -0
 - data/lib/tdriver-devtools/doc/behaviour_xml/created.rid +1 -0
 - data/lib/tdriver-devtools/doc/behaviour_xml/tdriver.hash +1 -0
 - data/lib/tdriver-devtools/doc/feature_xml/qt_widget_hold.feature.xml +9 -0
 - data/lib/tdriver-devtools/doc/feature_xml/qt_widget_tap.feature.xml +9 -0
 - data/lib/tdriver-devtools/doc/generate.rb +917 -0
 - data/lib/tdriver-devtools/doc/update +1 -0
 - data/lib/tdriver-devtools/doc/xslt/html.rb +7 -0
 - data/lib/tdriver-devtools/doc/xslt/template.xsl +2170 -0
 - data/lib/tdriver-devtools/doc/xslt/update +3 -0
 - data/lib/tdriver-devtools/plugin/placeholder.txt +1 -0
 - data/lib/tdriver-devtools/tdriver-devtools.rb +404 -0
 - data/lib/tdriver-devtools/tests/feature_tests/example/behaviour_example.rb +100 -0
 - data/lib/tdriver-devtools/tests/feature_tests/generate.rb +82 -0
 - data/lib/tdriver-devtools/tests/feature_tests/lib/custom_rdoc_generator.rb +468 -0
 - data/lib/tdriver-devtools/tests/feature_tests/templates/feature_attribute.template +5 -0
 - data/lib/tdriver-devtools/tests/feature_tests/templates/feature_method.template +5 -0
 - data/lib/tdriver-devtools/tests/feature_tests/templates/scenario_attribute.template +5 -0
 - data/lib/tdriver-devtools/tests/feature_tests/templates/scenario_method.template +5 -0
 - data/lib/tdriver-devtools/tests/feature_tests/update +3 -0
 - data/lib/tdriver.rb +23 -0
 - data/lib/tdriver/base/behaviour/abstract.rb +29 -0
 - data/lib/tdriver/base/behaviour/behaviours/object_abstract.rb +107 -0
 - data/lib/tdriver/base/behaviour/behaviours/object_behaviour_composition.rb +99 -0
 - data/lib/tdriver/base/behaviour/behaviours/object_behaviour_description.rb +278 -0
 - data/lib/tdriver/base/behaviour/behaviours/object_composition.rb +119 -0
 - data/lib/tdriver/base/behaviour/factory.rb +495 -0
 - data/lib/tdriver/base/behaviour/loader.rb +46 -0
 - data/lib/tdriver/base/command_data/command_data.rb +51 -0
 - data/lib/tdriver/base/command_data/loader.rb +29 -0
 - data/lib/tdriver/base/controller/abstraction.rb +56 -0
 - data/lib/tdriver/base/controller/loader.rb +21 -0
 - data/lib/tdriver/base/errors.rb +134 -0
 - data/lib/tdriver/base/loader.rb +47 -0
 - data/lib/tdriver/base/state_object.rb +373 -0
 - data/lib/tdriver/base/sut/adapter.rb +54 -0
 - data/lib/tdriver/base/sut/controller.rb +151 -0
 - data/lib/tdriver/base/sut/factory.rb +339 -0
 - data/lib/tdriver/base/sut/generic/behaviours/agent.rb +77 -0
 - data/lib/tdriver/base/sut/generic/behaviours/application.rb +427 -0
 - data/lib/tdriver/base/sut/generic/behaviours/controller.rb +67 -0
 - data/lib/tdriver/base/sut/generic/behaviours/find.rb +107 -0
 - data/lib/tdriver/base/sut/generic/behaviours/flash_behaviour.rb +337 -0
 - data/lib/tdriver/base/sut/generic/behaviours/sut.rb +1888 -0
 - data/lib/tdriver/base/sut/generic/behaviours/switchbox_behaviour.rb +210 -0
 - data/lib/tdriver/base/sut/generic/behaviours/verification.rb +222 -0
 - data/lib/tdriver/base/sut/generic/commands/agent.rb +43 -0
 - data/lib/tdriver/base/sut/generic/commands/application.rb +274 -0
 - data/lib/tdriver/base/sut/generic/commands/fixture.rb +47 -0
 - data/lib/tdriver/base/sut/generic/commands/key_sequence.rb +94 -0
 - data/lib/tdriver/base/sut/generic/commands/screen_capture.rb +64 -0
 - data/lib/tdriver/base/sut/generic/plugin.rb +97 -0
 - data/lib/tdriver/base/sut/loader.rb +35 -0
 - data/lib/tdriver/base/sut/sut.rb +98 -0
 - data/lib/tdriver/base/test_object/abstract.rb +208 -0
 - data/lib/tdriver/base/test_object/adapter.rb +740 -0
 - data/lib/tdriver/base/test_object/behaviours/syncronization.rb +144 -0
 - data/lib/tdriver/base/test_object/behaviours/test_object.rb +1047 -0
 - data/lib/tdriver/base/test_object/cache.rb +134 -0
 - data/lib/tdriver/base/test_object/factory.rb +684 -0
 - data/lib/tdriver/base/test_object/loader.rb +51 -0
 - data/lib/tdriver/base/test_object/verification.rb +178 -0
 - data/lib/tdriver/base/test_object/xml/abstraction.rb +63 -0
 - data/lib/tdriver/base/test_object/xml/adapter.rb +773 -0
 - data/lib/tdriver/env.rb +21 -0
 - data/lib/tdriver/loader.rb +57 -0
 - data/lib/tdriver/matti.rb +35 -0
 - data/lib/tdriver/report/error_recovery/tdriver_custom_error_recovery.rb +83 -0
 - data/lib/tdriver/report/error_recovery/tdriver_error_recovery.rb +168 -0
 - data/lib/tdriver/report/error_recovery/tdriver_error_recovery_settings.rb +106 -0
 - data/lib/tdriver/report/report.rb +61 -0
 - data/lib/tdriver/report/report_api.rb +348 -0
 - data/lib/tdriver/report/report_combine.rb +86 -0
 - data/lib/tdriver/report/report_crash_file_capture.rb +178 -0
 - data/lib/tdriver/report/report_creator.rb +665 -0
 - data/lib/tdriver/report/report_cucumber.rb +158 -0
 - data/lib/tdriver/report/report_cucumber_listener.rb +184 -0
 - data/lib/tdriver/report/report_cucumber_reporter.rb +181 -0
 - data/lib/tdriver/report/report_data_presentation.rb +156 -0
 - data/lib/tdriver/report/report_data_table.rb +64 -0
 - data/lib/tdriver/report/report_execution_statistics.rb +400 -0
 - data/lib/tdriver/report/report_file_capture.rb +159 -0
 - data/lib/tdriver/report/report_graph_generator.rb +59 -0
 - data/lib/tdriver/report/report_grouping.rb +541 -0
 - data/lib/tdriver/report/report_javascript.rb +199 -0
 - data/lib/tdriver/report/report_junit_xml.rb +147 -0
 - data/lib/tdriver/report/report_rspec.rb +108 -0
 - data/lib/tdriver/report/report_test_case_run.rb +725 -0
 - data/lib/tdriver/report/report_test_run.rb +1476 -0
 - data/lib/tdriver/report/report_test_unit.rb +223 -0
 - data/lib/tdriver/report/report_writer.rb +1621 -0
 - data/lib/tdriver/tdriver.rb +209 -0
 - data/lib/tdriver/util/agent/loader.rb +22 -0
 - data/lib/tdriver/util/agent/service.rb +107 -0
 - data/lib/tdriver/util/common/array.rb +39 -0
 - data/lib/tdriver/util/common/boolean.rb +48 -0
 - data/lib/tdriver/util/common/crc16.rb +149 -0
 - data/lib/tdriver/util/common/environment.rb +154 -0
 - data/lib/tdriver/util/common/error.rb +40 -0
 - data/lib/tdriver/util/common/exception.rb +53 -0
 - data/lib/tdriver/util/common/exceptions.rb +12 -0
 - data/lib/tdriver/util/common/file.rb +328 -0
 - data/lib/tdriver/util/common/gem.rb +109 -0
 - data/lib/tdriver/util/common/hash.rb +288 -0
 - data/lib/tdriver/util/common/kernel.rb +253 -0
 - data/lib/tdriver/util/common/loader.rb +47 -0
 - data/lib/tdriver/util/common/numeric.rb +159 -0
 - data/lib/tdriver/util/common/object.rb +159 -0
 - data/lib/tdriver/util/common/retryable.rb +179 -0
 - data/lib/tdriver/util/common/stackable.rb +185 -0
 - data/lib/tdriver/util/common/string.rb +174 -0
 - data/lib/tdriver/util/database/access.rb +240 -0
 - data/lib/tdriver/util/database/connection.rb +44 -0
 - data/lib/tdriver/util/database/error.rb +34 -0
 - data/lib/tdriver/util/database/loader.rb +28 -0
 - data/lib/tdriver/util/filters/attribute_filter.rb +121 -0
 - data/lib/tdriver/util/filters/loader.rb +29 -0
 - data/lib/tdriver/util/fixture/loader.rb +22 -0
 - data/lib/tdriver/util/fixture/service.rb +211 -0
 - data/lib/tdriver/util/hooking/hooking.rb +477 -0
 - data/lib/tdriver/util/keymap/keymap.rb +81 -0
 - data/lib/tdriver/util/loader.rb +80 -0
 - data/lib/tdriver/util/localisation/error.rb +31 -0
 - data/lib/tdriver/util/localisation/loader.rb +25 -0
 - data/lib/tdriver/util/localisation/localisation.rb +762 -0
 - data/lib/tdriver/util/logger/loader.rb +22 -0
 - data/lib/tdriver/util/logger/logger.rb +591 -0
 - data/lib/tdriver/util/operator_data/error.rb +29 -0
 - data/lib/tdriver/util/operator_data/loader.rb +27 -0
 - data/lib/tdriver/util/operator_data/operator_data.rb +93 -0
 - data/lib/tdriver/util/other/config.rb +221 -0
 - data/lib/tdriver/util/parameter/error.rb +48 -0
 - data/lib/tdriver/util/parameter/loader.rb +25 -0
 - data/lib/tdriver/util/parameter/parameter.rb +1161 -0
 - data/lib/tdriver/util/plugin/abstract.rb +61 -0
 - data/lib/tdriver/util/plugin/error.rb +0 -0
 - data/lib/tdriver/util/plugin/loader.rb +28 -0
 - data/lib/tdriver/util/plugin/service.rb +319 -0
 - data/lib/tdriver/util/recorder/loader.rb +25 -0
 - data/lib/tdriver/util/recorder/recorder.rb +72 -0
 - data/lib/tdriver/util/recorder/scripter.rb +294 -0
 - data/lib/tdriver/util/statistics/statistics.rb +89 -0
 - data/lib/tdriver/util/user_data/error.rb +28 -0
 - data/lib/tdriver/util/user_data/loader.rb +25 -0
 - data/lib/tdriver/util/user_data/user_data.rb +104 -0
 - data/lib/tdriver/util/video/camera.rb +67 -0
 - data/lib/tdriver/util/video/camera_linux.rb +153 -0
 - data/lib/tdriver/util/video/camera_windows.rb +174 -0
 - data/lib/tdriver/util/video/loader.rb +31 -0
 - data/lib/tdriver/util/video/video_utils.rb +139 -0
 - data/lib/tdriver/util/xml/abstraction.rb +117 -0
 - data/lib/tdriver/util/xml/attribute.rb +32 -0
 - data/lib/tdriver/util/xml/builder.rb +53 -0
 - data/lib/tdriver/util/xml/comment.rb +32 -0
 - data/lib/tdriver/util/xml/document.rb +32 -0
 - data/lib/tdriver/util/xml/element.rb +32 -0
 - data/lib/tdriver/util/xml/error.rb +46 -0
 - data/lib/tdriver/util/xml/loader.rb +62 -0
 - data/lib/tdriver/util/xml/nil_node.rb +95 -0
 - data/lib/tdriver/util/xml/nodeset.rb +32 -0
 - data/lib/tdriver/util/xml/parsers/libxml/libxml.rb +140 -0
 - data/lib/tdriver/util/xml/parsers/loader.rb +21 -0
 - data/lib/tdriver/util/xml/parsers/nokogiri/abstraction.rb +167 -0
 - data/lib/tdriver/util/xml/parsers/nokogiri/attribute.rb +66 -0
 - data/lib/tdriver/util/xml/parsers/nokogiri/builder.rb +64 -0
 - data/lib/tdriver/util/xml/parsers/nokogiri/comment.rb +39 -0
 - data/lib/tdriver/util/xml/parsers/nokogiri/document.rb +66 -0
 - data/lib/tdriver/util/xml/parsers/nokogiri/element.rb +39 -0
 - data/lib/tdriver/util/xml/parsers/nokogiri/loader.rb +58 -0
 - data/lib/tdriver/util/xml/parsers/nokogiri/node.rb +212 -0
 - data/lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb +237 -0
 - data/lib/tdriver/util/xml/parsers/nokogiri/text.rb +39 -0
 - data/lib/tdriver/util/xml/text.rb +32 -0
 - data/lib/tdriver/util/xml/xml.rb +332 -0
 - data/lib/tdriver/verify/verify.rb +2398 -0
 - data/lib/tdriver/version.rb +21 -0
 - data/xml/behaviours/generic.xml +530 -0
 - data/xml/defaults/generic.xml +11 -0
 - data/xml/defaults/sut_generic.xml +8 -0
 - data/xml/parameters/tdriver_parameters.xml +23 -0
 - data/xml/templates/generic.xml +292 -0
 - metadata +324 -0
 
| 
         @@ -0,0 +1,315 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            /*
         
     | 
| 
      
 2 
     | 
    
         
            +
            ############################################################################
         
     | 
| 
      
 3 
     | 
    
         
            +
            ## 
         
     | 
| 
      
 4 
     | 
    
         
            +
            ## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 
         
     | 
| 
      
 5 
     | 
    
         
            +
            ## All rights reserved. 
         
     | 
| 
      
 6 
     | 
    
         
            +
            ## Contact: Nokia Corporation (testabilitydriver@nokia.com) 
         
     | 
| 
      
 7 
     | 
    
         
            +
            ## 
         
     | 
| 
      
 8 
     | 
    
         
            +
            ## This file is part of Testability Driver. 
         
     | 
| 
      
 9 
     | 
    
         
            +
            ## 
         
     | 
| 
      
 10 
     | 
    
         
            +
            ## If you have questions regarding the use of this file, please contact 
         
     | 
| 
      
 11 
     | 
    
         
            +
            ## Nokia at testabilitydriver@nokia.com . 
         
     | 
| 
      
 12 
     | 
    
         
            +
            ## 
         
     | 
| 
      
 13 
     | 
    
         
            +
            ## This library is free software; you can redistribute it and/or 
         
     | 
| 
      
 14 
     | 
    
         
            +
            ## modify it under the terms of the GNU Lesser General Public 
         
     | 
| 
      
 15 
     | 
    
         
            +
            ## License version 2.1 as published by the Free Software Foundation 
         
     | 
| 
      
 16 
     | 
    
         
            +
            ## and appearing in the file LICENSE.LGPL included in the packaging 
         
     | 
| 
      
 17 
     | 
    
         
            +
            ## of this file. 
         
     | 
| 
      
 18 
     | 
    
         
            +
            ## 
         
     | 
| 
      
 19 
     | 
    
         
            +
            ############################################################################
         
     | 
| 
      
 20 
     | 
    
         
            +
            */
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            #include "ruby.h"
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
            static const CCITT_16[ 256 ] = {
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
              0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7,
         
     | 
| 
      
 27 
     | 
    
         
            +
              0x8108, 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF,
         
     | 
| 
      
 28 
     | 
    
         
            +
              0x1231, 0x0210, 0x3273, 0x2252, 0x52B5, 0x4294, 0x72F7, 0x62D6,
         
     | 
| 
      
 29 
     | 
    
         
            +
              0x9339, 0x8318, 0xB37B, 0xA35A, 0xD3BD, 0xC39C, 0xF3FF, 0xE3DE,
         
     | 
| 
      
 30 
     | 
    
         
            +
              0x2462, 0x3443, 0x0420, 0x1401, 0x64E6, 0x74C7, 0x44A4, 0x5485,
         
     | 
| 
      
 31 
     | 
    
         
            +
              0xA56A, 0xB54B, 0x8528, 0x9509, 0xE5EE, 0xF5CF, 0xC5AC, 0xD58D,
         
     | 
| 
      
 32 
     | 
    
         
            +
              0x3653, 0x2672, 0x1611, 0x0630, 0x76D7, 0x66F6, 0x5695, 0x46B4,
         
     | 
| 
      
 33 
     | 
    
         
            +
              0xB75B, 0xA77A, 0x9719, 0x8738, 0xF7DF, 0xE7FE, 0xD79D, 0xC7BC,
         
     | 
| 
      
 34 
     | 
    
         
            +
              0x48C4, 0x58E5, 0x6886, 0x78A7, 0x0840, 0x1861, 0x2802, 0x3823,
         
     | 
| 
      
 35 
     | 
    
         
            +
              0xC9CC, 0xD9ED, 0xE98E, 0xF9AF, 0x8948, 0x9969, 0xA90A, 0xB92B,
         
     | 
| 
      
 36 
     | 
    
         
            +
              0x5AF5, 0x4AD4, 0x7AB7, 0x6A96, 0x1A71, 0x0A50, 0x3A33, 0x2A12,
         
     | 
| 
      
 37 
     | 
    
         
            +
              0xDBFD, 0xCBDC, 0xFBBF, 0xEB9E, 0x9B79, 0x8B58, 0xBB3B, 0xAB1A,
         
     | 
| 
      
 38 
     | 
    
         
            +
              0x6CA6, 0x7C87, 0x4CE4, 0x5CC5, 0x2C22, 0x3C03, 0x0C60, 0x1C41,
         
     | 
| 
      
 39 
     | 
    
         
            +
              0xEDAE, 0xFD8F, 0xCDEC, 0xDDCD, 0xAD2A, 0xBD0B, 0x8D68, 0x9D49,
         
     | 
| 
      
 40 
     | 
    
         
            +
              0x7E97, 0x6EB6, 0x5ED5, 0x4EF4, 0x3E13, 0x2E32, 0x1E51, 0x0E70,
         
     | 
| 
      
 41 
     | 
    
         
            +
              0xFF9F, 0xEFBE, 0xDFDD, 0xCFFC, 0xBF1B, 0xAF3A, 0x9F59, 0x8F78,
         
     | 
| 
      
 42 
     | 
    
         
            +
              0x9188, 0x81A9, 0xB1CA, 0xA1EB, 0xD10C, 0xC12D, 0xF14E, 0xE16F,
         
     | 
| 
      
 43 
     | 
    
         
            +
              0x1080, 0x00A1, 0x30C2, 0x20E3, 0x5004, 0x4025, 0x7046, 0x6067,
         
     | 
| 
      
 44 
     | 
    
         
            +
              0x83B9, 0x9398, 0xA3FB, 0xB3DA, 0xC33D, 0xD31C, 0xE37F, 0xF35E,
         
     | 
| 
      
 45 
     | 
    
         
            +
              0x02B1, 0x1290, 0x22F3, 0x32D2, 0x4235, 0x5214, 0x6277, 0x7256,
         
     | 
| 
      
 46 
     | 
    
         
            +
              0xB5EA, 0xA5CB, 0x95A8, 0x8589, 0xF56E, 0xE54F, 0xD52C, 0xC50D,
         
     | 
| 
      
 47 
     | 
    
         
            +
              0x34E2, 0x24C3, 0x14A0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
         
     | 
| 
      
 48 
     | 
    
         
            +
              0xA7DB, 0xB7FA, 0x8799, 0x97B8, 0xE75F, 0xF77E, 0xC71D, 0xD73C,
         
     | 
| 
      
 49 
     | 
    
         
            +
              0x26D3, 0x36F2, 0x0691, 0x16B0, 0x6657, 0x7676, 0x4615, 0x5634,
         
     | 
| 
      
 50 
     | 
    
         
            +
              0xD94C, 0xC96D, 0xF90E, 0xE92F, 0x99C8, 0x89E9, 0xB98A, 0xA9AB,
         
     | 
| 
      
 51 
     | 
    
         
            +
              0x5844, 0x4865, 0x7806, 0x6827, 0x18C0, 0x08E1, 0x3882, 0x28A3,
         
     | 
| 
      
 52 
     | 
    
         
            +
              0xCB7D, 0xDB5C, 0xEB3F, 0xFB1E, 0x8BF9, 0x9BD8, 0xABBB, 0xBB9A,
         
     | 
| 
      
 53 
     | 
    
         
            +
              0x4A75, 0x5A54, 0x6A37, 0x7A16, 0x0AF1, 0x1AD0, 0x2AB3, 0x3A92,
         
     | 
| 
      
 54 
     | 
    
         
            +
              0xFD2E, 0xED0F, 0xDD6C, 0xCD4D, 0xBDAA, 0xAD8B, 0x9DE8, 0x8DC9,
         
     | 
| 
      
 55 
     | 
    
         
            +
              0x7C26, 0x6C07, 0x5C64, 0x4C45, 0x3CA2, 0x2C83, 0x1CE0, 0x0CC1,
         
     | 
| 
      
 56 
     | 
    
         
            +
              0xEF1F, 0xFF3E, 0xCF5D, 0xDF7C, 0xAF9B, 0xBFBA, 0x8FD9, 0x9FF8,
         
     | 
| 
      
 57 
     | 
    
         
            +
              0x6E17, 0x7E36, 0x4E55, 0x5E74, 0x2E93, 0x3EB2, 0x0ED1, 0x1EF0
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
            };
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
      
 62 
     | 
    
         
            +
            static const CRC_16[ 16 ] = {
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
              0x0000, 0x1081, 0x2102, 0x3183,	
         
     | 
| 
      
 65 
     | 
    
         
            +
              0x4204, 0x5285, 0x6306, 0x7387,
         
     | 
| 
      
 66 
     | 
    
         
            +
              0x8408, 0x9489, 0xa50a, 0xb58b,	
         
     | 
| 
      
 67 
     | 
    
         
            +
              0xc60c, 0xd68d, 0xe70e, 0xf78f
         
     | 
| 
      
 68 
     | 
    
         
            +
             
     | 
| 
      
 69 
     | 
    
         
            +
            };
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
            /*
         
     | 
| 
      
 72 
     | 
    
         
            +
            static VALUE crc16_ibm( VALUE self, VALUE string ) {
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
              // verify argument type
         
     | 
| 
      
 75 
     | 
    
         
            +
              Check_Type( string, T_STRING );
         
     | 
| 
      
 76 
     | 
    
         
            +
              
         
     | 
| 
      
 77 
     | 
    
         
            +
              const char* data = RSTRING_PTR( string );
         
     | 
| 
      
 78 
     | 
    
         
            +
              
         
     | 
| 
      
 79 
     | 
    
         
            +
              int len = RSTRING_LEN( string );
         
     | 
| 
      
 80 
     | 
    
         
            +
                
         
     | 
| 
      
 81 
     | 
    
         
            +
              int crc = 0xffff;
         
     | 
| 
      
 82 
     | 
    
         
            +
             
     | 
| 
      
 83 
     | 
    
         
            +
              int c = 0;
         
     | 
| 
      
 84 
     | 
    
         
            +
             
     | 
| 
      
 85 
     | 
    
         
            +
              while( len-- != 0 ){
         
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
      
 87 
     | 
    
         
            +
                c = *data++;
         
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
            		crc = ( ( crc >> 4 ) & 0x0fff ) ^ CRC_16[ ( ( crc ^ c ) & 15 ) ];
         
     | 
| 
      
 90 
     | 
    
         
            +
             
     | 
| 
      
 91 
     | 
    
         
            +
            		crc = ( ( crc >> 4 ) & 0x0fff ) ^ CRC_16[ ( ( crc ^ ( c >> 4 )) & 15 ) ];
         
     | 
| 
      
 92 
     | 
    
         
            +
              }
         
     | 
| 
      
 93 
     | 
    
         
            +
             
     | 
| 
      
 94 
     | 
    
         
            +
             
     | 
| 
      
 95 
     | 
    
         
            +
            	return INT2FIX( ~crc & 0xffff );
         
     | 
| 
      
 96 
     | 
    
         
            +
             
     | 
| 
      
 97 
     | 
    
         
            +
            }
         
     | 
| 
      
 98 
     | 
    
         
            +
            */
         
     | 
| 
      
 99 
     | 
    
         
            +
             
     | 
| 
      
 100 
     | 
    
         
            +
            static VALUE crc16( int argc, VALUE* argv, VALUE self ) { 
         
     | 
| 
      
 101 
     | 
    
         
            +
             
     | 
| 
      
 102 
     | 
    
         
            +
            /*
         
     | 
| 
      
 103 
     | 
    
         
            +
             
     | 
| 
      
 104 
     | 
    
         
            +
              # CRC-16-CCITT    
         
     | 
| 
      
 105 
     | 
    
         
            +
              def crc16( buf, crc = 0 )
         
     | 
| 
      
 106 
     | 
    
         
            +
             
     | 
| 
      
 107 
     | 
    
         
            +
                # calculate the checksum
         
     | 
| 
      
 108 
     | 
    
         
            +
                buf.each_byte{ | x | crc = ( ( crc << 8 ) ^ @CCITT_16[ ( crc >> 8 ) ^ x ] ) & 0xffff }
         
     | 
| 
      
 109 
     | 
    
         
            +
             
     | 
| 
      
 110 
     | 
    
         
            +
                # result
         
     | 
| 
      
 111 
     | 
    
         
            +
                crc
         
     | 
| 
      
 112 
     | 
    
         
            +
             
     | 
| 
      
 113 
     | 
    
         
            +
              end # crc16
         
     | 
| 
      
 114 
     | 
    
         
            +
             
     | 
| 
      
 115 
     | 
    
         
            +
            */
         
     | 
| 
      
 116 
     | 
    
         
            +
             
     | 
| 
      
 117 
     | 
    
         
            +
              // variables for arguments
         
     | 
| 
      
 118 
     | 
    
         
            +
              VALUE string, initial_crc;
         
     | 
| 
      
 119 
     | 
    
         
            +
             
     | 
| 
      
 120 
     | 
    
         
            +
              // retrieve arguments
         
     | 
| 
      
 121 
     | 
    
         
            +
              rb_scan_args(argc, argv, "11", &string, &initial_crc);
         
     | 
| 
      
 122 
     | 
    
         
            +
             
     | 
| 
      
 123 
     | 
    
         
            +
              // verify argument type
         
     | 
| 
      
 124 
     | 
    
         
            +
              Check_Type( string, T_STRING );
         
     | 
| 
      
 125 
     | 
    
         
            +
             
     | 
| 
      
 126 
     | 
    
         
            +
              // initialize crc 
         
     | 
| 
      
 127 
     | 
    
         
            +
              unsigned int crc = 0; 
         
     | 
| 
      
 128 
     | 
    
         
            +
              
         
     | 
| 
      
 129 
     | 
    
         
            +
              if (!NIL_P(initial_crc)){
         
     | 
| 
      
 130 
     | 
    
         
            +
             
     | 
| 
      
 131 
     | 
    
         
            +
                // verify initial crc value
         
     | 
| 
      
 132 
     | 
    
         
            +
                Check_Type( initial_crc, T_FIXNUM );
         
     | 
| 
      
 133 
     | 
    
         
            +
              
         
     | 
| 
      
 134 
     | 
    
         
            +
                crc = FIX2INT( initial_crc );
         
     | 
| 
      
 135 
     | 
    
         
            +
              
         
     | 
| 
      
 136 
     | 
    
         
            +
              }
         
     | 
| 
      
 137 
     | 
    
         
            +
             
     | 
| 
      
 138 
     | 
    
         
            +
              const unsigned char* data = RSTRING_PTR( string );
         
     | 
| 
      
 139 
     | 
    
         
            +
              
         
     | 
| 
      
 140 
     | 
    
         
            +
              unsigned int len = RSTRING_LEN( string );
         
     | 
| 
      
 141 
     | 
    
         
            +
              
         
     | 
| 
      
 142 
     | 
    
         
            +
              unsigned char c = 0;
         
     | 
| 
      
 143 
     | 
    
         
            +
             
     | 
| 
      
 144 
     | 
    
         
            +
              while( len-- ){
         
     | 
| 
      
 145 
     | 
    
         
            +
             
     | 
| 
      
 146 
     | 
    
         
            +
                c = *data++;
         
     | 
| 
      
 147 
     | 
    
         
            +
             
     | 
| 
      
 148 
     | 
    
         
            +
                crc = ( ( crc << 8 ) ^ CCITT_16[ ( crc >> 8 ) ^ c ] ) & 0xffff;
         
     | 
| 
      
 149 
     | 
    
         
            +
             
     | 
| 
      
 150 
     | 
    
         
            +
              }
         
     | 
| 
      
 151 
     | 
    
         
            +
             
     | 
| 
      
 152 
     | 
    
         
            +
            	return INT2FIX( crc );
         
     | 
| 
      
 153 
     | 
    
         
            +
             
     | 
| 
      
 154 
     | 
    
         
            +
             
     | 
| 
      
 155 
     | 
    
         
            +
            }
         
     | 
| 
      
 156 
     | 
    
         
            +
             
     | 
| 
      
 157 
     | 
    
         
            +
            static VALUE crc16_ibm( int argc, VALUE* argv, VALUE self ) { 
         
     | 
| 
      
 158 
     | 
    
         
            +
             
     | 
| 
      
 159 
     | 
    
         
            +
            /*
         
     | 
| 
      
 160 
     | 
    
         
            +
             
     | 
| 
      
 161 
     | 
    
         
            +
              # IBM-CRC-16: fallback when native extensions are not supported (e.g. jruby)
         
     | 
| 
      
 162 
     | 
    
         
            +
              def crc16_ibm( buf, crc = 0xffff )
         
     | 
| 
      
 163 
     | 
    
         
            +
             
     | 
| 
      
 164 
     | 
    
         
            +
                buf.each_byte do | c |
         
     | 
| 
      
 165 
     | 
    
         
            +
             
     | 
| 
      
 166 
     | 
    
         
            +
                  crc = ( ( crc >> 4 ) & 0x0fff ) ^ @IBM_16[ ( ( crc ^ c ) & 15 ) ]
         
     | 
| 
      
 167 
     | 
    
         
            +
             
     | 
| 
      
 168 
     | 
    
         
            +
                  crc = ( ( crc >> 4 ) & 0x0fff ) ^ @IBM_16[ ( ( crc ^ ( c >> 4 ) ) & 15 ) ]
         
     | 
| 
      
 169 
     | 
    
         
            +
             
     | 
| 
      
 170 
     | 
    
         
            +
                end
         
     | 
| 
      
 171 
     | 
    
         
            +
             
     | 
| 
      
 172 
     | 
    
         
            +
                # result
         
     | 
| 
      
 173 
     | 
    
         
            +
                ~crc & 0xffff
         
     | 
| 
      
 174 
     | 
    
         
            +
             
     | 
| 
      
 175 
     | 
    
         
            +
              end # crc16_ibm
         
     | 
| 
      
 176 
     | 
    
         
            +
             
     | 
| 
      
 177 
     | 
    
         
            +
            */
         
     | 
| 
      
 178 
     | 
    
         
            +
             
     | 
| 
      
 179 
     | 
    
         
            +
              // variables for arguments
         
     | 
| 
      
 180 
     | 
    
         
            +
              VALUE string, initial_crc;
         
     | 
| 
      
 181 
     | 
    
         
            +
             
     | 
| 
      
 182 
     | 
    
         
            +
              // retrieve arguments
         
     | 
| 
      
 183 
     | 
    
         
            +
              rb_scan_args(argc, argv, "11", &string, &initial_crc);
         
     | 
| 
      
 184 
     | 
    
         
            +
             
     | 
| 
      
 185 
     | 
    
         
            +
              unsigned int crc = 0xffff; 
         
     | 
| 
      
 186 
     | 
    
         
            +
              
         
     | 
| 
      
 187 
     | 
    
         
            +
              if (!NIL_P(initial_crc)){
         
     | 
| 
      
 188 
     | 
    
         
            +
             
     | 
| 
      
 189 
     | 
    
         
            +
                // verify initial crc value
         
     | 
| 
      
 190 
     | 
    
         
            +
                Check_Type( initial_crc, T_FIXNUM );
         
     | 
| 
      
 191 
     | 
    
         
            +
              
         
     | 
| 
      
 192 
     | 
    
         
            +
                crc = FIX2INT( initial_crc );
         
     | 
| 
      
 193 
     | 
    
         
            +
              
         
     | 
| 
      
 194 
     | 
    
         
            +
              }
         
     | 
| 
      
 195 
     | 
    
         
            +
              
         
     | 
| 
      
 196 
     | 
    
         
            +
              // verify argument type
         
     | 
| 
      
 197 
     | 
    
         
            +
              Check_Type( string, T_STRING );
         
     | 
| 
      
 198 
     | 
    
         
            +
             
     | 
| 
      
 199 
     | 
    
         
            +
              const unsigned char* data = RSTRING_PTR( string );
         
     | 
| 
      
 200 
     | 
    
         
            +
              
         
     | 
| 
      
 201 
     | 
    
         
            +
              unsigned int len = RSTRING_LEN( string );
         
     | 
| 
      
 202 
     | 
    
         
            +
              
         
     | 
| 
      
 203 
     | 
    
         
            +
              unsigned char c = 0;
         
     | 
| 
      
 204 
     | 
    
         
            +
             
     | 
| 
      
 205 
     | 
    
         
            +
              while( len-- ){
         
     | 
| 
      
 206 
     | 
    
         
            +
             
     | 
| 
      
 207 
     | 
    
         
            +
                c = *data++;
         
     | 
| 
      
 208 
     | 
    
         
            +
             
     | 
| 
      
 209 
     | 
    
         
            +
                crc = ( crc >> 4 ) ^ CRC_16[ ( crc ^ c ) & 15 ];
         
     | 
| 
      
 210 
     | 
    
         
            +
                          
         
     | 
| 
      
 211 
     | 
    
         
            +
                crc = ( crc >> 4 ) ^ CRC_16[ ( crc ^ ( c >> 4 ) ) & 15 ];
         
     | 
| 
      
 212 
     | 
    
         
            +
             
     | 
| 
      
 213 
     | 
    
         
            +
              }
         
     | 
| 
      
 214 
     | 
    
         
            +
             
     | 
| 
      
 215 
     | 
    
         
            +
            	return INT2FIX( ~crc & 0xffff );
         
     | 
| 
      
 216 
     | 
    
         
            +
             
     | 
| 
      
 217 
     | 
    
         
            +
             
     | 
| 
      
 218 
     | 
    
         
            +
            }
         
     | 
| 
      
 219 
     | 
    
         
            +
             
     | 
| 
      
 220 
     | 
    
         
            +
            // determines that native extension is in use
         
     | 
| 
      
 221 
     | 
    
         
            +
            static VALUE native_extension( VALUE self ) { 
         
     | 
| 
      
 222 
     | 
    
         
            +
             
     | 
| 
      
 223 
     | 
    
         
            +
              return Qtrue;
         
     | 
| 
      
 224 
     | 
    
         
            +
             
     | 
| 
      
 225 
     | 
    
         
            +
            }
         
     | 
| 
      
 226 
     | 
    
         
            +
             
     | 
| 
      
 227 
     | 
    
         
            +
            /*
         
     | 
| 
      
 228 
     | 
    
         
            +
            // determines that native extension is in use
         
     | 
| 
      
 229 
     | 
    
         
            +
            static VALUE conv( VALUE self, VALUE string ) { 
         
     | 
| 
      
 230 
     | 
    
         
            +
              
         
     | 
| 
      
 231 
     | 
    
         
            +
              VALUE arr = rb_ary_new();
         
     | 
| 
      
 232 
     | 
    
         
            +
              
         
     | 
| 
      
 233 
     | 
    
         
            +
              const char* data = RSTRING_PTR( string );
         
     | 
| 
      
 234 
     | 
    
         
            +
              
         
     | 
| 
      
 235 
     | 
    
         
            +
              int len = RSTRING_LEN( string );
         
     | 
| 
      
 236 
     | 
    
         
            +
              
         
     | 
| 
      
 237 
     | 
    
         
            +
              int c = 0;
         
     | 
| 
      
 238 
     | 
    
         
            +
             
     | 
| 
      
 239 
     | 
    
         
            +
              while( len-- ){
         
     | 
| 
      
 240 
     | 
    
         
            +
             
     | 
| 
      
 241 
     | 
    
         
            +
                c = *data++;
         
     | 
| 
      
 242 
     | 
    
         
            +
             
     | 
| 
      
 243 
     | 
    
         
            +
                char result[] = { c };
         
     | 
| 
      
 244 
     | 
    
         
            +
             
     | 
| 
      
 245 
     | 
    
         
            +
                switch( c ){
         
     | 
| 
      
 246 
     | 
    
         
            +
             
     | 
| 
      
 247 
     | 
    
         
            +
                  case 38:
         
     | 
| 
      
 248 
     | 
    
         
            +
             
     | 
| 
      
 249 
     | 
    
         
            +
                    rb_ary_push( arr, rb_str_new2( "&" ) );
         
     | 
| 
      
 250 
     | 
    
         
            +
                    break;
         
     | 
| 
      
 251 
     | 
    
         
            +
             
     | 
| 
      
 252 
     | 
    
         
            +
                  case 60:
         
     | 
| 
      
 253 
     | 
    
         
            +
             
     | 
| 
      
 254 
     | 
    
         
            +
                    rb_ary_push( arr, rb_str_new2( "<" ) );
         
     | 
| 
      
 255 
     | 
    
         
            +
                    break;
         
     | 
| 
      
 256 
     | 
    
         
            +
             
     | 
| 
      
 257 
     | 
    
         
            +
                  case 62:
         
     | 
| 
      
 258 
     | 
    
         
            +
             
     | 
| 
      
 259 
     | 
    
         
            +
                    rb_ary_push( arr, rb_str_new2( ">" ) );
         
     | 
| 
      
 260 
     | 
    
         
            +
                    break;
         
     | 
| 
      
 261 
     | 
    
         
            +
             
     | 
| 
      
 262 
     | 
    
         
            +
                  case 34:
         
     | 
| 
      
 263 
     | 
    
         
            +
             
     | 
| 
      
 264 
     | 
    
         
            +
                    rb_ary_push( arr, rb_str_new2( """ ) );
         
     | 
| 
      
 265 
     | 
    
         
            +
                    break;
         
     | 
| 
      
 266 
     | 
    
         
            +
             
     | 
| 
      
 267 
     | 
    
         
            +
                  case 39:
         
     | 
| 
      
 268 
     | 
    
         
            +
             
     | 
| 
      
 269 
     | 
    
         
            +
                    rb_ary_push( arr, rb_str_new2( "'" ) );
         
     | 
| 
      
 270 
     | 
    
         
            +
                    break;
         
     | 
| 
      
 271 
     | 
    
         
            +
             
     | 
| 
      
 272 
     | 
    
         
            +
                default:
         
     | 
| 
      
 273 
     | 
    
         
            +
             
     | 
| 
      
 274 
     | 
    
         
            +
                  //rb_ary_push( arr, INT2FIX(c) );
         
     | 
| 
      
 275 
     | 
    
         
            +
                  rb_ary_push( arr, rb_str_new( result, 1 ) );
         
     | 
| 
      
 276 
     | 
    
         
            +
                  break;
         
     | 
| 
      
 277 
     | 
    
         
            +
             
     | 
| 
      
 278 
     | 
    
         
            +
                }
         
     | 
| 
      
 279 
     | 
    
         
            +
             
     | 
| 
      
 280 
     | 
    
         
            +
              }  
         
     | 
| 
      
 281 
     | 
    
         
            +
             
     | 
| 
      
 282 
     | 
    
         
            +
              return rb_funcall2( arr, rb_intern("join"), 0, NULL );
         
     | 
| 
      
 283 
     | 
    
         
            +
             
     | 
| 
      
 284 
     | 
    
         
            +
            }
         
     | 
| 
      
 285 
     | 
    
         
            +
            */
         
     | 
| 
      
 286 
     | 
    
         
            +
             
     | 
| 
      
 287 
     | 
    
         
            +
            void Init_native_extensions() {
         
     | 
| 
      
 288 
     | 
    
         
            +
             
     | 
| 
      
 289 
     | 
    
         
            +
              // main tdriver module
         
     | 
| 
      
 290 
     | 
    
         
            +
            	VALUE mTDriver = rb_define_module( "TDriver" );
         
     | 
| 
      
 291 
     | 
    
         
            +
             
     | 
| 
      
 292 
     | 
    
         
            +
              // checksum module
         
     | 
| 
      
 293 
     | 
    
         
            +
            	VALUE cChecksum = rb_define_class_under( mTDriver, "Checksum", rb_cObject );
         
     | 
| 
      
 294 
     | 
    
         
            +
            	
         
     | 
| 
      
 295 
     | 
    
         
            +
            	// checksum methods
         
     | 
| 
      
 296 
     | 
    
         
            +
            	rb_define_singleton_method( cChecksum, "crc16_ibm", crc16_ibm, -1 );
         
     | 
| 
      
 297 
     | 
    
         
            +
             
     | 
| 
      
 298 
     | 
    
         
            +
            	rb_define_singleton_method( cChecksum, "crc16", crc16, -1 );
         
     | 
| 
      
 299 
     | 
    
         
            +
             
     | 
| 
      
 300 
     | 
    
         
            +
              // determines that native extension is in use
         
     | 
| 
      
 301 
     | 
    
         
            +
            	rb_define_singleton_method( cChecksum, "native_extension", native_extension, 0 );
         
     | 
| 
      
 302 
     | 
    
         
            +
             
     | 
| 
      
 303 
     | 
    
         
            +
            /*
         
     | 
| 
      
 304 
     | 
    
         
            +
              // determines that native extension is in use
         
     | 
| 
      
 305 
     | 
    
         
            +
            	rb_define_singleton_method( cChecksum, "conv", conv, 1 );
         
     | 
| 
      
 306 
     | 
    
         
            +
             
     | 
| 
      
 307 
     | 
    
         
            +
            */
         
     | 
| 
      
 308 
     | 
    
         
            +
             
     | 
| 
      
 309 
     | 
    
         
            +
              // deprecated - for backwards compatibility
         
     | 
| 
      
 310 
     | 
    
         
            +
            	VALUE mNativeExtensions = rb_define_module_under( mTDriver, "NativeExtensions" );
         
     | 
| 
      
 311 
     | 
    
         
            +
            	VALUE mCRC = rb_define_module_under( mNativeExtensions, "CRC" );
         
     | 
| 
      
 312 
     | 
    
         
            +
            	rb_define_singleton_method( mCRC, "crc16_ibm", crc16_ibm, -1 );
         
     | 
| 
      
 313 
     | 
    
         
            +
             
     | 
| 
      
 314 
     | 
    
         
            +
             
     | 
| 
      
 315 
     | 
    
         
            +
            }
         
     | 
    
        data/lib/matti.rb
    ADDED
    
    | 
         @@ -0,0 +1,25 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ############################################################################
         
     | 
| 
      
 2 
     | 
    
         
            +
            ## 
         
     | 
| 
      
 3 
     | 
    
         
            +
            ## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 
         
     | 
| 
      
 4 
     | 
    
         
            +
            ## All rights reserved. 
         
     | 
| 
      
 5 
     | 
    
         
            +
            ## Contact: Nokia Corporation (testabilitydriver@nokia.com) 
         
     | 
| 
      
 6 
     | 
    
         
            +
            ## 
         
     | 
| 
      
 7 
     | 
    
         
            +
            ## This file is part of Testability Driver. 
         
     | 
| 
      
 8 
     | 
    
         
            +
            ## 
         
     | 
| 
      
 9 
     | 
    
         
            +
            ## If you have questions regarding the use of this file, please contact 
         
     | 
| 
      
 10 
     | 
    
         
            +
            ## Nokia at testabilitydriver@nokia.com . 
         
     | 
| 
      
 11 
     | 
    
         
            +
            ## 
         
     | 
| 
      
 12 
     | 
    
         
            +
            ## This library is free software; you can redistribute it and/or 
         
     | 
| 
      
 13 
     | 
    
         
            +
            ## modify it under the terms of the GNU Lesser General Public 
         
     | 
| 
      
 14 
     | 
    
         
            +
            ## License version 2.1 as published by the Free Software Foundation 
         
     | 
| 
      
 15 
     | 
    
         
            +
            ## and appearing in the file LICENSE.LGPL included in the packaging 
         
     | 
| 
      
 16 
     | 
    
         
            +
            ## of this file. 
         
     | 
| 
      
 17 
     | 
    
         
            +
            ## 
         
     | 
| 
      
 18 
     | 
    
         
            +
            ############################################################################
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            $stderr.puts "%s:%s warning: require 'matti' deprecated, use require 'tdriver' instead. Please note that class 'MATTI' is also deprecated, use 'TDriver' instead " % ( caller.first || "%s:%s" % [ __FILE__, __LINE__ ] ).split(":")[ 0..1 ]
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            # load matti resources and framework
         
     | 
| 
      
 23 
     | 
    
         
            +
            require File.expand_path( File.join( File.dirname( __FILE__ ), 'tdriver/env' ) )
         
     | 
| 
      
 24 
     | 
    
         
            +
            require File.expand_path( File.join( File.dirname( __FILE__ ), 'tdriver/version' ) )
         
     | 
| 
      
 25 
     | 
    
         
            +
            require File.expand_path( File.join( File.dirname( __FILE__ ), 'tdriver/matti' ) )
         
     | 
| 
         @@ -0,0 +1,120 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ############################################################################
         
     | 
| 
      
 2 
     | 
    
         
            +
            ## 
         
     | 
| 
      
 3 
     | 
    
         
            +
            ## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 
         
     | 
| 
      
 4 
     | 
    
         
            +
            ## All rights reserved. 
         
     | 
| 
      
 5 
     | 
    
         
            +
            ## Contact: Nokia Corporation (testabilitydriver@nokia.com) 
         
     | 
| 
      
 6 
     | 
    
         
            +
            ## 
         
     | 
| 
      
 7 
     | 
    
         
            +
            ## This file is part of TDriver. 
         
     | 
| 
      
 8 
     | 
    
         
            +
            ## 
         
     | 
| 
      
 9 
     | 
    
         
            +
            ## If you have questions regarding the use of this file, please contact 
         
     | 
| 
      
 10 
     | 
    
         
            +
            ## Nokia at testabilitydriver@nokia.com . 
         
     | 
| 
      
 11 
     | 
    
         
            +
            ## 
         
     | 
| 
      
 12 
     | 
    
         
            +
            ## This library is free software; you can redistribute it and/or 
         
     | 
| 
      
 13 
     | 
    
         
            +
            ## modify it under the terms of the GNU Lesser General Public 
         
     | 
| 
      
 14 
     | 
    
         
            +
            ## License version 2.1 as published by the Free Software Foundation 
         
     | 
| 
      
 15 
     | 
    
         
            +
            ## and appearing in the file LICENSE.LGPL included in the packaging 
         
     | 
| 
      
 16 
     | 
    
         
            +
            ## of this file. 
         
     | 
| 
      
 17 
     | 
    
         
            +
            ## 
         
     | 
| 
      
 18 
     | 
    
         
            +
            ############################################################################
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            module MobyBehaviour
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
              module QT
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                # == description
         
     | 
| 
      
 25 
     | 
    
         
            +
                # This module contains demonstration implementation containing tags for documentation generation using gesture as an example
         
     | 
| 
      
 26 
     | 
    
         
            +
                #
         
     | 
| 
      
 27 
     | 
    
         
            +
                # == behaviour
         
     | 
| 
      
 28 
     | 
    
         
            +
                # QtExampleGestureBehaviour
         
     | 
| 
      
 29 
     | 
    
         
            +
                #
         
     | 
| 
      
 30 
     | 
    
         
            +
                # == requires
         
     | 
| 
      
 31 
     | 
    
         
            +
                # testability-driver-sut-qt-plugin
         
     | 
| 
      
 32 
     | 
    
         
            +
                #
         
     | 
| 
      
 33 
     | 
    
         
            +
                # == input_type
         
     | 
| 
      
 34 
     | 
    
         
            +
                # touch
         
     | 
| 
      
 35 
     | 
    
         
            +
                #
         
     | 
| 
      
 36 
     | 
    
         
            +
                # == sut_type
         
     | 
| 
      
 37 
     | 
    
         
            +
                # qt
         
     | 
| 
      
 38 
     | 
    
         
            +
                #
         
     | 
| 
      
 39 
     | 
    
         
            +
                # == sut_version
         
     | 
| 
      
 40 
     | 
    
         
            +
                # *
         
     | 
| 
      
 41 
     | 
    
         
            +
                #
         
     | 
| 
      
 42 
     | 
    
         
            +
                # == objects
         
     | 
| 
      
 43 
     | 
    
         
            +
                # *;sut
         
     | 
| 
      
 44 
     | 
    
         
            +
                #
         
     | 
| 
      
 45 
     | 
    
         
            +
                module Gesture
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
                include MobyBehaviour::QT::Behaviour
         
     | 
| 
      
 48 
     | 
    
         
            +
                  
         
     | 
| 
      
 49 
     | 
    
         
            +
                # == description
         
     | 
| 
      
 50 
     | 
    
         
            +
                # Cause a flick operation on the screen. 
         
     | 
| 
      
 51 
     | 
    
         
            +
                #
         
     | 
| 
      
 52 
     | 
    
         
            +
                # == arguments
         
     | 
| 
      
 53 
     | 
    
         
            +
                # argument1
         
     | 
| 
      
 54 
     | 
    
         
            +
                #  Integer
         
     | 
| 
      
 55 
     | 
    
         
            +
                #    description:  Example argument1
         
     | 
| 
      
 56 
     | 
    
         
            +
                #    example:    10
         
     | 
| 
      
 57 
     | 
    
         
            +
                #    default:          
         
     | 
| 
      
 58 
     | 
    
         
            +
                #  Hash
         
     | 
| 
      
 59 
     | 
    
         
            +
                #    description:  Example argument 1 type 2
         
     | 
| 
      
 60 
     | 
    
         
            +
                #    example:  { :optional_1 => "value_1", :optional_2 => "value_2" }
         
     | 
| 
      
 61 
     | 
    
         
            +
                #    default:
         
     | 
| 
      
 62 
     | 
    
         
            +
                #
         
     | 
| 
      
 63 
     | 
    
         
            +
                # argument2
         
     | 
| 
      
 64 
     | 
    
         
            +
                #  String
         
     | 
| 
      
 65 
     | 
    
         
            +
                #    description:  Example argument2
         
     | 
| 
      
 66 
     | 
    
         
            +
                #    example:    "Hello"
         
     | 
| 
      
 67 
     | 
    
         
            +
                #    default:    
         
     | 
| 
      
 68 
     | 
    
         
            +
                #
         
     | 
| 
      
 69 
     | 
    
         
            +
                # == returns
         
     | 
| 
      
 70 
     | 
    
         
            +
                # String
         
     | 
| 
      
 71 
     | 
    
         
            +
                #  description:  Return value type
         
     | 
| 
      
 72 
     | 
    
         
            +
                #   example:    "World"
         
     | 
| 
      
 73 
     | 
    
         
            +
                # 
         
     | 
| 
      
 74 
     | 
    
         
            +
                # == exceptions
         
     | 
| 
      
 75 
     | 
    
         
            +
                # RuntimeError
         
     | 
| 
      
 76 
     | 
    
         
            +
                #   description:  example exception
         
     | 
| 
      
 77 
     | 
    
         
            +
                #
         
     | 
| 
      
 78 
     | 
    
         
            +
                # ArgumentError
         
     | 
| 
      
 79 
     | 
    
         
            +
                #   description:  example exception
         
     | 
| 
      
 80 
     | 
    
         
            +
                #    
         
     | 
| 
      
 81 
     | 
    
         
            +
                # == example
         
     | 
| 
      
 82 
     | 
    
         
            +
                # flick( :Down, :Left, { :optional_1 => "value_1", :optional_2 => "value_2" } )
         
     | 
| 
      
 83 
     | 
    
         
            +
                #
         
     | 
| 
      
 84 
     | 
    
         
            +
                # == info
         
     | 
| 
      
 85 
     | 
    
         
            +
                # See method X, table at Y
         
     | 
| 
      
 86 
     | 
    
         
            +
                #
         
     | 
| 
      
 87 
     | 
    
         
            +
                # == howto
         
     | 
| 
      
 88 
     | 
    
         
            +
                # Example1
         
     | 
| 
      
 89 
     | 
    
         
            +
                #   description: Basic use
         
     | 
| 
      
 90 
     | 
    
         
            +
                #  code: @sut = TDriver.sut( :Id => "sut_qt" )
         
     | 
| 
      
 91 
     | 
    
         
            +
                #    app = @sut.application
         
     | 
| 
      
 92 
     | 
    
         
            +
                #    app.QPushButton( :text => "Close" ).flick :Left
         
     | 
| 
      
 93 
     | 
    
         
            +
                #
         
     | 
| 
      
 94 
     | 
    
         
            +
                def flick( direction, button = :Left, optional_params = {} )
         
     | 
| 
      
 95 
     | 
    
         
            +
                end
         
     | 
| 
      
 96 
     | 
    
         
            +
             
     | 
| 
      
 97 
     | 
    
         
            +
                private
         
     | 
| 
      
 98 
     | 
    
         
            +
             
     | 
| 
      
 99 
     | 
    
         
            +
                  # Performs the actual gesture operation. 
         
     | 
| 
      
 100 
     | 
    
         
            +
                  # Verifies that the parameters are correct and send the command
         
     | 
| 
      
 101 
     | 
    
         
            +
                  # to the sut. 
         
     | 
| 
      
 102 
     | 
    
         
            +
                  # gesture_type: :MouseGesture, :MouseGestureTo, :MouseGestureToCoordinates
         
     | 
| 
      
 103 
     | 
    
         
            +
                  # params = {:direction => :Up, duration => 2, :distance =>100, :isDrag =>false, :isMove =>false }
         
     | 
| 
      
 104 
     | 
    
         
            +
                  def do_gesture(params)
         
     | 
| 
      
 105 
     | 
    
         
            +
                  end
         
     | 
| 
      
 106 
     | 
    
         
            +
             
     | 
| 
      
 107 
     | 
    
         
            +
                  def do_sleep(time)
         
     | 
| 
      
 108 
     | 
    
         
            +
                  end
         
     | 
| 
      
 109 
     | 
    
         
            +
             
     | 
| 
      
 110 
     | 
    
         
            +
                  def calculate_speed(distance, speed)
         
     | 
| 
      
 111 
     | 
    
         
            +
                  end
         
     | 
| 
      
 112 
     | 
    
         
            +
             
     | 
| 
      
 113 
     | 
    
         
            +
                  def distance_to_point(x, y)
         
     | 
| 
      
 114 
     | 
    
         
            +
                  end
         
     | 
| 
      
 115 
     | 
    
         
            +
             
     | 
| 
      
 116 
     | 
    
         
            +
                end
         
     | 
| 
      
 117 
     | 
    
         
            +
             
     | 
| 
      
 118 
     | 
    
         
            +
              end
         
     | 
| 
      
 119 
     | 
    
         
            +
             
     | 
| 
      
 120 
     | 
    
         
            +
            end
         
     |