Re: Unittest for tdf#130515
Hi, The Text property of the control, and of its model, contains the text typed by the user in that control, not the text displayed, and not a rendering of the value in the control. To get the displayed text, get the peer of the _view_ of the control. Something like: model = document.getDrawPage().getForms().getByIndex(0).getByName("Time Field 1") view = document.getCurrentController() cntrl = view.getControl(model) peer = cntrl.getPeer() Then examine peer.Text On Tue, Mar 03, 2020 at 03:17:35PM +0100, Xisco Fauli wrote: > Hello, > > I would like to create a unittest for tdf#130515 [1] which was recently > fixed by Noel. > > The problem was that the displayed string in the form was '12:12' > instead of '12:12:00PM' when the time format was set to 'HH:MM:SS PM'. > > Is there any way to check the resulting string in a unittest? > > I tried with document.getDrawPage()[0].TextRange.String but it returns > "". OTOH, document.getDrawPage()[0].Control.Text return 12:12, which > doesn't get the format applied. > > I couldn't find any existing test checking this either. > > Thanks in advance > > [1] https://bugs.documentfoundation.org/show_bug.cgi?id=130515 > ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: Unittest for tdf#130515
unsubscribe libreoffice-dev On Tue, Mar 3, 2020 at 8:18 PM Xisco Fauli wrote: > > Hi, > > it works like a charm. Thanks > > On 3/3/20 17:15, Lionel Élie Mamane wrote: > > Hi, > > > > The Text property of the control, and of its model, contains the text > > typed by the user in that control, not the text displayed, and not a > > rendering of the value in the control. > > > > To get the displayed text, get the peer of the _view_ of the control. > > > > Something like: > > > > model = document.getDrawPage().getForms().getByIndex(0).getByName("Time > > Field 1") > > view = document.getCurrentController() > > cntrl = view.getControl(model) > > peer = cntrl.getPeer() > > > > Then examine peer.Text > > > > On Tue, Mar 03, 2020 at 03:17:35PM +0100, Xisco Fauli wrote: > >> Hello, > >> > >> I would like to create a unittest for tdf#130515 [1] which was recently > >> fixed by Noel. > >> > >> The problem was that the displayed string in the form was '12:12' > >> instead of '12:12:00PM' when the time format was set to 'HH:MM:SS PM'. > >> > >> Is there any way to check the resulting string in a unittest? > >> > >> I tried with document.getDrawPage()[0].TextRange.String but it returns > >> "". OTOH, document.getDrawPage()[0].Control.Text return 12:12, which > >> doesn't get the format applied. > >> > >> I couldn't find any existing test checking this either. > >> > >> Thanks in advance > >> > >> [1] https://bugs.documentfoundation.org/show_bug.cgi?id=130515 > >> > -- > Xisco Faulí > LibreOffice QA Team > IRC: x1sc0 > > ___ > LibreOffice mailing list > LibreOffice@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/libreoffice ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: Unittest for tdf#130515
Hi, it works like a charm. Thanks On 3/3/20 17:15, Lionel Élie Mamane wrote: > Hi, > > The Text property of the control, and of its model, contains the text > typed by the user in that control, not the text displayed, and not a > rendering of the value in the control. > > To get the displayed text, get the peer of the _view_ of the control. > > Something like: > > model = document.getDrawPage().getForms().getByIndex(0).getByName("Time > Field 1") > view = document.getCurrentController() > cntrl = view.getControl(model) > peer = cntrl.getPeer() > > Then examine peer.Text > > On Tue, Mar 03, 2020 at 03:17:35PM +0100, Xisco Fauli wrote: >> Hello, >> >> I would like to create a unittest for tdf#130515 [1] which was recently >> fixed by Noel. >> >> The problem was that the displayed string in the form was '12:12' >> instead of '12:12:00PM' when the time format was set to 'HH:MM:SS PM'. >> >> Is there any way to check the resulting string in a unittest? >> >> I tried with document.getDrawPage()[0].TextRange.String but it returns >> "". OTOH, document.getDrawPage()[0].Control.Text return 12:12, which >> doesn't get the format applied. >> >> I couldn't find any existing test checking this either. >> >> Thanks in advance >> >> [1] https://bugs.documentfoundation.org/show_bug.cgi?id=130515 >> -- Xisco Faulí LibreOffice QA Team IRC: x1sc0 ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
Unittest for tdf#130515
Hello, I would like to create a unittest for tdf#130515 [1] which was recently fixed by Noel. The problem was that the displayed string in the form was '12:12' instead of '12:12:00PM' when the time format was set to 'HH:MM:SS PM'. Is there any way to check the resulting string in a unittest? I tried with document.getDrawPage()[0].TextRange.String but it returns "". OTOH, document.getDrawPage()[0].Control.Text return 12:12, which doesn't get the format applied. I couldn't find any existing test checking this either. Thanks in advance [1] https://bugs.documentfoundation.org/show_bug.cgi?id=130515 -- Xisco Faulí LibreOffice QA Team IRC: x1sc0 ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice