After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 555368 - cannot get objectlist in next same window.
cannot get objectlist in next same window.
Status: VERIFIED FIXED
Product: LDTP
Classification: Other
Component: ldtp
1.3.0
Other Windows
: Normal normal
: ---
Assigned To: LDTP maintainers
LDTP Development Mailing List
Depends on:
Blocks:
 
 
Reported: 2008-10-07 09:49 UTC by lavi
Modified: 2008-10-24 18:02 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description lavi 2008-10-07 09:49:10 UTC
Precondition:
launch an application twice which does not have lable on it.

Steps to Reproduce:
>>> from ldtp import * 
>>> getwindowlist()    
125 ()
[u'frmwindow1', u'frm0', u'frm1']
>>> getobjectlist('frm0')
126 ('frm0')
[u'flr3', u'flr4', u'ukn0', u'ukn1', u'ukn2', u'flr0', u'frm0', u'flr1', u'flr2']
>>> getobjectlist('frm1') 
126 ('frm1')
getresponse: Window does not exist
Traceback (most recent call last):
  • File "<stdin>", line 1 in <module>
  • File "/usr/lib/python2.5/site-packages/ldtp.py", line 2934 in getobjectlist
    raise LdtpExecutionError ('getobjectlist failed: ' + _responseStatus [1])
ldtplib.ldtplibutils.LdtpExecutionError: u'getobjectlist failed: Window does not exist'
>>> getobjectlist('frm#1')
126 ('frm#1')
getresponse: Window does not exist
Traceback (most recent call last):
  • File "<stdin>", line 1 in <module>
  • File "/usr/lib/python2.5/site-packages/ldtp.py", line 2934 in getobjectlist
    raise LdtpExecutionError ('getobjectlist failed: ' + _responseStatus [1])
ldtplib.ldtplibutils.LdtpExecutionError: u'getobjectlist failed: Window does not exist'
>>> getobjectlist('frm#0') 
126 ('frm#0')
getresponse: Window does not exist
Traceback (most recent call last):
  • File "<stdin>", line 1 in <module>
  • File "/usr/lib/python2.5/site-packages/ldtp.py", line 2934 in getobjectlist
    raise LdtpExecutionError ('getobjectlist failed: ' + _responseStatus [1])
ldtplib.ldtplibutils.LdtpExecutionError: u'getobjectlist failed: Window does not exist'

Expected Result:
Get objectlist for later one.

Test Notes:
1. frm0 is the previous one that did not have label (xxx_set_name), frm1 is the later one.
2. searching widget by index seems just works within one application, isn't it?
3. From the log by ldtp, it search frm1 on next application which it reported it's a frm0.
4. Here I have one question, why did ldtp not search hash table first instead of searching all existed applications which it have got by getwindowlist previously?
Comment 1 Nagappan Alagappan 2008-10-07 18:17:37 UTC
frm#0 and frm#1 won't work, # based index as of now works only with the objects inside a window.

Let me try reproduce getobjectlist ('frm1')
Comment 2 Nagappan Alagappan 2008-10-07 18:37:21 UTC
Yes its a bug, will work on it.
Comment 3 Nagappan Alagappan 2008-10-07 18:51:21 UTC
I'm able to reproduce the bug with Hello World test case from here http://live.gnome.org/PyGTK

Reproducible with 2 instances of the above program

#!/usr/bin/env python
import pygtk
pygtk.require('2.0')
import gtk
# Create a new window
window = gtk.Window()

# Here we connect the "delete-event" event to a signal handler.
# This event occurs when we the user closes window,
# We connect it to gtk.main_quit, so it quits the main loop
# and the program terminates
window.connect("delete-event", gtk.main_quit)

# Sets the border width of the window.
window.set_border_width(10)

# Creates a new button with the label "Hello World".
button = gtk.Button("Hello World")

# This is a callback function, which we later will connect
# to the clicked signal of the button, which will be triggered
# when the user clicks the button with a mouse.
def on_button_clicked(button):
    print "Hello World"
# When the button receives the "clicked" signal, it will call the
# function hello() defined above.
button.connect("clicked", on_button_clicked)

# This packs the button into the window (which is a container).
window.add(button)

# Show the window and the button
window.show_all()
# Run the main loop, to process events such a key presses
# and mouse movements.
gtk.main()
Comment 4 lavi 2008-10-23 12:23:22 UTC
The code you sent to is failed on operating the widget except getobjectlist.
I modified to find all frm or dlg and return it's table, but still failed on later.
 
----------------------
        // Get current window info from current hash table entry
        // Naming convention is little awkward !
        gchar *tmpfix = g_strdup (context);
        if (!g_strncasecmp(tmpfix, "frm", 3)) {
            g_free (tmpfix);
                        tmpfix = g_strdup ("frm*");
        } else if (!g_strncasecmp(context, "dlg", 3)) {
            g_free (tmpfix);
                        tmpfix = g_strdup ("dlg*");
        }
 
        cur_component = get_object_def (cur_window, tmpfix, NULL, cctxt->log_fp, TRUE);
        g_free (tmpfix);
-----------------------
The reason is if there are two windows that both donot have name, ldtp will name them as frm0, frm1. However, when try to find frm1 in both application, (yes, frm1 will be found), it will not find frm1 in 2rd application because the hashtable still contained frm0 for it.
 
From the log, I see ldtp will search application more then 3 time even successfully. I totally confused them :(
Comment 5 lavi 2008-10-24 01:43:50 UTC
$ cat 2win.py
#!/usr/bin/env python

import pygtk
pygtk.require('2.0')
import gtk

# Create a new window
window = gtk.Window()

# Here we connect the "delete-event" event to a signal handler.
# This event occurs when we the user closes window,
# We connect it to gtk.main_quit, so it quits the main loop
# and the program terminates
window.connect("delete-event", gtk.main_quit)

# Sets the border width of the window.
window.set_border_width(100)
window.set_title('frmwindow1')

# Creates a new button with the label "Hello World".
button = gtk.Button("Hello World")

# This is a callback function, which we later will connect
# to the clicked signal of the button, which will be triggered
# when the user clicks the button with a mouse.
def on_button_clicked(button):
    print "Hello World"
    test()

# When the button receives the "clicked" signal, it will call the
# function hello() defined above.
button.connect("clicked", on_button_clicked)

# This packs the button into the window (which is a container).
window.add(button)
win1 = None

def cancel_button_clicked(button):
    global win1
    print "I'm being clicked"


def test():
    global win1, cancel_button

    win1 = gtk.Window()
    button1 = gtk.Button("touch me")
    button1.connect("clicked", cancel_button_clicked)
    win1.add(button1)
    win1.set_deletable (True)
    win1.show_all()
    gtk.main()

# Show the window and the button
window.show_all()
# Run the main loop, to process events such a key presses
# and mouse movements.
gtk.main()
Comment 6 lavi 2008-10-24 05:16:45 UTC
Step to repro:
1. run first app by Nags, then run 2rd which wrote by me, click "Hello World" button on 2rd window, now you will see "touch me" button.
2. run ldtp &
3. try to run following command:
>>> from ldtp import * 
>>> getwindowlist()    
125 ()
[u'frmwindow1', u'frm0', u'frm1', ,,,]
>>> getobjectlist('frm1')
126 ('frm0')
[u'flr3', u'flr4', u'ukn0', u'ukn1', u'ukn2', u'flr0', u'frm0', u'flr1',
u'flr2']
>>> getobjectlist('frm1') 
getresponse: Window does not exist
Traceback (most recent call last):
  • File "<stdin>", line 1 in <module>
  • File "/usr/lib/python2.5/site-packages/ldtp.py", line 2934 in getobjectlist
    raise LdtpExecutionError ('getobjectlist failed: ' + _responseStatus [1])
ldtplib.ldtplibutils.LdtpExecutionError: u'getobjectlist failed: Window does
not exist'
>>> click('frm1', 'btntouchme')
getresponse: Window does not exist
Traceback (most recent call last):
  • File "<stdin>", line 1 in <module>
  • File "/usr/lib/python2.5/site-packages/ldtp.py", line 2934 in getobjectlist
    raise LdtpExecutionError ('getobjectlist failed: ' + _responseStatus [1])
ldtplib.ldtplibutils.LdtpExecutionError: u'getobjectlist failed: Window does
not exist'
Comment 7 lavi 2008-10-24 06:35:57 UTC
Bug is here:
----------------------------------------------------------------------
			for (j = 0; ; j++) {
				gchar *tmp = g_strdup_printf ("%ld", j);
				g_print ("Window name NULL, %ld %d\n", j, __LINE__);
				if (tmp) {
					tmp_window_name = get_window_name_in_appmap_format (tmp, role);
					g_free (tmp);
					tmp = NULL;
				}
				if (tmp_window_name && \
				    g_hash_table_lookup_extended (tmpTable,
								  (gconstpointer)tmp_window_name,
								  NULL, NULL) == FALSE) {
					if (j > 1 && flag)
						*flag = TRUE;
					break;
				}
			}
----------------------------------------------------------------------
Actually, line should be this:
if (j > 0 && flag)
Comment 8 lavi 2008-10-24 06:36:40 UTC
worked.
Comment 9 Nagappan Alagappan 2008-10-24 18:02:23 UTC
Fixed in my local copy as well. Thanks for identifying the issue :)