Using ToArgb() followed by FromArgb() does not result in the original color

前端 未结 4 1248
清酒与你
清酒与你 2021-01-13 04:35

This does not work

        int blueInt = Color.Blue.ToArgb();
        Color fred = Color.FromArgb(blueInt);
        Assert.AreEqual(Color.Blue,fred);
         


        
4条回答
  •  借酒劲吻你
    2021-01-13 05:08

    I would have expected this with Assert.AreSame because of the boxing with the value types, but AreEqual should not have this problem.

    Could you add which language (I'm assuming C#) your using and which testing framework?

    What does Assert.AreEqual(true, Color.Blue == fred); result in?

提交回复
热议问题