austgl / robotium

Automatically exported from code.google.com/p/robotium
0 stars 0 forks source link

setDatePicker Behavior #118

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Have a View that will open a DatePicker Dialog when clicked
2. Click on the View 
3. Call Solo.setDatePicker(0,2011,5,7);
4. Click on Button "Set" in the DatePickerDialog so that the Setting is done.

What is the expected output? What do you see instead?
expected:
4. The Button is clicked and the setting is done. The DatePicker gets closed.
instead:
4. The EditText for the Day is clicked on.

What version of the product are you using? On what operating system?
2.2, Android 2.2 HTC Desire

Please provide any additional information below.

Not sure if this is a Robotium problem or an Android problem...

Original issue reported on code.google.com by JoaRe...@gmail.com on 3 Jun 2011 at 10:42

GoogleCodeExporter commented 9 years ago
Have you tried this on the emulator? 

Original comment by renasr...@gmail.com on 5 Jun 2011 at 3:02

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Same behaviour in Emulator (Google API Level 8)

Original comment by JoaRe...@gmail.com on 6 Jun 2011 at 9:25

GoogleCodeExporter commented 9 years ago
Please see: "Why do text and button clicks get wrong?"

http://code.google.com/p/robotium/wiki/QuestionsAndAnswers

Original comment by renasr...@gmail.com on 6 Jun 2011 at 9:57

GoogleCodeExporter commented 9 years ago
Thank you for that hint.

I tried that in two seperate projects. While in one project the tags in the 
manifest files helped, in the other project it didn't. 

I am completely clueless why it does not work on both or neither.. Maybe you 
know something more? 

In my Project I have:

<supports-screens
android:anyDensity="true" />

<uses-sdk
android:targetSdkVersion="4"
android:minSdkVersion="3" />

In my Test Project I have:

<uses-sdk android:targetSdkVersion="4" />

Original comment by JoaRe...@gmail.com on 6 Jun 2011 at 2:25

GoogleCodeExporter commented 9 years ago
In the method Clicker.public void clickOnScreen(View view, boolean longClick, 
int time)

the line 

view.getLocationOnScreen(xy);

returns different values for the y-coordinate.
This is why the EditText is clicked instead of the Button.

Original comment by JoaRe...@gmail.com on 6 Jun 2011 at 3:14

GoogleCodeExporter commented 9 years ago
Robotium does not support version API version 4. It only works with Android 1.6 
and up. 

Original comment by renasr...@gmail.com on 6 Jun 2011 at 3:42

GoogleCodeExporter commented 9 years ago
Isn't Android 1.6 API version 4 ?

Original comment by JoaRe...@gmail.com on 6 Jun 2011 at 3:46

GoogleCodeExporter commented 9 years ago
The min version 3 (1.5) might be the reason why you are getting the wrong 
coordinates back.

The only other reason why you would get the wrong coordinates back is because 
of the screen densitiy issue described in the QA wiki page. You need to add 
those tags to the application that you want to test (not the test project). 

Original comment by renasr...@gmail.com on 6 Jun 2011 at 3:50

GoogleCodeExporter commented 9 years ago
I have now in my project:

<supports-screens
android:anyDensity="true" />
<uses-sdk 
android:targetSdkVersion="8"
/>

And in my test project:
<uses-sdk android:targetSdkVersion="8"
/>

Same behaviour..

Original comment by JoaRe...@gmail.com on 6 Jun 2011 at 4:00

GoogleCodeExporter commented 9 years ago
As I said in the previous message it has to do with wrong coordinates being 
given back to Robotium. This is not a Robotium defect. Unfortunetaly I can not 
give you any other solution then what is described in the QA page. 

Original comment by renasr...@gmail.com on 6 Jun 2011 at 4:23

GoogleCodeExporter commented 9 years ago
Hi,

I have just found the reason. 

Before I opened the DatePickerDialog, a software keyboard was shown!

The keyboard will be closed once the DatePickerDialog is shown.
However, one has to close the keyboard manually (e.g. by calling Solo.goBack), 
otherwise the following click will not be made correctly.

I attached a Sample Project and a Sample Test Project that makes this clear.
Note that the test projects writes the processing steps of the test to the 
LogCat. You can see there that a wrong coordinate for the y-axis will be used.

(Used Emulator 2.2)

Original comment by JoaRe...@gmail.com on 10 Jun 2011 at 9:31

GoogleCodeExporter commented 9 years ago
Added the sample..

Original comment by JoaRe...@gmail.com on 10 Jun 2011 at 9:31

Attachments: