moved gradient test location

This commit is contained in:
melsonic 2025-04-12 23:19:54 +05:30
parent 759a4e89cd
commit b7a0219680
No known key found for this signature in database
GPG key ID: DFA426742F621CD7
4 changed files with 128 additions and 14 deletions

View file

@ -3894,20 +3894,6 @@ svc_1.t2 -> b: do with B
tassert.Equal(t, "d2/testdata/d2compiler/TestCompile/meow.d2", g.Layers[0].Layers[0].AST.Range.Path) tassert.Equal(t, "d2/testdata/d2compiler/TestCompile/meow.d2", g.Layers[0].Layers[0].AST.Range.Path)
}, },
}, },
{
name: "test-gradient-fill-values-in-sketch-mode",
text: `
vars: {
d2-config: {
sketch: true
}
}
x->y
x.style.fill: "linear-gradient(#000000, #ffffff)"
y.style.fill: "linear-gradient(#ffffff, #000000)"
`,
expErr: "",
},
} }
for _, tc := range testCases { for _, tc := range testCases {

View file

@ -1357,6 +1357,14 @@ item -> customer: is(Adult)
customer -> item: true customer -> item: true
`, `,
}, },
{
name: "test-gradient-fill-values-in-sketch-mode",
script: `
x->y
x.style.fill: "linear-gradient(#000000,#ffffff)"
y.style.fill: "linear-gradient(#ffffff,#000000)"
`,
},
} }
runa(t, tcs) runa(t, tcs)
} }

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 53 KiB

View file

@ -86,6 +86,8 @@ func darkenCSS(colorString string) (string, error) {
} }
func LuminanceCategory(colorString string) (string, error) { func LuminanceCategory(colorString string) (string, error) {
// check if colorString matches the `url('#grad-<sha1-hash>')` format
// which is used to refer to a <linearGradient> or <radialGradient> element.
if IsURLGradientID(colorString) { if IsURLGradientID(colorString) {
return "normal", nil return "normal", nil
} }