Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 336275 - SWTBotDateTime fails to set date completely when day-of-month to set is not available in current month
Summary: SWTBotDateTime fails to set date completely when day-of-month to set is not a...
Status: RESOLVED FIXED
Alias: None
Product: SWTBot
Classification: Technology
Component: SWTBot (show other bugs)
Version: 2.0.2   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 2.0.3   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-03 14:20 EST by Marc Philipp CLA
Modified: 2011-02-03 15:25 EST (History)
1 user (show)

See Also:


Attachments
mylyn/context/zip (20.20 KB, application/octet-stream)
2011-02-03 15:09 EST, Ketan Padegaonkar CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Philipp CLA 2011-02-03 14:20:59 EST
Build Identifier: M20100909-0800

Given a DateTime control with a currently set month that has less than 31 days (e.g. currently set date is 2/3/2011) when you try to set a date that has a day of month of 31 (e.g. 12/31/2010) then only the month and year of the date to be set are updated, the day of month stays at its initial value.

Looking at the code of SWTBotDateTime#setDate(Date) it looks like the order of method calls on the widget is wrong: setYear, setDay, and then setMonth. It should be setYear, setMonth, and then setDay.

Reproducible: Always

Steps to Reproduce:
1. Set the date of a DateTime widget to 2/3/2011 in (3rd February 2011)
2. Call setDate( new Date( 110, 11, 31 )) on the SWTBotDateTime instance representing the DateTime widget
3. The date is set incorrectly to 12/3/2010 (3rd December 2010)
Comment 1 Ketan Padegaonkar CLA 2011-02-03 15:09:36 EST
Fixed in revision f86c968. See https://github.com/ketan/SWTBot/commit/f86c968 for the fix and test case.
Comment 2 Ketan Padegaonkar CLA 2011-02-03 15:09:38 EST
Created attachment 188270 [details]
mylyn/context/zip
Comment 3 Ketan Padegaonkar CLA 2011-02-03 15:22:17 EST
Sorry, that would be revision b918d9e55d27df81d32cb1030457db07815f23c6 and not f86c968 as I mentioned in previous commit.
Comment 4 Marc Philipp CLA 2011-02-03 15:25:04 EST
Wow, that was fast! Thanks!