Exemplo n.º 1
0
    def set_brightness_fixture_(self, request):
        mapping = {
            '0 to 0': (an_srgbClr, None, None, 0, None, None),
            '0 to -0.4': (an_hslClr, None, None, -0.4, 60000, None),
            '0.15 to 0.25': (a_prstClr, 85000, 15000, 0.25, 75000, 25000),
            '0.15 to -0.15': (a_schemeClr, 85000, 15000, -0.15, 85000, None),
            '-0.25 to 0.4': (an_scrgbClr, 75000, None, 0.4, 60000, 40000),
            '-0.3 to -0.4': (an_srgbClr, 70000, None, -0.4, 60000, None),
            '-0.4 to 0': (a_sysClr, 60000, None, 0, None, None),
        }
        xClr_bldr_fn, mod_in, off_in, brightness, mod_out, off_out = (
            mapping[request.param])

        xClr_bldr = xClr_bldr_fn()
        if mod_in is not None:
            xClr_bldr.with_child(a_lumMod().with_val(mod_in))
        if off_in is not None:
            xClr_bldr.with_child(a_lumOff().with_val(off_in))
        solidFill = (
            a_solidFill().with_nsdecls().with_child(xClr_bldr).element)
        color_format = ColorFormat.from_colorchoice_parent(solidFill)

        xClr_bldr = xClr_bldr_fn()
        if mod_out is not None:
            xClr_bldr.with_child(a_lumMod().with_val(mod_out))
        if off_out is not None:
            xClr_bldr.with_child(a_lumOff().with_val(off_out))
        expected_xml = (
            a_solidFill().with_nsdecls().with_child(xClr_bldr).xml())

        return color_format, brightness, expected_xml
Exemplo n.º 2
0
    def set_brightness_fixture_(self, request):
        mapping = {
            '0 to 0':        (an_srgbClr,  None,  None,   0,    None,  None),
            '0 to -0.4':     (an_hslClr,   None,  None,  -0.4,  60000, None),
            '0.15 to 0.25':  (a_prstClr,   85000, 15000,  0.25, 75000, 25000),
            '0.15 to -0.15': (a_schemeClr, 85000, 15000, -0.15, 85000, None),
            '-0.25 to 0.4':  (an_scrgbClr, 75000, None,   0.4,  60000, 40000),
            '-0.3 to -0.4':  (an_srgbClr,  70000, None,  -0.4,  60000, None),
            '-0.4 to 0':     (a_sysClr,    60000, None,   0,    None,  None),
        }
        xClr_bldr_fn, mod_in, off_in, brightness, mod_out, off_out = (
            mapping[request.param]
        )

        xClr_bldr = xClr_bldr_fn()
        if mod_in is not None:
            xClr_bldr.with_child(a_lumMod().with_val(mod_in))
        if off_in is not None:
            xClr_bldr.with_child(a_lumOff().with_val(off_in))
        solidFill = (
            a_solidFill().with_nsdecls().with_child(xClr_bldr).element
        )
        color_format = ColorFormat.from_colorchoice_parent(solidFill)

        xClr_bldr = xClr_bldr_fn()
        if mod_out is not None:
            xClr_bldr.with_child(a_lumMod().with_val(mod_out))
        if off_out is not None:
            xClr_bldr.with_child(a_lumOff().with_val(off_out))
        expected_xml = (
            a_solidFill().with_nsdecls().with_child(xClr_bldr).xml()
        )

        return color_format, brightness, expected_xml
Exemplo n.º 3
0
 def rgb_color_format(self):
     srgbClr_bldr = an_srgbClr().with_val('123456')
     solidFill = (
         a_solidFill().with_nsdecls().with_child(srgbClr_bldr).element
     )
     color_format = ColorFormat.from_colorchoice_parent(solidFill)
     return color_format
Exemplo n.º 4
0
 def rgb_raise_fixture_(self, request):
     mapping = {
         'none':   (None,        AttributeError),
         'hsl':    (an_hslClr,   AttributeError),
         'prst':   (a_prstClr,   AttributeError),
         'scheme': (a_schemeClr, AttributeError),
         'scrgb':  (an_scrgbClr, AttributeError),
         'sys':    (a_sysClr,    AttributeError),
     }
     xClr_bldr_fn, exception_type = mapping[request.param]
     solidFill_bldr = a_solidFill().with_nsdecls()
     if xClr_bldr_fn is not None:
         solidFill_bldr.with_child(xClr_bldr_fn())
     solidFill = solidFill_bldr.element
     color_format = ColorFormat.from_colorchoice_parent(solidFill)
     return color_format, exception_type
Exemplo n.º 5
0
 def rgb_raise_fixture_(self, request):
     mapping = {
         'none': (None, AttributeError),
         'hsl': (an_hslClr, AttributeError),
         'prst': (a_prstClr, AttributeError),
         'scheme': (a_schemeClr, AttributeError),
         'scrgb': (an_scrgbClr, AttributeError),
         'sys': (a_sysClr, AttributeError),
     }
     xClr_bldr_fn, exception_type = mapping[request.param]
     solidFill_bldr = a_solidFill().with_nsdecls()
     if xClr_bldr_fn is not None:
         solidFill_bldr.with_child(xClr_bldr_fn())
     solidFill = solidFill_bldr.element
     color_format = ColorFormat.from_colorchoice_parent(solidFill)
     return color_format, exception_type
Exemplo n.º 6
0
 def get_theme_color_fixture_(self, request):
     mapping = {
         "hsl": (an_hslClr, MSO_THEME_COLOR.NOT_THEME_COLOR),
         "prst": (a_prstClr, MSO_THEME_COLOR.NOT_THEME_COLOR),
         "scheme": (a_schemeClr, MSO_THEME_COLOR.ACCENT_1),
         "scrgb": (an_scrgbClr, MSO_THEME_COLOR.NOT_THEME_COLOR),
         "srgb": (an_srgbClr, MSO_THEME_COLOR.NOT_THEME_COLOR),
         "sys": (a_sysClr, MSO_THEME_COLOR.NOT_THEME_COLOR),
     }
     xClr_bldr_fn, theme_color = mapping[request.param]
     xClr_bldr = xClr_bldr_fn()
     if theme_color != MSO_THEME_COLOR.NOT_THEME_COLOR:
         xClr_bldr.with_val("accent1")
     solidFill = a_solidFill().with_nsdecls().with_child(xClr_bldr).element
     color_format = ColorFormat.from_colorchoice_parent(solidFill)
     return color_format, theme_color
Exemplo n.º 7
0
 def color_type_fixture_(self, request):
     mapping = {
         'none': (None, None),
         'hsl': (an_hslClr, MSO_COLOR_TYPE.HSL),
         'prst': (a_prstClr, MSO_COLOR_TYPE.PRESET),
         'srgb': (an_srgbClr, MSO_COLOR_TYPE.RGB),
         'scheme': (a_schemeClr, MSO_COLOR_TYPE.SCHEME),
         'scrgb': (an_scrgbClr, MSO_COLOR_TYPE.SCRGB),
         'sys': (a_sysClr, MSO_COLOR_TYPE.SYSTEM),
     }
     xClr_bldr_fn, color_type = mapping[request.param]
     solidFill_bldr = a_solidFill().with_nsdecls()
     if xClr_bldr_fn is not None:
         solidFill_bldr.with_child(xClr_bldr_fn())
     solidFill = solidFill_bldr.element
     color_format = ColorFormat.from_colorchoice_parent(solidFill)
     return color_format, color_type
Exemplo n.º 8
0
 def color_type_fixture_(self, request):
     mapping = {
         'none':   (None,        None),
         'hsl':    (an_hslClr,   MSO_COLOR_TYPE.HSL),
         'prst':   (a_prstClr,   MSO_COLOR_TYPE.PRESET),
         'srgb':   (an_srgbClr,  MSO_COLOR_TYPE.RGB),
         'scheme': (a_schemeClr, MSO_COLOR_TYPE.SCHEME),
         'scrgb':  (an_scrgbClr, MSO_COLOR_TYPE.SCRGB),
         'sys':    (a_sysClr,    MSO_COLOR_TYPE.SYSTEM),
     }
     xClr_bldr_fn, color_type = mapping[request.param]
     solidFill_bldr = a_solidFill().with_nsdecls()
     if xClr_bldr_fn is not None:
         solidFill_bldr.with_child(xClr_bldr_fn())
     solidFill = solidFill_bldr.element
     color_format = ColorFormat.from_colorchoice_parent(solidFill)
     return color_format, color_type
Exemplo n.º 9
0
 def color_format_with_brightness(self, request):
     mapping = {
         "hsl": (an_hslClr, 55000, 45000, 0.45),
         "prst": (a_prstClr, None, None, 0.0),
         "scheme": (a_schemeClr, 15000, None, -0.85),
         "scrgb": (an_scrgbClr, 15000, 85000, 0.85),
         "srgb": (an_srgbClr, None, None, 0.0),
         "sys": (a_sysClr, 23000, None, -0.77),
     }
     xClr_bldr_fn, lumMod, lumOff, exp_brightness = mapping[request.param]
     xClr_bldr = xClr_bldr_fn()
     if lumMod is not None:
         xClr_bldr.with_child(a_lumMod().with_val(lumMod))
     if lumOff is not None:
         xClr_bldr.with_child(a_lumOff().with_val(lumOff))
     solidFill = a_solidFill().with_nsdecls().with_child(xClr_bldr).element
     color_format = ColorFormat.from_colorchoice_parent(solidFill)
     return color_format, exp_brightness
Exemplo n.º 10
0
 def set_rgb_fixture_(self, request):
     mapping = {
         'none': None,
         'hsl': an_hslClr,
         'prst': a_prstClr,
         'scheme': a_schemeClr,
         'scrgb': an_scrgbClr,
         'srgb': an_srgbClr,
         'sys': a_sysClr,
     }
     xClr_bldr_fn = mapping[request.param]
     solidFill_bldr = a_solidFill().with_nsdecls()
     if xClr_bldr_fn is not None:
         solidFill_bldr.with_child(xClr_bldr_fn())
     solidFill = solidFill_bldr.element
     color_format = ColorFormat.from_colorchoice_parent(solidFill)
     rgb_color = RGBColor(0x12, 0x34, 0x56)
     expected_xml = (a_solidFill().with_nsdecls().with_child(
         an_srgbClr().with_val('123456')).xml())
     return color_format, rgb_color, expected_xml
Exemplo n.º 11
0
 def set_theme_color_fixture_(self, request):
     mapping = {
         'none': None,
         'hsl': an_hslClr,
         'prst': a_prstClr,
         'scheme': a_schemeClr,
         'scrgb': an_scrgbClr,
         'srgb': an_srgbClr,
         'sys': a_sysClr,
     }
     xClr_bldr_fn = mapping[request.param]
     solidFill_bldr = a_solidFill().with_nsdecls()
     if xClr_bldr_fn is not None:
         solidFill_bldr.with_child(xClr_bldr_fn())
     solidFill = solidFill_bldr.element
     color_format = ColorFormat.from_colorchoice_parent(solidFill)
     theme_color = MSO_THEME_COLOR.ACCENT_6
     expected_xml = (a_solidFill().with_nsdecls().with_child(
         a_schemeClr().with_val('accent6')).xml())
     return color_format, theme_color, expected_xml
Exemplo n.º 12
0
 def set_rgb_fixture_(self, request):
     mapping = {
         'none':   None,
         'hsl':    an_hslClr,
         'prst':   a_prstClr,
         'scheme': a_schemeClr,
         'scrgb':  an_scrgbClr,
         'srgb':   an_srgbClr,
         'sys':    a_sysClr,
     }
     xClr_bldr_fn = mapping[request.param]
     solidFill_bldr = a_solidFill().with_nsdecls()
     if xClr_bldr_fn is not None:
         solidFill_bldr.with_child(xClr_bldr_fn())
     solidFill = solidFill_bldr.element
     color_format = ColorFormat.from_colorchoice_parent(solidFill)
     rgb_color = RGBColor(0x12, 0x34, 0x56)
     expected_xml = (
         a_solidFill()
         .with_nsdecls()
         .with_child(an_srgbClr().with_val('123456'))
         .xml()
     )
     return color_format, rgb_color, expected_xml
Exemplo n.º 13
0
 def set_theme_color_fixture_(self, request):
     mapping = {
         'none':   None,
         'hsl':    an_hslClr,
         'prst':   a_prstClr,
         'scheme': a_schemeClr,
         'scrgb':  an_scrgbClr,
         'srgb':   an_srgbClr,
         'sys':    a_sysClr,
     }
     xClr_bldr_fn = mapping[request.param]
     solidFill_bldr = a_solidFill().with_nsdecls()
     if xClr_bldr_fn is not None:
         solidFill_bldr.with_child(xClr_bldr_fn())
     solidFill = solidFill_bldr.element
     color_format = ColorFormat.from_colorchoice_parent(solidFill)
     theme_color = MSO_THEME_COLOR.ACCENT_6
     expected_xml = (
         a_solidFill()
         .with_nsdecls()
         .with_child(a_schemeClr().with_val('accent6'))
         .xml()
     )
     return color_format, theme_color, expected_xml
Exemplo n.º 14
0
 def back_color(self):
     """Return |ColorFormat| object that controls background color."""
     bgClr = self._pattFill.get_or_add_bgClr()
     return ColorFormat.from_colorchoice_parent(bgClr)
Exemplo n.º 15
0
 def fore_color(self):
     """Return |ColorFormat| object that controls foreground color."""
     fgClr = self._pattFill.get_or_add_fgClr()
     return ColorFormat.from_colorchoice_parent(fgClr)
Exemplo n.º 16
0
 def back_color(self):
     """Return |ColorFormat| object that controls background color."""
     bgClr = self._pattFill.get_or_add_bgClr()
     return ColorFormat.from_colorchoice_parent(bgClr)
Exemplo n.º 17
0
 def color_format_having_none_color_type(self):
     solidFill = a_solidFill().with_nsdecls().element
     color_format = ColorFormat.from_colorchoice_parent(solidFill)
     return color_format
Exemplo n.º 18
0
 def fore_color(self):
     """Return |ColorFormat| object controlling fill color."""
     return ColorFormat.from_colorchoice_parent(self._solidFill)
Exemplo n.º 19
0
 def fore_color(self):
     """Return |ColorFormat| object that controls foreground color."""
     fgClr = self._pattFill.get_or_add_fgClr()
     return ColorFormat.from_colorchoice_parent(fgClr)
Exemplo n.º 20
0
 def color(self):
     """Return |ColorFormat| object controlling stop color."""
     return ColorFormat.from_colorchoice_parent(self._gs)
Exemplo n.º 21
0
 def rgb_color_format(self):
     srgbClr_bldr = an_srgbClr().with_val('123456')
     solidFill = (
         a_solidFill().with_nsdecls().with_child(srgbClr_bldr).element)
     color_format = ColorFormat.from_colorchoice_parent(solidFill)
     return color_format
Exemplo n.º 22
0
 def _NoneColor_color_format(self):
     solidFill = a_solidFill().with_nsdecls().element
     color_format = ColorFormat.from_colorchoice_parent(solidFill)
     return color_format
Exemplo n.º 23
0
 def _NoneColor_color_format(self):
     solidFill = a_solidFill().with_nsdecls().element
     color_format = ColorFormat.from_colorchoice_parent(solidFill)
     return color_format
Exemplo n.º 24
0
 def fore_color(self):
     """Return |ColorFormat| object controlling fill color."""
     return ColorFormat.from_colorchoice_parent(self._solidFill)
Exemplo n.º 25
0
 def color(self):
     """Return |ColorFormat| object controlling stop color."""
     return ColorFormat.from_colorchoice_parent(self._gs)
Exemplo n.º 26
0
 def color_format_having_none_color_type(self):
     solidFill = a_solidFill().with_nsdecls().element
     color_format = ColorFormat.from_colorchoice_parent(solidFill)
     return color_format