summaryrefslogtreecommitdiff
path: root/CompizTests.py
diff options
context:
space:
mode:
Diffstat (limited to 'CompizTests.py')
-rw-r--r--CompizTests.py52
1 files changed, 29 insertions, 23 deletions
diff --git a/CompizTests.py b/CompizTests.py
index 7ce1e28..ed4dc1b 100644
--- a/CompizTests.py
+++ b/CompizTests.py
@@ -16,30 +16,27 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
#
-# Author: Kristian F. Erikson <kristian@erikson.dk>
+# Author: Kristian F. Erikson <kristian.erikson@eyemagnet.com>
#
import unittest
-from CompizManager import CompizManager
from CompizError import *
from CompizTools import *
+import CompizManager
import time
-
def preTestSetup():
- global manager, waterWasActive, placeWasActive, rotateWasActive
- global zoomWasActive, updateNecessary
-
- manager = CompizManager()
+ global manager, waterWasActive, placeWasActive, rotateWasActive, blurWasActive, updateNecessary
+ manager = CompizManager.CompizManager()
waterPlugin = manager.getPlugin('water') # These plugins must be active: water, place, rotate, core is assumed
placePlugin = manager.getPlugin('place')
rotatePlugin = manager.getPlugin('rotate')
- zoomPlugin = manager.getPlugin('zoom') # This plugin must be inactive: zoom
+ blurPlugin = manager.getPlugin('blur') # This plugin must be inactive: blur - change as not everyone has this plugin!
# Save states so we can set them back later
waterWasActive = waterPlugin.active
placeWasActive = placePlugin.active
rotateWasActive = rotatePlugin.active
- zoomWasActive = zoomPlugin.active
+ blurWasActive = blurPlugin.active
# Ensure states are correct for testing
activePluginsList = manager.listActivePlugins()
updateNecessary = False
@@ -52,8 +49,8 @@ def preTestSetup():
if not rotateWasActive:
activePluginsList.append('rotate')
updateNecessary = True
- if zoomWasActive:
- activePluginsList.remove('zoom')
+ if blurWasActive:
+ activePluginsList.remove('blur')
updateNecessary = True
if updateNecessary:
manager.setActivePluginList(activePluginsList)
@@ -61,17 +58,18 @@ def preTestSetup():
waterPlugin.update()
placePlugin.update()
rotatePlugin.update()
- zoomPlugin.update()
+ blurPlugin.update()
def postTestCleanup():
+ global updateNecessary
# Set plugin states back to what they were
if updateNecessary:
activePluginsList = manager.listActivePlugins()
if not waterWasActive: activePluginsList.remove('water')
if not placeWasActive: activePluginsList.remove('place')
if not rotateWasActive: activePluginsList.remove('rotate')
- if zoomWasActive: activePluginsList.append('zoom')
+ if blurWasActive: activePluginsList.append('blur')
manager.setActivePluginList(activePluginsList)
@@ -125,9 +123,9 @@ class TestCompizManagerClasses(unittest.TestCase):
"Test exceptions are raised if plugins given incorrect type arguments on calling actions."
# Assuming firepaint plugin is active
rotatePlugin = manager.getPlugin('rotate')
- self.assertRaises(CompizPluginWindowNotFoundError, rotatePlugin.doAction, "rotate_window", {'window':'400','face':'200'}) # should be str + int
- self.assertRaises(CompizPluginTypeArgError, rotatePlugin.doAction, "rotate_window", {'window':400,'face':200})
- self.assertRaises(CompizPluginTypeArgError, rotatePlugin.doAction, "rotate_window", {'window':40.0,'face':20.0})
+ self.assertRaises(CompizPluginWindowNotFoundError, rotatePlugin.doAction, "rotate_window", {'windowtitle':'400','face':'200'}) # should be str + int
+ self.assertRaises(CompizPluginTypeArgError, rotatePlugin.doAction, "rotate_window", {'windowtitle':400,'face':200})
+ self.assertRaises(CompizPluginTypeArgError, rotatePlugin.doAction, "rotate_window", {'windowtitle':40.0,'face':20.0})
def testPluginSetOption(self):
"Test the plugin can have their options changed."
@@ -154,17 +152,17 @@ class TestCompizManagerClasses(unittest.TestCase):
def testPluginActionOnInactivePlugin(self):
"Test plugins raise an exceptions if they are inactive and user attempts to use them"
# Assuming benchmark plugin is inactive
- zoomPlugin = manager.getPlugin('zoom')
- self.assertRaises(CompizPluginNotActiveError, zoomPlugin.getOption, "johndoe")
- self.assertRaises(CompizPluginNotActiveError, zoomPlugin.setOption, "johndoe", 250.0)
- self.assertRaises(CompizPluginNotActiveError, zoomPlugin.doAction, "dummy-action")
+ blurPlugin = manager.getPlugin('blur')
+ self.assertRaises(CompizPluginNotActiveError, blurPlugin.getOption, "johndoe")
+ self.assertRaises(CompizPluginNotActiveError, blurPlugin.setOption, "johndoe", 250.0)
+ self.assertRaises(CompizPluginNotActiveError, blurPlugin.doAction, "dummy-action")
def testPluginSetOptionWithLists(self):
- "Test chainging plugin options with lists."
+ "Test changing plugin options with lists."
# First try lists of ints
placePlugin = manager.getPlugin('place')
oldViewportValues = placePlugin.getOption('viewport_x_values')
- placePlugin.setOption('viewport_x_values', [2,2,2])
+ placePlugin.setOption('viewport_x_values', [1,1,1])
newViewportValues = placePlugin.getOption('viewport_x_values')
self.assert_(oldViewportValues != newViewportValues) # Assert the two list are not the same
placePlugin.setOption('viewport_x_values', oldViewportValues)
@@ -206,4 +204,12 @@ class TestCompizManagerClasses(unittest.TestCase):
converted = convertFromDbusToPython(convertsTo) # Now convert the other way
self.assertEquals(convertsTo, converted) # Assert they are the same now
-
+ def testGetListActiveWindow(self):
+ "Test listing active windows and check list looks resonable"
+ windowList = manager.listWindows()
+ for window in windowList:
+ tempTitle = window['title']
+ tempId = window['id']
+ self.assertEquals(type(tempTitle), type(u'hello'))
+ self.assertEquals(type(tempId), type(1))
+