Esempio n. 1
0
def _prefTitleRegion():
  return find(p("PreferencesTitle.png")).below(40).right(1).left(350)

def _selectPrefPane(title):
  t = _prefTitleRegion()
  i = t.left(1).left(150)
  i.click()
  t.left(1).left(50).click()
  t.left(1).right(20).click()
  wait(1)
  util.select_all()
  wait(1)
  util.delete_text()
  wait(1)
  type(title[0])
  wait(1)
  type(title[1]) # Not needed
  wait(1)
  type(Key.DOWN)
  wait(1)
  type(Key.DOWN)
  wait(1)
  t.nearby(100).wait(p(title))

util.kill_editor() # Kill any currently running editor
util.init_dart_editor() # Clear the workspace and start the editor
#util.start_dart_editor()
testPrefPaneNav() # Test
testPrefPaneSelection() # Test
util.quit_app() # Exit editor
init_logger()
#util.start_dart_editor()
init_dart_editor()
util.activate_editor()
util.goto_line(1)
for i in range(6): # Not the same as goto_line(6)
  type(Key.DOWN)
type(Key.ENTER)
#analysis_time("ENTER")
result = util.timeout(analysis_time,args=["ENTER"],kwargs={},timeout_duration=10.0,default="fail")
if result == "fail":
  logger.info("Analysis took too long after initial ENTER")
  logger.info("FAIL")
  exit(0)
edit_begin = time.clock()
add_some_code()
edit_done = exists(SIGNAL, max_edit_time)
edit_end = time.clock()
if edit_done:
  logger.info(" Editing took " + str(edit_end - edit_begin) + " seconds")
  wait(0.5)
  analysis_time("adding some code")
  util.menu_bar_select("File", "Revert")
  analysis_time("revert the changes")
  util.quit_app()
else:
  logger.info("Editing did not complete within " + str(max_edit_time) + " seconds")
  logger.info('FAIL')
  util.kill_editor()