def picker_current_index_for_column (column)arr = query("pickerTableView", :selectionBarRow)arr[column]enddef picker_current_index_for_column_is(column, val)picker_current_index_for_column(column) == valenddef previous_index_for_column (column)picker_current_index_for_column(column) - 1enddef picker_next_index_for_column (column)picker_current_index_for_column(column) + 1enddef picker_scroll_down_on_column(column)new_row = previous_index_for_column columnscroll_to_row("pickerTableView index:#{column}", new_row)enddef picker_scroll_up_on_column(column)new_row = picker_next_index_for_column columnscroll_to_row("pickerTableView index:#{column}", new_row)endThis is the definition in picker_steps.rb and When I tried to usepicker_scroll_up_on_column 0, the problem comes.
I have another Picker used in another program, the problem is quite similar.
This time the Picker will not goes back, but it stopped after the first step, even though I call it several times.
I think it's because the data haven't been updated the only change is the dispaly.
So I tried to use swipe to do a similar thing.
def picker_swipe_up_on_column(column)
swipe("up", {:query => "pickerTableView index:#{column}"})
end
This time the picker_swipe_up_on_column 0 works quid well and the changing has been saved.
But I don't know if it is possible to do something like swipe_to_row,etc.
By the way
When using scroll_to_row to select a row, the method
pickerView:didSelectRow:inComponent:
is not called. It seems that the relevant event is not being fired when using scroll_to_row.
Any idea anyone?
Then the problem comes, every time I want to scroll the picker, it will quickly goes back, no matter how many rows to be scrolled.
When using scroll_to_row to select a row, the method
pickerView:didSelectRow:inComponent:
Here is my definition
def select_date(date_string)
date = Date.parse(date_string)
query("view:'_UIDatePickerView'", [{:selectRow => date.month - 1}, {:inComponent => 0}, {:animated => 0}])
query("view:'_UIDatePickerView'", [{:selectRow => date.day - 1}, {:inComponent => 1}, {:animated => 0}])
query("view:'_UIDatePickerView'", [{:selectRow => date.year - 1}, {:inComponent => 2}, {:animated => 0}])
end
Then /^I select the date to "([^\"]*)"$/ do |date_string|
select_date date_string
sleep(STEP_PAUSE)
end
And when I use
Then I select the date to "July 12 1988"
The display is
And when I manually do that, the display will be
You can see the data above hasn't been updated.
# REQUIREDsleep(PICKER_STEP_PAUSE)# the query does not create a UIControlEventValueChanged event, so we have to# to a touch event# if the picker is in time mode, then we dont need to worry about min/max# if the picker is date or date time mode, i think the first column is# always scrollable up _and_ it sends an event even if the date is beyond# the maximum datepicker_scroll_up_on_column 0sleep(PICKER_STEP_PAUSE)picker_scroll_down_on_column 0sleep(PICKER_STEP_PAUSE)
can you please tell me what iOS(es) you are using?
I use iOS 5.1 and iOS 6.0
1. AUTOMATIC <== setting the date directly using a UIDatePicker category method2. MANUAL <== setting the date by manipulating the picker wheelswhich are you using?
def select_date(date_string)
date = Date.parse(date_string)
query("view:'_UIDatePickerView'", [{:selectRow => date.month - 1}, {:inComponent => 0}, {:animated => 0}])
sleep(0.4)
# the query does not create a UIControlEventValueChanged event, so we have to do a touch event
picker_scroll_up_on_column 0
sleep(0.4)
picker_scroll_down_on_column 0
sleep(0.4)
query("view:'_UIDatePickerView'", [{:selectRow => date.day - 1}, {:inComponent => 1}, {:animated => 0}])
sleep(0.4)
# the query does not create a UIControlEventValueChanged event, so we have to do a touch event
picker_scroll_up_on_column 1
sleep(0.4)
picker_scroll_down_on_column 1
sleep(0.4)
query("view:'_UIDatePickerView'", [{:selectRow => date.year - 1}, {:inComponent => 2}, {:animated => 0}])
sleep(0.4)
# the query does not create a UIControlEventValueChanged event, so we have to do a touch event
picker_scroll_up_on_column 2
sleep(0.4)
picker_scroll_down_on_column 2
sleep(0.4)
end
touch ("view:'UITableViewCell' label marked:'#{cell_name}'")
seems only work when the cell is in the screen, so I have to scroll down to find it.
One suggestion for this:
def select_date(date_string)
date = Date.parse(date_string)
query("view:'_UIDatePickerView'", [{:selectRow => date.year - 1}, {:inComponent => 2}, {:animated => 1}])
query("pickerView", :delegate, [{:pickerView => :__self__}, {:didSelectRow => date.year - 1}, {:inComponent => 2}])
sleep(STEP_PAUSE)
query("view:'_UIDatePickerView'", [{:selectRow => date.month - 1}, {:inComponent => 0}, {:animated => 1}])
query("pickerView", :delegate, [{:pickerView => :__self__}, {:didSelectRow => date.month - 1}, {:inComponent => 0}])
sleep(STEP_PAUSE)
query("view:'_UIDatePickerView'", [{:selectRow => date.day - 1}, {:inComponent => 1}, {:animated => 1}])
query("pickerView", :delegate, [{:pickerView => :__self__}, {:didSelectRow => date.day - 1}, {:inComponent => 1}])
sleep(STEP_PAUSE)
--
You received this message because you are subscribed to the Google Groups "calabash-ios" group.
To unsubscribe from this group and stop receiving emails from it, send an email to calabash-ios...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.