# Path: pytrainer/gui/color.py
# class ColorConverter(object):
#     
#     """Converts between Pytrainer and GDK color instances.""" 
#     
#     def convert_to_gdk_color(self, color):
#         """Convert a Pytrainer color to a GDK color."""
#         color_format = "#{0:06x}".format(color.rgb_val)
#         return Gdk.color_parse(color_format)
#     
#     def convert_to_color(self, gdk_col):
#         """Convert a GDK color to a Pytrainer color."""
#         red = gdk_col.red >> 8
#         green = gdk_col.green >> 8
#         blue = gdk_col.blue >> 8
#         rgb_val = (red << 16) + (green << 8) + blue
#         return Color(rgb_val)
# 
# Path: pytrainer/util/color.py
# class Color(object):
#     
#     """A color represented as a 24-bit RGB value."""
#     
#     def __init__(self, rgb_val=0):
#         rgb_val_int = int(rgb_val)
#         if rgb_val_int < 0:
#             raise ValueError("RGB value must not be negative.")
#         if rgb_val_int > 0xffffff:
#             raise ValueError("RGB value must not be greater than 0xffffff.")
#         self._rgb_val = rgb_val_int
#         
#     def _get_rgb_val(self):
#         return self._rgb_val
#     
#     rgb_val = property(_get_rgb_val)
#         
#     def _get_rgba_val(self):
#         return self._rgb_val << 8
#     
#     rgba_val = property(_get_rgba_val)
#     
#     def to_hex_string(self):
#         return "{0:06x}".format(self._rgb_val)


from pytrainer.gui.color import ColorConverter
from pytrainer.util.color import Color
from gi.repository import Gdk
import unittest
# -*- coding: utf-8 -*-

#Copyright (C) Nathan Jones ncjones@users.sourceforge.net

#This program is free software; you can redistribute it and/or
#modify it under the terms of the GNU General Public License
#as published by the Free Software Foundation; either version 2
#of the License, or (at your option) any later version.

#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.

#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.


class ColorConverterTest(unittest.TestCase):
    
    def setUp(self):
        self._converter = ColorConverter()
    
    def test_convert_to_gdk_color_should_create_gdk_color_with_equivalent_rgb_values(self):

# Path: pytrainer/gui/color.py
# class ColorConverter(object):
#     
#     """Converts between Pytrainer and GDK color instances.""" 
#     
#     def convert_to_gdk_color(self, color):
#         """Convert a Pytrainer color to a GDK color."""
#         color_format = "#{0:06x}".format(color.rgb_val)
#         return Gdk.color_parse(color_format)
#     
#     def convert_to_color(self, gdk_col):
#         """Convert a GDK color to a Pytrainer color."""
#         red = gdk_col.red >> 8
#         green = gdk_col.green >> 8
#         blue = gdk_col.blue >> 8
#         rgb_val = (red << 16) + (green << 8) + blue
#         return Color(rgb_val)
# 
# Path: pytrainer/util/color.py
# class Color(object):
#     
#     """A color represented as a 24-bit RGB value."""
#     
#     def __init__(self, rgb_val=0):
#         rgb_val_int = int(rgb_val)
#         if rgb_val_int < 0:
#             raise ValueError("RGB value must not be negative.")
#         if rgb_val_int > 0xffffff:
#             raise ValueError("RGB value must not be greater than 0xffffff.")
#         self._rgb_val = rgb_val_int
#         
#     def _get_rgb_val(self):
#         return self._rgb_val
#     
#     rgb_val = property(_get_rgb_val)
#         
#     def _get_rgba_val(self):
#         return self._rgb_val << 8
#     
#     rgba_val = property(_get_rgba_val)
#     
#     def to_hex_string(self):
#         return "{0:06x}".format(self._rgb_val)


# Path: pytrainer/test/gui/test_color.py
from pytrainer.gui.color import ColorConverter
from pytrainer.util.color import Color
from gi.repository import Gdk
import unittest

# -*- coding: utf-8 -*-

#Copyright (C) Nathan Jones ncjones@users.sourceforge.net

#This program is free software; you can redistribute it and/or
#modify it under the terms of the GNU General Public License
#as published by the Free Software Foundation; either version 2
#of the License, or (at your option) any later version.

#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.

#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.


class ColorConverterTest(unittest.TestCase):
    
    def setUp(self):
        self._converter = ColorConverter()
    
    def test_convert_to_gdk_color_should_create_gdk_color_with_equivalent_rgb_values(self):

        color = Color(0xaaff33)