def step(context, app_name, index_diff): if not context.userData: context.userData = {} found, app_idname = app.get_app_id(app_name) if found: object_name = qml.grid_delegate + app_idname grid_view = waitForObject( names.neptune_UI_Center_Console_grid_GridView) object_pointer = find_object_name_recursively(grid_view, object_name, 3) if object_pointer: app_index_string = 'launcher_grid_visible_"' + app_name + '_index' old_index = context.userData[app_index_string] ## if new_index = object_pointer.visualIndex test.compare( new_index, old_index + index_diff, "index from '" + app_name + "' should change by " + str(index_diff) + " from " + str(old_index) + " to " + str(old_index + index_diff) + ", it is " + str(new_index)) else: test.fail("'" + app_name + "' app is known but could not be found!") else: test.fail("'" + app_name + "' app is not known!")
def step(context, app_name): if not context.userData: context.userData = {} found, app_idname = app.get_app_id(app_name) if found: object_name = qml.grid_delegate + app_idname grid_view = waitForObject( names.neptune_UI_Center_Console_grid_GridView) app_pointer = find_object_name_recursively(grid_view, object_name, 3) if app_pointer: # open grid always, looking at visible is not as # robust as doing this always grid_button = waitForObject( names.neptune_3_UI_Center_Console_gridButton_ToolButton) tapObject(grid_button) # wait a little until grid is opened squish.snooze(0.5) if app_pointer.visible: tapObject(app_pointer) else: test.fail("'" + app_name + "' is on the grid but" + " not visible, this should not happen at all.") else: test.fail("'" + app_name + "' could not be found!") # wait another half second squish.snooze(0.5)
def step(context, app_name): found, app_idname = app.get_app_id(app_name) if found: object_name = qml.grid_delegate + app_idname grid_view = waitForObject( names.neptune_UI_Center_Console_grid_GridView) object_pointer = find_object_name_recursively(grid_view, object_name, 3) if object_pointer is not None: if object_pointer.visible: pass squish.tapObject(object_pointer)
def find_homeWidgetGrid_app(app_name): """helper function""" good = False result = None found, app_idname = app.get_app_id(app_name) if found: object_name = qml.home_widget + app_idname grid_view = waitForObject( names.neptune_3_UI_Center_Console_widgetGrid_homepage_WidgetGrid) grid_entry = find_object_name_recursively(grid_view, object_name, 3) if grid_entry is not None: good = True result = grid_entry return good, (result, app_idname)
def step(context, app_name, index): if not context.userData: context.userData = {} app_index_string = 'launcher_grid_visible_"' + app_name + '_index' app_idx = context.userData[app_index_string] # search in grid grid_view = waitForObject(names.neptune_UI_Center_Console_grid_GridView) found, app_idname = app.get_app_id(app_name) object_name = qml.grid_delegate + app_idname if found: check_app = find_object_name_recursively(grid_view, object_name, 3) if check_app is not None: found_idx = check_app.visualIndex test.compare(found_idx, index, "shall have same index, had " + str(app_idx) + ".") else: test.fail("'" + app_idname + "' not found!!")
def step(context, wait_sec, app_name): if not context.userData: context.userData = {} # MUST switch to main app app.switch_to_main_app() # wait a small while to let it open snooze(wait_sec) found, app_idname = app.get_app_id(app_name) if found: object_name = qml.current_inFrame_Application + app_idname active_app_slot = waitForObject( names.neptune_3_UI_Center_Console_activeApplicationSlot_Item) # 1st: look for "inFrameApplication" app_pointer = find_object_name_recursively(active_app_slot, object_name, 3) if app_pointer is not None: my_numnber = app_pointer.children.count test.log("-_" + str(my_numnber)) test.compare(True, app_pointer.visible, "should be visible!") else: # 2nd try: look for "application_widget" test.log("'" + app_idname + "' as inFrameApp not found," + " trying as applicationWidget") object_name = qml.application_widget + app_idname app_pointer = find_object_name_recursively(active_app_slot, object_name, 3) if app_pointer is not None: test.compare(True, app_pointer.visible, " should be visible!") else: test.fail("'" + app_name + "' app is not known!!") else: test.fail("'" + app_name + "' app is not known!!")
def step(context, app_name, delta_up, delta_right): if not context.userData: context.userData = {} found, app_idname = app.get_app_id(app_name) if found: object_name = qml.grid_delegate + app_idname grid_view = waitForObject( names.neptune_UI_Center_Console_grid_GridView) object_pointer = find_object_name_recursively(grid_view, object_name, 3) if object_pointer is not None: if object_pointer.visible: grid_index = object_pointer.visualIndex grid_width = __builtin__.int(object_pointer.width) grid_height = __builtin__.int(object_pointer.height) # 0.8 is because of better grab/press of a tile delta_int_up = __builtin__.int(delta_up) * 0.8 delta_int_right = __builtin__.int(delta_right) * 0.8 test.log("found '" + app_idname + "' at index: " + str(grid_index)) test.log("is landscape" if settings. SCREEN_LANDSCAPE else "is not landscape") app_index_string = 'launcher_grid_visible_"' + app_name + '_index' context.userData[app_index_string] = grid_index mid_x = __builtin__.int(grid_width * 0.5) mid_y = __builtin__.int(grid_height * 0.5) mousePress(object_pointer, mid_x, mid_y, MouseButton.LeftButton) _good, sp = get_position_item(object_pointer) test.log("Midth of it : " + str(sp.x) + "," + str(sp.y)) # wait for long press snooze(3.5) # in real coordinates, up right is different coord_move_up = __builtin__.int( grid_height * delta_int_up) # coord_up_px(grid_height * delta_int_up) coord_move_right = __builtin__.int( grid_width * delta_int_right ) # coord_right_px(grid_width * delta_int_right) #coord_move = coord_addQPoints(coord_move_up,coord_move_right) #test.log("coord up : " + str(coord_move_up.x) + "," +str(-coord_move_up.y)) #test.log("coord right: " + str(coord_move_right.x) + "," +str(-coord_move_right.y)) # sorry, squish has a very uncommon coordinate system mouseMove(object_pointer, -coord_move_right, coord_move_up) #test.log("coord: " + str(-coord_move.x) + "," + str(-coord_move.y)) mouseRelease(object_pointer) snooze(5) else: test.fail("'" + object_name + "' found but not visible!") else: test.log("could not find object '" + object_name + "' in grid!!!") else: test.fail("that app is not known")