@@ -20,7 +20,7 @@ ___________________/ /__/ /__/ /__/ /________________________________
2020
2121'''
2222
23- __version__ = '11.1.0 '
23+ __version__ = '11.1.1 '
2424
2525import re
2626import sys
@@ -280,6 +280,13 @@ You have to set PYTHONIOENCODING environment variable. For example:
280280 warnings .warn ('Multi-device not implemented yet for this case' )
281281 else :
282282 print '%s%svc.findViewWithTextOrRaise("%s").type(u"%s")' % (indent , prefix , text , arg )
283+ elif op in [Operation .FLING_BACKWARD , Operation .FLING_FORWARD , Operation .FLING_TO_BEGINNING , Operation .FLING_TO_END ]:
284+ if options [CulebraOptions .MULTI_DEVICE ]:
285+ warnings .warn ('Multi-device not implemented yet for this case' )
286+ else :
287+ commandName = Operation .toCommandName (op )
288+ logAction (u'flinging view with text=%s %s' % (text , commandName ))
289+ print u'%s%svc.findViewWithTextOrRaise(%s).uiScrollable.%s()' % (indent , prefix , text , commandName )
283290 elif op == Operation .TEST :
284291 if options [CulebraOptions .MULTI_DEVICE ]:
285292 warnings .warn ('Multi-device not implemented yet for this case' )
@@ -333,6 +340,13 @@ def printFindViewWithContentDescription(view, useregexp, op=Operation.ASSIGN, ar
333340 warnings .warn ('Multi-device not implemented yet for this case' )
334341 else :
335342 print '%s%sassertEquals(%svc.findViewWithContentDescriptionOrRaise(%s).getText(), u\' \' \' %s\' \' \' )' % (indent , prefix , prefix , contentDescription , arg )
343+ elif op in [Operation .FLING_BACKWARD , Operation .FLING_FORWARD , Operation .FLING_TO_BEGINNING , Operation .FLING_TO_END ]:
344+ if options [CulebraOptions .MULTI_DEVICE ]:
345+ warnings .warn ('Multi-device not implemented yet for this case' )
346+ else :
347+ commandName = Operation .toCommandName (op )
348+ logAction (u'flinging view with content-description=%s %s' % (contentDescription , commandName ))
349+ print u'%s%svc.findViewWithContentDescriptionOrRaise(%s).uiScrollable.%s()' % (indent , prefix , contentDescription , commandName )
336350 else :
337351 error ("Invalid operation in %s: %s" % (sys ._getframe ().f_code .co_name ), op )
338352
@@ -374,6 +388,13 @@ def printFindViewById(view, op=Operation.ASSIGN, arg=None):
374388 warnings .warn ('Multi-device not implemented yet for this case' )
375389 else :
376390 print '%s%sassertEquals(%svc.findViewByIdOrRaise("%s").getText(), u\' \' \' %s\' \' \' )' % (indent , prefix , prefix , _id , arg )
391+ elif op in [Operation .FLING_BACKWARD , Operation .FLING_FORWARD , Operation .FLING_TO_BEGINNING , Operation .FLING_TO_END ]:
392+ if options [CulebraOptions .MULTI_DEVICE ]:
393+ warnings .warn ('Multi-device not implemented yet for this case' )
394+ else :
395+ commandName = Operation .toCommandName (op )
396+ logAction (u'flinging view with id=%s %s' % (_id , commandName ))
397+ print u'%s%svc.findViewWithIdOrRaise(u"%s").uiScrollable.%s()' % (indent , prefix , _id , commandName )
377398 else :
378399 error ("Invalid operation in %s: %s" % (sys ._getframe ().f_code .co_name , op ))
379400
@@ -681,18 +702,20 @@ def printOperation(view, op, *args):
681702 elif op == Operation .VIEW_SNAPSHOT :
682703 printSaveViewScreenshot (view , filename = args [0 ], _format = args [1 ])
683704 return
684- elif op == Operation .FLING_BACKWARD :
685- printFlingBackward (view )
686- return
687- elif op == Operation .FLING_FORWARD :
688- printFlingForward (view )
689- return
690- elif op == Operation .FLING_TO_BEGINNING :
691- printFlingToBeginning (view )
692- return
693- elif op == Operation .FLING_TO_END :
694- printFlingToEnd (view )
695- return
705+ # FIXME: I moved this to printFindViewWithContentDescription(..,op.,,) to solve the problem of variable not defined when
706+ # the script is invoked with -u
707+ # elif op == Operation.FLING_BACKWARD:
708+ # printFlingBackward(view)
709+ # return
710+ # elif op == Operation.FLING_FORWARD:
711+ # printFlingForward(view)
712+ # return
713+ # elif op == Operation.FLING_TO_BEGINNING:
714+ # printFlingToBeginning(view)
715+ # return
716+ # elif op == Operation.FLING_TO_END:
717+ # printFlingToEnd(view)
718+ # return
696719 elif op == Operation .OPEN_NOTIFICATION :
697720 printOpenNotification ()
698721 return
0 commit comments