[gnome-mag/bonobo-less] [test/dbus-mag-test.py]: Fix test



commit 9627c9673411ffc389fec0c37c089fd8431c81c8
Author: Fernando Herrera <fherrera onirica com>
Date:   Thu Aug 5 03:14:30 2010 +0200

    [test/dbus-mag-test.py]: Fix test

 test/dbus-mag-test.py |   81 ++++++++++++++++++++++++++++---------------------
 1 files changed, 46 insertions(+), 35 deletions(-)
---
diff --git a/test/dbus-mag-test.py b/test/dbus-mag-test.py
index 9a79bdb..4a87d26 100755
--- a/test/dbus-mag-test.py
+++ b/test/dbus-mag-test.py
@@ -31,17 +31,18 @@ _magProxy = bus.get_object('org.gnome.Magnifier', '/org/gnome/Magnifier')
 magProxy =  dbus.Interface(_magProxy, "org.gnome.Magnifier")
 print magProxy;
 
+## This setActive() does not work yet in gnome-mag
 # Turn magnification on/off
-print "Turning magnification on..."
-magProxy.setActive(True);
-activeStr = "false";
-if magProxy.isActive() : activeStr = "true";
-print "Magnifier is ", activeStr;
-response = raw_input("Press return to continue ...");
-
-magProxy.setActive(False);
-print "... magnification should now be off"
-print "";
+#print "Turning magnification on..."
+#magProxy.setActive(True);
+#activeStr = "false";
+#if magProxy.isActive() : activeStr = "true";
+#print "Magnifier is ", activeStr;
+#response = raw_input("Press return to continue ...");
+#
+#magProxy.setActive(False);
+#print "... magnification should now be off"
+#print "";
 
 # Turn showing/hiding system mouse
 print "Hiding the system mouse cursor."
@@ -65,10 +66,10 @@ magProps.Set('org.gnome.Magnifier', 'TargetSize', [x, y, width - x, height])
 
 # Create a region
 roi = [0, 0, 300, 300];
-position = [300, 300, 600, 600];
+position = [0, 0, 600, 600];
 
 print "Creating a zoom region of ", roi, ", and at ", position
-zoomRegionPath = magProxy.createZoomRegion (4, 4, roi, position);
+zoomRegionPath = magProxy.createZoomRegion (2, 2, roi, position);
 print zoomRegionPath;
 
 print "Adding zoom region to magnifier ...";
@@ -78,24 +79,32 @@ if added == 1:
 else:
     print "FAILED TO ADD";
 print "";
+response = raw_input("Press return to continue ...");
 
-roi = [200, 100, 300, 200];
+roi = [0, 400, 100, 450];
 position = [800, 800, 1000, 900];
 print "Creating another zoom region of ", roi, " , and at ", position
-zoomRegionPath = magProxy.createZoomRegion (2.5, 2.5, roi, position);
-magProxy.addZoomRegion(zoomRegionPath);
+zoomRegionPath = magProxy.createZoomRegion (2, 2, roi, position);
+added = magProxy.addZoomRegion(zoomRegionPath);
+if added == 1:
+    print "ADDED";
+else:
+    print "FAILED TO ADD";
+print "";
 
-print "Turning on the magnifier (and the zoom regions?)";
-magProxy.setActive(True);
 response = raw_input("Press return to continue ...");
 
+#print "Turning on the magnifier (and the zoom regions?)";
+#magProxy.setActive(True);
+#response = raw_input("Press return to continue ...");
+
 print "Getting ZoomRegionInstance";
 #zoomRegionProxy = bus.get_object('org.freedesktop.Magnifier', zoomRegionPath);
 _zoomRegionProxy = bus.get_object('org.gnome.Magnifier', zoomRegionPath);
 zoomRegionProxy = dbus.Interface(_zoomRegionProxy, "org.gnome.Magnifier.ZoomRegion")
 print zoomRegionProxy;
 magFactor = zoomRegionProxy.getMagFactor();
-print "Mag factor of zoomRegionProxy is ", magFactor;
+print "Mag factor of zoomRegionProxy is ", magFactor[0];
 print "";
 response = raw_input("Press return to continue ...");
 
@@ -108,7 +117,7 @@ print "Getting the first ZoomRegionInstance (", zoomRegions[0], ")";
 _zoomRegionProxy = bus.get_object('org.gnome.Magnifier', zoomRegions[0]);
 zoomRegionProxy = dbus.Interface(_zoomRegionProxy, "org.gnome.Magnifier.ZoomRegion")
 print zoomRegionProxy;
-print "mag factor of first zoom region is: '", zoomRegionProxy.getMagFactor(), "'";
+print "mag factor of first zoom region is: '", zoomRegionProxy.getMagFactor()[0], "'";
 response = raw_input("Press return to continue ...");
 
 print "Removing all ZoomRegions";
@@ -117,7 +126,9 @@ print "";
 response = raw_input("Press return to continue ...");
 
 print "Creating a new ZoomRegion and adding it to the magnifier";
-zoomRegionPath = magProxy.createZoomRegion (4, 4, roi, position);
+roi = [0, 0, 300, 300];
+position = [0, 0, 600, 600];
+zoomRegionPath = magProxy.createZoomRegion (2, 2, roi, position);
 print zoomRegionPath;
 added = magProxy.addZoomRegion(zoomRegionPath);
 if added == 1:
@@ -156,7 +167,7 @@ print "";
 response = raw_input("Press return to continue ...");
 print "Shifting contents to (300, 700)";
 zoomRegionProxy.setMagFactor(5, 5);
-zoomRegionProxy.shiftContentsTo(300, 700);
+zoomRegionProxy.moveResize([0, 0, 300, 700] );
 outRoi = zoomRegionProxy.getRoi();
 print "ROI is ", outRoi;
 x = outRoi[0];
@@ -169,42 +180,42 @@ response = raw_input(">>> MOVE MOUSE TO SEE CROSSHAIRS, THEN PRESS RETURN TO CON
 
 # Manipulate cross hairs via DBus
 print "Setting crosshairs width to 30"
-magProxy.setCrosswireSize(30);
-scratch = magProxy.getCrosswireSize();
+magProps.Set('org.gnome.Magnifier', 'CrosswireSize', 30)
+scratch = magProps.Get('org.gnome.Magnifier', 'CrosswireSize')
 print "Reported size is ", scratch;
 response = raw_input("Press return to continue ...");
 
 print "Setting crosshairs length to 100"
-magProxy.setCrosswireLength(100);
-scratch = magProxy.getCrosswireLength();
+magProps.Set('org.gnome.Magnifier', 'CrosswireLength', 100)
+scratch = magProps.Get('org.gnome.Magnifier', 'CrosswireLength')
 print "Reported length is ", scratch;
 response = raw_input("Press return to continue ...");
 
 print "Setting crosshairs colour to magenta"
-oldColor = magProxy.getCrosswireColor();
+oldColor = magProps.Get('org.gnome.Magnifier', 'CrosswireColor')
 print "Old colour is ", hex(oldColor);
-magProxy.setCrosswireColor(0xff00ffff);
-scratch = magProxy.getCrosswireColor();
+magProps.Set('org.gnome.Magnifier', 'CrosswireColor', dbus.UInt32(0xff00ffff))
+scratch = magProps.Get('org.gnome.Magnifier', 'CrosswireColor')
 print "Reported colour is ", hex(scratch);
 response = raw_input("Press return to continue ...");
 
 print "Setting crosshairs colour to blue"
-magProxy.setCrosswireColor(0x0000ffff);
-scratch = magProxy.getCrosswireColor();
+magProps.Set('org.gnome.Magnifier', 'CrosswireColor', dbus.UInt32(0x0000ffff))
+scratch = magProps.Get('org.gnome.Magnifier', 'CrosswireColor')
 print "Reported colour is ", hex(scratch);
 response = raw_input("Press return to continue ...");
 
 print "Resetting colour..."
-magProxy.setCrosswireColor(oldColor);
+magProps.Set('org.gnome.Magnifier', 'CrosswireColor', oldColor)
 
 print "Clipping crosshairs"
-magProxy.setCrosswireClip(True);
-scratch = magProxy.getCrosswireClip();
+magProps.Set('org.gnome.Magnifier', 'CrosswireClip', True)
+scratch = magProps.Get('org.gnome.Magnifier', 'CrosswireClip')
 print "Reported clip is ", scratch;
 response = raw_input("Press return to continue ...");
 print "Turning clip off"
-magProxy.setCrosswireClip(False);
-scratch = magProxy.getCrosswireClip();
+magProps.Set('org.gnome.Magnifier', 'CrosswireClip', False)
+scratch = magProps.Get('org.gnome.Magnifier', 'CrosswireClip')
 print "Reported clip is ", scratch;
 response = raw_input("Press return to continue ...");
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]