public void TestConstructor2(string feature) { RequiredByFeatureAttribute a = new RequiredByFeatureAttribute(feature); Assert.AreEqual(feature, a.FeatureName); Assert.IsNull(a.FeatureVersion); Assert.IsNull(a.Profile); // a.Api does not follow a.FeatureVersion.Api: code generator must always specify Api explictly Assert.AreEqual(KhronosVersion.ApiGl, a.Api); }
public void TestIsSupported_ArgumentNullException() { RequiredByFeatureAttribute a = new RequiredByFeatureAttribute("GL_VERSION_1_0"); Gl.Extensions extensions = new Gl.Extensions(); Assert.DoesNotThrow(() => a.IsSupported(Gl.Version_100, extensions)); Assert.DoesNotThrow(() => a.IsSupported(Gl.Version_100, null)); a.IsSupported(null, extensions); }
public void TestConstructor1(string feature, int major, int minor, int revision, string api) { RequiredByFeatureAttribute a = new RequiredByFeatureAttribute(feature); Assert.AreEqual(feature, a.FeatureName); Assert.IsNotNull(a.FeatureVersion); Assert.AreEqual(new KhronosVersion(major, minor, revision, api), a.FeatureVersion); Assert.IsNull(a.FeatureVersion.Profile); // a.Api does not follow a.FeatureVersion.Api: code generator must always specify Api explictly Assert.AreEqual(KhronosVersion.ApiGl, a.Api); }
public void TestIsSupported() { RequiredByFeatureAttribute a; // Version a = new RequiredByFeatureAttribute("GL_VERSION_1_1"); Assert.IsTrue(a.IsSupported(Gl.Version_110, null)); Assert.IsFalse(a.IsSupported(Gl.Version_100, null)); // All versions greater than the requirement are supported Assert.IsTrue(a.IsSupported(Gl.Version_120, null)); Assert.IsTrue(a.IsSupported(Gl.Version_200, null)); Assert.IsTrue(a.IsSupported(Gl.Version_450, null)); // a.FeatureVersion.Profile is null: any profile match Assert.IsTrue(a.IsSupported(new KhronosVersion(Gl.Version_110, KhronosVersion.ProfileCompatibility), null)); a = new RequiredByFeatureAttribute("GL_VERSION_3_2"); a.Profile = KhronosVersion.ProfileCompatibility; // a.FeatureVersion.Profile is not null: specific profile match... Assert.IsTrue(a.IsSupported(new KhronosVersion(Gl.Version_320, KhronosVersion.ProfileCompatibility), null)); Assert.IsFalse(a.IsSupported(new KhronosVersion(Gl.Version_320, KhronosVersion.ProfileCore), null)); // ...and even unspecified profile Assert.IsTrue(a.IsSupported(new KhronosVersion(Gl.Version_320, null), null)); // a.Api must match (no regex) Assert.IsFalse(a.IsSupported(new KhronosVersion(Gl.Version_320_ES, KhronosVersion.ProfileCore), null)); // Extension a = new RequiredByFeatureAttribute("GL_ARB_multisample"); Assert.IsFalse(a.IsSupported(new KhronosVersion(Gl.Version_320, KhronosVersion.ProfileCore), null)); Gl.Extensions extensions = new Gl.Extensions(); Assert.IsFalse(a.IsSupported(new KhronosVersion(Gl.Version_320, KhronosVersion.ProfileCore), extensions)); extensions.EnableExtension("GL_ARB_multisample"); Assert.IsTrue(a.IsSupported(new KhronosVersion(Gl.Version_320, KhronosVersion.ProfileCore), extensions)); // Note: extensions.MultisampleARB is not altered by EnableExtension // Version/Profile a = new RequiredByFeatureAttribute("GL_VERSION_3_2"); a.Profile = "core|compatibility"; Assert.IsTrue(a.IsSupported(new KhronosVersion(Gl.Version_320, KhronosVersion.ProfileCore), null)); Assert.IsTrue(a.IsSupported(new KhronosVersion(Gl.Version_320, KhronosVersion.ProfileCompatibility), null)); Assert.IsFalse(a.IsSupported(new KhronosVersion(Gl.Version_320, KhronosVersion.ProfileCommon), null)); }