~jconti/recent-notifications/trunk

« back to all changes in this revision

Viewing changes to tests/test_icon.py

  • Committer: Jason Conti
  • Date: 2012-03-25 16:53:48 UTC
  • Revision ID: jason.conti@gmail.com-20120325165348-mbgeudufjyuqwilz
* Add additional tests to tests/test_icon.py to verify I didn't break
  anything.

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
"""
8
8
 
9
9
import gtk
 
10
import logging
10
11
import os.path
11
12
import unittest
12
13
import sys
13
14
 
 
15
logging.basicConfig(level=logging.DEBUG)
 
16
 
14
17
# Insert the recent_notifications module into the search path
15
18
app_path = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
16
19
sys.path.insert(0, app_path)
58
61
 
59
62
    self.assertTrue(icon is icon_cached)
60
63
 
 
64
  def test_load_missing_icon(self):
 
65
    size = 48
 
66
 
 
67
    icon = Icon.load_icon("x8f38s8d8fqa8d8a8af8ds8", size)
 
68
    self.assertEqual(icon, None)
 
69
 
 
70
  def test_load_missing_icon_from_file(self):
 
71
    size = 48
 
72
    icon_name = os.path.join(self.icon_path, "x8fa8amdivjhxisnfnasfijhasfkn.svg")
 
73
 
 
74
    icon = Icon.load_icon_from_file(icon_name, size)
 
75
    self.assertEqual(icon, None)
 
76
 
 
77
  def test_load_not_an_icon_from_file(self):
 
78
    size = 48
 
79
    icon_name = os.path.join(app_path, "tests", "configs", "sample")
 
80
 
 
81
    icon = Icon.load_icon_from_file(icon_name, size)
 
82
    self.assertEqual(icon, None)
61
83
 
62
84
  def test_clear_icon_cache(self):
63
85
    size = 48