summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Endrodi <ext-adam.endrodi@nokia.com>2010-12-02 14:10:08 +0200
committerAdam Endrodi <ext-adam.endrodi@nokia.com>2010-12-02 17:19:16 +0200
commit78e0faae00587efa0a247f3de706772d9facfa8f (patch)
tree145e2eb60a6fb1297fee387aad7aa9786dbe7c18
parentc6f48ab7299fc304f670234598fe361f326c3199 (diff)
make test13.py and test14.py pass
They relied on hardcoded display resolution. * tests/windowctl/windowctl.cpp: Added the 'D' command to obtain the current display resolution. * tests/functional/test13.py * tests/functional/test14.py: Use it.
-rwxr-xr-xtests/functional/test13.py3
-rwxr-xr-xtests/functional/test14.py2
-rw-r--r--tests/windowctl/windowctl.cpp14
3 files changed, 14 insertions, 5 deletions
diff --git a/tests/functional/test13.py b/tests/functional/test13.py
index 47ed3f4..8df09bc 100755
--- a/tests/functional/test13.py
+++ b/tests/functional/test13.py
@@ -25,7 +25,8 @@ def get_window_size(w):
break
return ret
-(fs_w, fs_h) = (864, 480)
+(fs_w, fs_h) = [ int(x) for x in os.popen("windowctl D").readline().split() ]
+
# map non-fullscreen application window
fd = os.popen('windowctl n')
diff --git a/tests/functional/test14.py b/tests/functional/test14.py
index b772a86..cc35dd5 100755
--- a/tests/functional/test14.py
+++ b/tests/functional/test14.py
@@ -26,7 +26,7 @@ def get_window_size(w):
break
return ret
-(fs_w, fs_h) = (864, 480)
+(fs_w, fs_h) = [ int(x) for x in os.popen("windowctl D").readline().split() ]
# map fullscreen application window
fd = os.popen('windowctl fn')
diff --git a/tests/windowctl/windowctl.cpp b/tests/windowctl/windowctl.cpp
index 6ddb5c6..325c8be 100644
--- a/tests/windowctl/windowctl.cpp
+++ b/tests/windowctl/windowctl.cpp
@@ -22,8 +22,7 @@
#include <signal.h>
#include <sys/prctl.h>
-#define WIN_W 864
-#define WIN_H 480
+static int WIN_W, WIN_H;
static Atom win_type_atom, trans_for_atom, workarea_atom;
static int xerror_happened;
@@ -411,7 +410,9 @@ static void print_usage_and_exit(QString& stdOut)
"X - set _MEEGOTOUCH_MSTATUSBAR_GEOMETRY of window <XID> to (x y w h)\n"
"Usage 9: " PROG " CM <XID> <ClientMessage type name> <window>\n"
"CM - send a ClientMessage (where window=<window>) to window <XID> "
- "(0 = the root window)\n"
+ "(0 assumed that = the root window)\n"
+ "Usage 10: " PROG " D\n"
+ "D - print the display resolution\n"
;
}
@@ -657,6 +658,9 @@ static bool old_main(QStringList& args, QString& stdOut)
/* catch X errors */
XSetErrorHandler (error_handler);
+ WIN_W = DisplayWidth(dpy, DefaultScreen(dpy));
+ WIN_H = DisplayHeight(dpy, DefaultScreen(dpy));
+
win_type_atom = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False);
/*trans_for_atom = XInternAtom(dpy, "WM_TRANSIENT_FOR", False);*/
workarea_atom = XInternAtom(dpy, "_NET_WORKAREA", False);
@@ -859,6 +863,10 @@ static bool old_main(QStringList& args, QString& stdOut)
XSync(dpy, False);
return true;
}
+ if (*p == 'D') {
+ printf("%u %u\n", WIN_W, WIN_H);
+ return true;
+ }
if ((command = strchr("NUFCMTAWHSO", *p))) {
if (args.count() != 2) {
print_usage_and_exit(stdOut);