Commit 0a28e0f0 authored by Yann Leboulanger's avatar Yann Leboulanger

ability to run tests without gui

parent 4612ba98
......@@ -9,7 +9,8 @@ stages:
run-test:
stage: test
script:
- make test
- ./autogen.sh
- make test_nogui
run-build:
stage: build
......
......@@ -53,6 +53,10 @@ test:
python test/runtests.py
.PHONY: test
test_nogui:
python test/runtests.py -n
.PHONY: test_nogui
doc:
epydoc --config=doc/epydoc.conf
.PHONY: doc
......@@ -41,8 +41,6 @@
from common.jingle_transport import JingleTransportSocks5
from common.file_props import FilesProp
import gtkgui_helpers
if gajim.HAVE_PYOPENSSL:
import OpenSSL.crypto
......@@ -2484,8 +2482,6 @@ def handle_incoming_msg_event(self, msg_obj):
self.popup_title = _('New Message from %(nickname)s') % \
{'nickname': nick}
self.popup_image = gtkgui_helpers.get_icon_path(self.popup_image, 48)
if not gajim.config.get('notify_on_new_message') or \
not self.first_unread:
self.do_popup = False
......@@ -2541,6 +2537,29 @@ def handle_incoming_gc_msg_event(self, msg_obj):
self.do_popup = False
def get_path_to_generic_or_avatar(generic, jid=None, suffix=None):
"""
Choose between avatar image and default image
Returns full path to the avatar image if it exists, otherwise returns
full path to the image. generic must be with extension and suffix
without
"""
if jid:
# we want an avatar
puny_jid = helpers.sanitize_filename(jid)
path_to_file = os.path.join(gajim.AVATAR_PATH, puny_jid) + suffix
path_to_local_file = path_to_file + '_local'
for extension in ('.png', '.jpeg'):
path_to_local_file_full = path_to_local_file + extension
if os.path.exists(path_to_local_file_full):
return path_to_local_file_full
for extension in ('.png', '.jpeg'):
path_to_file_full = path_to_file + extension
if os.path.exists(path_to_file_full):
return path_to_file_full
return os.path.abspath(generic)
def handle_incoming_pres_event(self, pres_obj):
if gajim.jid_is_transport(pres_obj.jid):
return True
......@@ -2619,8 +2638,8 @@ def handle_incoming_pres_event(self, pres_obj):
iconset = gajim.config.get('iconset')
img_path = os.path.join(helpers.get_iconset_path(iconset),
'48x48', show_image)
self.popup_image = gtkgui_helpers.get_path_to_generic_or_avatar(
img_path, jid=self.jid, suffix=suffix)
self.popup_image_path = self.get_path_to_generic_or_avatar(img_path,
jid=self.jid, suffix=suffix)
self.popup_timeout = gajim.config.get('notification_timeout')
......@@ -2666,6 +2685,7 @@ def generate(self):
self.popup_event_type = ''
self.popup_msg_type = ''
self.popup_image = ''
self.popup_image_path = ''
self.popup_timeout = -1
self.do_command = False
......
......@@ -642,28 +642,6 @@ def make_pixbuf_grayscale(pixbuf):
pixbuf.saturate_and_pixelate(pixbuf2, 0.0, False)
return pixbuf2
def get_path_to_generic_or_avatar(generic, jid = None, suffix = None):
"""
Choose between avatar image and default image
Returns full path to the avatar image if it exists, otherwise returns full
path to the image. generic must be with extension and suffix without
"""
if jid:
# we want an avatar
puny_jid = helpers.sanitize_filename(jid)
path_to_file = os.path.join(gajim.AVATAR_PATH, puny_jid) + suffix
path_to_local_file = path_to_file + '_local'
for extension in ('.png', '.jpeg'):
path_to_local_file_full = path_to_local_file + extension
if os.path.exists(path_to_local_file_full):
return path_to_local_file_full
for extension in ('.png', '.jpeg'):
path_to_file_full = path_to_file + extension
if os.path.exists(path_to_file_full):
return path_to_file_full
return os.path.abspath(generic)
def decode_filechooser_file_paths(file_paths):
"""
Decode as UTF-8 under Windows and ask sys.getfilesystemencoding() in POSIX
......
......@@ -155,8 +155,16 @@ def __init__(self):
def _nec_notification(self, obj):
if obj.do_popup:
if obj.popup_image:
icon_path = gtkgui_helpers.get_icon_path(obj.popup_image, 48)
if icon_path:
image_path = icon_path
elif obj.popup_image_path:
image_path = obj.popup_image_path
else:
image_path = ''
popup(obj.popup_event_type, obj.jid, obj.conn.name,
obj.popup_msg_type, path_to_image=obj.popup_image,
obj.popup_msg_type, path_to_image=image_path,
title=obj.popup_title, text=obj.popup_text,
timeout=obj.popup_timeout)
......
......@@ -39,7 +39,6 @@
'unit.test_caps_cache',
'unit.test_contacts',
'unit.test_account',
'unit.test_gui_interface',
)
if use_x:
......@@ -47,6 +46,7 @@
#'integration.test_gui_event_integration',
'integration.test_roster',
'integration.test_resolver',
'unit.test_gui_interface',
)
nb_errors = 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment