[latex3-commits] [git/LaTeX3-latex3-latex3] master: Add tests for DeviceN color space creation (1d6061628)
Joseph Wright
joseph.wright at morningstar2.co.uk
Sun Sep 20 11:46:22 CEST 2020
Repository : https://github.com/latex3/latex3
On branch : master
Link : https://github.com/latex3/latex3/commit/1d6061628794890d746cd820d23faec1fdac0f01
>---------------------------------------------------------------
commit 1d6061628794890d746cd820d23faec1fdac0f01
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Sun Sep 20 08:32:32 2020 +0100
Add tests for DeviceN color space creation
With the usual minor code adjustments!
>---------------------------------------------------------------
1d6061628794890d746cd820d23faec1fdac0f01
l3backend/l3backend-color.dtx | 2 +
l3experimental/l3color/l3color.dtx | 12 ++---
l3experimental/l3color/testfiles/m3color003.lvt | 32 +++++++++++++
.../l3color/testfiles/m3color003.ptex.tlg | 53 ++++++++++++++++++++++
l3experimental/l3color/testfiles/m3color003.tlg | 53 ++++++++++++++++++++++
.../l3color/testfiles/m3color003.uptex.tlg | 53 ++++++++++++++++++++++
.../l3color/testfiles/m3color003.xetex.tlg | 53 ++++++++++++++++++++++
7 files changed, 252 insertions(+), 6 deletions(-)
diff --git a/l3backend/l3backend-color.dtx b/l3backend/l3backend-color.dtx
index 4424c1d46..44ec45ebb 100644
--- a/l3backend/l3backend-color.dtx
+++ b/l3backend/l3backend-color.dtx
@@ -756,6 +756,8 @@
}
%</luatex|pdftex>
}
+\cs_if_exist:NF \pdf_object_now:nn
+ { \cs_gset_protected:Npn \@@_backend_devicen_init:nnn #1#2#3 { } }
\cs_new:Npn \@@_backend_devicen_init:w #1 ~ #2 \s_@@_stop
{
+ 1
diff --git a/l3experimental/l3color/l3color.dtx b/l3experimental/l3color/l3color.dtx
index 34fe5a413..4157ac227 100644
--- a/l3experimental/l3color/l3color.dtx
+++ b/l3experimental/l3color/l3color.dtx
@@ -1909,11 +1909,11 @@
\tl_if_empty:NTF \l_@@_model_tl
{ \tl_set_eq:NN \l_@@_model_tl \l_@@_internal_tl }
{
- \tl_if_eq:NNF \l_@@_model_tl \l_@@_internal_tl
+ \str_if_eq:VVF \l_@@_model_tl \l_@@_internal_tl
{
\__kernel_msg_error:nnn { color }
{ DeviceN-inconsistent-alternative }
- {#1}
+ {#2}
\clist_map_break:n { \use_none:nnnnn }
}
}
@@ -2025,21 +2025,21 @@
\@@_parse_number:n {##4}
}
}
- \cs_new_eq:cN { @@_parse_mix_ #1 :nw } \@@_parse_mix_cmyk:nw
+ \cs_new_eq:cN { @@_parse_mix_ #1 :nw } \@@_parse_mix_cmyk:nw
}
\cs_new_protected:Npn \@@_model_devicen_parse_generic:nn #1#2
{
\cs_new:cpn { @@_parse_model_ #1 :w } ##1 , ##2 \s_@@_stop
{
{#1}
- { \@@_model_devicen_parse:nw {#2} ##2 , \q_nil , \s_@@_stop }
+ { \@@_model_devicen_parse:nw {#2} ##1 , ##2 , \q_nil , \s_@@_stop }
}
\cs_new:cpx { @@_parse_mix_ #1 :nw }
##1 ##2 \s_@@_mark ##3 \s_@@_stop
{
\exp_not:N \@@_model_devicen_mix:nw {##1}
- ##2 \exp_not:N \q_nil \c_space_tl \exp_not:N \s_@@_mark
- ##3 \exp_not:N \q_nil \c_space_tl \exp_not:N \s_@@_stop
+ ##2 \c_space_tl \exp_not:N \q_nil \c_space_tl \exp_not:N \s_@@_mark
+ ##3 \c_space_tl \exp_not:N \q_nil \c_space_tl \exp_not:N \s_@@_stop
}
}
\cs_new:Npn \@@_model_devicen_parse:nw #1#2 , #3 \s_@@_stop
diff --git a/l3experimental/l3color/testfiles/m3color003.lvt b/l3experimental/l3color/testfiles/m3color003.lvt
index 8da24567d..0a0a6e3c8 100644
--- a/l3experimental/l3color/testfiles/m3color003.lvt
+++ b/l3experimental/l3color/testfiles/m3color003.lvt
@@ -242,4 +242,36 @@
\color_show:n { foo }
}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\TEST { DeviceN~spaces }
+ {
+ \color_model_new:nnn { TwoUp } { DeviceN }
+ {
+ names = { BarToneCMYK , black }
+ }
+ \color_set:nnn { twoup } { TwoUp } { 0.75 , 0.25 }
+ \color_set:nn { foo } { twoup }
+ \color_show:n { foo }
+ \color_set:nn { foo } { twoup!50 }
+ \color_show:n { foo }
+ \color_model_new:nnn { AllIn } { DeviceN }
+ {
+ names = { BarToneCMYK , cyan , magenta , yellow , black }
+ }
+ \color_set:nnn { allin } { AllIn } { 0.75 , 0.25 , 0 , 0 , 0 }
+ \color_set:nn { foo } { allin }
+ \color_show:n { foo }
+ \color_set:nn { foo } { allin!50 }
+ \color_show:n { foo }
+ }
+
+\TEST { DeviceN~errors }
+ {
+ \color_model_new:nnn { TwoUpMixed } { DeviceN }
+ {
+ names = { BarToneCMYK , red }
+ }
+ }
+
\END
diff --git a/l3experimental/l3color/testfiles/m3color003.ptex.tlg b/l3experimental/l3color/testfiles/m3color003.ptex.tlg
index 0db0c9d2b..c247665ec 100644
--- a/l3experimental/l3color/testfiles/m3color003.ptex.tlg
+++ b/l3experimental/l3color/testfiles/m3color003.ptex.tlg
@@ -413,3 +413,56 @@ The color foo has the properties:
<recently read> }
l. ... }
============================================================
+============================================================
+TEST 13: DeviceN spaces
+============================================================
+Defining \c__color_fallback_TwoUp_tl on line ...
+Defining \__color_parse_model_TwoUp:w on line ...
+Defining \__color_parse_mix_TwoUp:nw on line ...
+Defining \__color_backend_fill_TwoUp:n on line ...
+Defining \__color_backend_stroke_TwoUp:n on line ...
+Defining \__color_backend_select_TwoUp:n on line ...
+Defining \__color_model_TwoUp_white: on line ...
+Defining \l__color_named_twoup_tl on line ...
+Defining \l__color_named_twoup_prop on line ...
+The color foo has the properties:
+> model => TwoUp
+> TwoUp => 0.75 0.25.
+<recently read> }
+l. ... }
+The color foo has the properties:
+> model => TwoUp
+> TwoUp => 0.375 0.125.
+<recently read> }
+l. ... }
+Defining \c__color_fallback_AllIn_tl on line ...
+Defining \__color_parse_model_AllIn:w on line ...
+Defining \__color_parse_mix_AllIn:nw on line ...
+Defining \__color_backend_fill_AllIn:n on line ...
+Defining \__color_backend_stroke_AllIn:n on line ...
+Defining \__color_backend_select_AllIn:n on line ...
+Defining \__color_model_AllIn_white: on line ...
+Defining \l__color_named_allin_tl on line ...
+Defining \l__color_named_allin_prop on line ...
+The color foo has the properties:
+> model => AllIn
+> AllIn => 0.75 0.25 0.0 0.0 0.0.
+<recently read> }
+l. ... }
+The color foo has the properties:
+> model => AllIn
+> AllIn => 0.375 0.125 0 0 0.
+<recently read> }
+l. ... }
+============================================================
+============================================================
+TEST 14: DeviceN errors
+============================================================
+! LaTeX3 Error: DeviceN color spaces require a single alternative space.
+For immediate help type H <return>.
+ ...
+l. ... }
+LaTeX has been asked to create a DeviceN color space 'TwoUpMixed', but the
+constituent colors do not have a common alternative color.
+============================================================
+Bad grouping: 2!
diff --git a/l3experimental/l3color/testfiles/m3color003.tlg b/l3experimental/l3color/testfiles/m3color003.tlg
index 2f280e5b0..9fe613738 100644
--- a/l3experimental/l3color/testfiles/m3color003.tlg
+++ b/l3experimental/l3color/testfiles/m3color003.tlg
@@ -403,3 +403,56 @@ The color foo has the properties:
<recently read> }
l. ... }
============================================================
+============================================================
+TEST 13: DeviceN spaces
+============================================================
+Defining \c__color_fallback_TwoUp_tl on line ...
+Defining \__color_parse_model_TwoUp:w on line ...
+Defining \__color_parse_mix_TwoUp:nw on line ...
+Defining \__color_backend_fill_TwoUp:n on line ...
+Defining \__color_backend_stroke_TwoUp:n on line ...
+Defining \__color_backend_select_TwoUp:n on line ...
+Defining \__color_model_TwoUp_white: on line ...
+Defining \l__color_named_twoup_tl on line ...
+Defining \l__color_named_twoup_prop on line ...
+The color foo has the properties:
+> model => TwoUp
+> TwoUp => 0.75 0.25.
+<recently read> }
+l. ... }
+The color foo has the properties:
+> model => TwoUp
+> TwoUp => 0.375 0.125.
+<recently read> }
+l. ... }
+Defining \c__color_fallback_AllIn_tl on line ...
+Defining \__color_parse_model_AllIn:w on line ...
+Defining \__color_parse_mix_AllIn:nw on line ...
+Defining \__color_backend_fill_AllIn:n on line ...
+Defining \__color_backend_stroke_AllIn:n on line ...
+Defining \__color_backend_select_AllIn:n on line ...
+Defining \__color_model_AllIn_white: on line ...
+Defining \l__color_named_allin_tl on line ...
+Defining \l__color_named_allin_prop on line ...
+The color foo has the properties:
+> model => AllIn
+> AllIn => 0.75 0.25 0.0 0.0 0.0.
+<recently read> }
+l. ... }
+The color foo has the properties:
+> model => AllIn
+> AllIn => 0.375 0.125 0 0 0.
+<recently read> }
+l. ... }
+============================================================
+============================================================
+TEST 14: DeviceN errors
+============================================================
+! LaTeX3 Error: DeviceN color spaces require a single alternative space.
+For immediate help type H <return>.
+ ...
+l. ... }
+LaTeX has been asked to create a DeviceN color space 'TwoUpMixed', but the
+constituent colors do not have a common alternative color.
+============================================================
+Bad grouping: 2!
diff --git a/l3experimental/l3color/testfiles/m3color003.uptex.tlg b/l3experimental/l3color/testfiles/m3color003.uptex.tlg
index 0db0c9d2b..c247665ec 100644
--- a/l3experimental/l3color/testfiles/m3color003.uptex.tlg
+++ b/l3experimental/l3color/testfiles/m3color003.uptex.tlg
@@ -413,3 +413,56 @@ The color foo has the properties:
<recently read> }
l. ... }
============================================================
+============================================================
+TEST 13: DeviceN spaces
+============================================================
+Defining \c__color_fallback_TwoUp_tl on line ...
+Defining \__color_parse_model_TwoUp:w on line ...
+Defining \__color_parse_mix_TwoUp:nw on line ...
+Defining \__color_backend_fill_TwoUp:n on line ...
+Defining \__color_backend_stroke_TwoUp:n on line ...
+Defining \__color_backend_select_TwoUp:n on line ...
+Defining \__color_model_TwoUp_white: on line ...
+Defining \l__color_named_twoup_tl on line ...
+Defining \l__color_named_twoup_prop on line ...
+The color foo has the properties:
+> model => TwoUp
+> TwoUp => 0.75 0.25.
+<recently read> }
+l. ... }
+The color foo has the properties:
+> model => TwoUp
+> TwoUp => 0.375 0.125.
+<recently read> }
+l. ... }
+Defining \c__color_fallback_AllIn_tl on line ...
+Defining \__color_parse_model_AllIn:w on line ...
+Defining \__color_parse_mix_AllIn:nw on line ...
+Defining \__color_backend_fill_AllIn:n on line ...
+Defining \__color_backend_stroke_AllIn:n on line ...
+Defining \__color_backend_select_AllIn:n on line ...
+Defining \__color_model_AllIn_white: on line ...
+Defining \l__color_named_allin_tl on line ...
+Defining \l__color_named_allin_prop on line ...
+The color foo has the properties:
+> model => AllIn
+> AllIn => 0.75 0.25 0.0 0.0 0.0.
+<recently read> }
+l. ... }
+The color foo has the properties:
+> model => AllIn
+> AllIn => 0.375 0.125 0 0 0.
+<recently read> }
+l. ... }
+============================================================
+============================================================
+TEST 14: DeviceN errors
+============================================================
+! LaTeX3 Error: DeviceN color spaces require a single alternative space.
+For immediate help type H <return>.
+ ...
+l. ... }
+LaTeX has been asked to create a DeviceN color space 'TwoUpMixed', but the
+constituent colors do not have a common alternative color.
+============================================================
+Bad grouping: 2!
diff --git a/l3experimental/l3color/testfiles/m3color003.xetex.tlg b/l3experimental/l3color/testfiles/m3color003.xetex.tlg
index 12f6ba10a..225713522 100644
--- a/l3experimental/l3color/testfiles/m3color003.xetex.tlg
+++ b/l3experimental/l3color/testfiles/m3color003.xetex.tlg
@@ -403,3 +403,56 @@ The color foo has the properties:
<recently read> }
l. ... }
============================================================
+============================================================
+TEST 13: DeviceN spaces
+============================================================
+Defining \c__color_fallback_TwoUp_tl on line ...
+Defining \__color_parse_model_TwoUp:w on line ...
+Defining \__color_parse_mix_TwoUp:nw on line ...
+Defining \__color_backend_fill_TwoUp:n on line ...
+Defining \__color_backend_stroke_TwoUp:n on line ...
+Defining \__color_backend_select_TwoUp:n on line ...
+Defining \__color_model_TwoUp_white: on line ...
+Defining \l__color_named_twoup_tl on line ...
+Defining \l__color_named_twoup_prop on line ...
+The color foo has the properties:
+> model => TwoUp
+> TwoUp => 0.75 0.25.
+<recently read> }
+l. ... }
+The color foo has the properties:
+> model => TwoUp
+> TwoUp => 0.375 0.125.
+<recently read> }
+l. ... }
+Defining \c__color_fallback_AllIn_tl on line ...
+Defining \__color_parse_model_AllIn:w on line ...
+Defining \__color_parse_mix_AllIn:nw on line ...
+Defining \__color_backend_fill_AllIn:n on line ...
+Defining \__color_backend_stroke_AllIn:n on line ...
+Defining \__color_backend_select_AllIn:n on line ...
+Defining \__color_model_AllIn_white: on line ...
+Defining \l__color_named_allin_tl on line ...
+Defining \l__color_named_allin_prop on line ...
+The color foo has the properties:
+> model => AllIn
+> AllIn => 0.75 0.25 0.0 0.0 0.0.
+<recently read> }
+l. ... }
+The color foo has the properties:
+> model => AllIn
+> AllIn => 0.375 0.125 0 0 0.
+<recently read> }
+l. ... }
+============================================================
+============================================================
+TEST 14: DeviceN errors
+============================================================
+! LaTeX3 Error: DeviceN color spaces require a single alternative space.
+For immediate help type H <return>.
+ ...
+l. ... }
+LaTeX has been asked to create a DeviceN color space 'TwoUpMixed', but the
+constituent colors do not have a common alternative color.
+============================================================
+Bad grouping: 2!
More information about the latex3-commits
mailing list.