-
Notifications
You must be signed in to change notification settings - Fork 479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update ex css to 4.2.1 (In preparation for using it to evaluate css selector) #1083
Conversation
tolerateInvalidValues: true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made a self review to explain the changes.
@@ -444,7 +444,7 @@ private static T Create<T>(XmlReader reader) where T : SvgDocument, new() | |||
if (styles.Any()) | |||
{ | |||
var cssTotal = string.Join(Environment.NewLine, styles.Select(s => s.Content).ToArray()); | |||
var stylesheetParser = new StylesheetParser(true, true); | |||
var stylesheetParser = new StylesheetParser(true, true, tolerateInvalidValues: true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TolarateInvalidValues is needed so that Invalid Property Values are still read. Could be Too that ExCss is not correctly annotated yet.
This fixed a Bug: But now we have to set tolarateInvalidValues to still get all values
TylerBrinks/ExCSS@cea80cc
@@ -26,8 +26,8 @@ public void TestOpenWithEntities() | |||
|
|||
var svgPath = Path.Combine(TestsRootPath, EntitiesSampleSvgPath); | |||
var doc = SvgDocument.Open<SvgDocument>(svgPath, entities); | |||
Assert.That(doc.Children[0].Children[0].Fill, Is.EqualTo(new SvgColourServer(Color.Red))); | |||
Assert.That(doc.Children[0].Children[1].Fill, Is.EqualTo(new SvgColourServer(Color.Yellow))); | |||
Assert.That(doc.Children[0].Children[0].Fill, Is.EqualTo(new SvgColourServer(Color.FromArgb(255, 0 ,0)))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Colors are now in ARGB values so I have to use this to Correctly Compare them
@@ -66,16 +66,16 @@ public void Lexer_FileWithInvalidHex_ColorTagOnlyReverstToDefaultForTheInvalidTa | |||
var doc = GenerateLexerTestFile("fill: #ff00; stroke: #00ff00"); | |||
var path = doc.GetElementById<SvgPath>("path1"); | |||
// default fill color is Black | |||
Assert.AreEqual(System.Drawing.Color.Black, ((SvgColourServer)path.Fill).Colour); | |||
Assert.AreEqual(System.Drawing.Color.Lime, ((SvgColourServer)path.Stroke).Colour); | |||
Assert.AreEqual(System.Drawing.Color.FromArgb(0,255,255,0), ((SvgColourServer)path.Fill).Colour); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4Hex values are now valid colors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Can you also an entry in the release notes?
Input values for tests have changed. |
I think only the representation has changed var doc = GenerateLexerTestFile("fill: #ff00; stroke: #00ff00"); |
I think this change will have a large impact on users. By the way, if you update to 4.2.0, there is no need to change the test. Do I have to update now ? |
True, I haven't considered this. I think we still want to have this change, as it is fixing stuff, but communicate the breaking change clearly to the user, and maybe think about a major release because of it (I'm unsure about this).
It is a bit unfortunate that the color fix in ExCSS was made in a minor patch release and went a bit unnoticed, but as I said - it fixes color handling, so this is something we want to have. One possibility is to update to 4.2.0, make a patch release, and later update to 4.2.1 in preparation for a major (or minor?) release. |
I think purpose is to remove I think v4.2.0 can also achieve this purpose. If we use 4.2.1 as in this PR, I think you need to review handling of colors in SVG.NET (file output, etc.). |
@H1Gdev updating to v4.2.0 as an intermediatary step would work, but finally I need to a yet to be realeased Version Greater than 4.2.1 Because of this. Because without that I cannot evalute the Selector. (Theoretically I could I would have to Parse the ComplexSelector). |
I think the issue that's need investigating is. var doc = GenerateLexerTestFile("fill: #ff00; stroke: #00ff00"); The other color parsing changes simply Set the RGB Colors instead of the KnownColor name I think I will debug through what happens here. |
I debugged it through and there are really 4 hex Css Colors (8Bit per color) so 4 Hex values is ARGB 8Bit Color, So the behavior is correct. https://www.quackit.com/css/color/values/css_hex_color_notation_4_digits.cfm I added a Unit Test to Validate the Default Color Behavior. with an Invalid 2Hex Color |
Closing this in favor of this |
Reference Issue
#1073
What does this implement/fix? Explain your changes.
Updates ExCss to the newest Version and fixes Unit Tests for that.