Example #1
0
        protected override bool OnTest()
        {
            Logger.Log("Running WindowSettings tests...");

            WindowSettings s1 = new(new Vector2u(400, 400), 0, true, true, 45.0f);

            if (s1.Width is not 400)
            {
                return(Logger.LogReturn("Failed: WindowSettings width did not set correctly.", false));
            }
            if (s1.Height is not 400)
            {
                return(Logger.LogReturn("Failed: WindowSettings height did not set correctly.", false));
            }
            if (s1.WindowMode is not 0)
            {
                return(Logger.LogReturn("Failed: WindowSettings fullscreen did not set correctly.", false));
            }
            if (s1.TargetFps is not 45.0f)
            {
                return(Logger.LogReturn("Failed: WindowSettings target fps did not set correctly.", false));
            }

            string         xml = $"{ Xml.Header }\r\n{ s1 }";
            WindowSettings x   = XmlLoadable.FromXml <WindowSettings>(xml);

            if (x == null)
            {
                return(Logger.LogReturn("Failed: Unable to load WindowSettings from xml.", false));
            }
            if (!x.Equals(s1))
            {
                return(Logger.LogReturn("Failed: Xml loaded WindowSettings has incorrect values.", false));
            }

            return(Logger.LogReturn("WindowSettings tests succeeded!", true));
        }