openlp/theme/test_theme.py

44 lines
1.3 KiB
Python

from theme import Theme
import wx
import os.path
def test_read_theme():
dir=os.path.split(__file__)[0]
# test we can read a theme
t=Theme(os.path.join(dir, "testtheme.xml"))
print t
assert(t.BackgroundParameter1 == "sunset1.jpg")
assert(t.BackgroundParameter2 == None)
assert(t.BackgroundParameter3 == None)
assert(t.BackgroundType == 2)
assert(t.FontColor == wx.Colour(255,255,255))
assert(t.FontName == "Tahoma")
assert(t.FontProportion == 16)
assert(t.HorizontalAlign == 2)
assert(t.Name == "openlp.org Packaged Theme")
assert(t.Outline == -1)
assert(t.OutlineColor == wx.Colour(255,0,0))
assert(t.Shadow == -1)
assert(t.ShadowColor == wx.Colour(0,0,1))
assert(t.VerticalAlign == 0)
# test we create a "blank" theme correctly
t=Theme()
print t
assert(t.BackgroundParameter1 == wx.Colour(0,0,0))
assert(t.BackgroundParameter2 == None)
assert(t.BackgroundParameter3 == None)
assert(t.BackgroundType == 0)
assert(t.FontColor == wx.Colour(255,255,255))
assert(t.FontName == "Arial")
assert(t.FontProportion == 30)
assert(t.HorizontalAlign == 0)
assert(t.Name == "BlankStyle")
assert(t.Outline == 0)
assert(t.Shadow == 0)
assert(t.VerticalAlign == 0)
print "Tests passed"
if __name__=="__main__":
test_read_theme()