示例#1
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            MgDataPropertyDefinition def1 = new MgDataPropertyDefinition("def1");
            MgDataPropertyDefinition def2 = new MgDataPropertyDefinition("def2");
            MgDataPropertyDefinition def3 = new MgDataPropertyDefinition("def3");
            MgDataPropertyDefinition def4 = new MgDataPropertyDefinition("def4");

            MgPropertyDefinitionCollection coll = new MgPropertyDefinitionCollection();

            coll.Add(def1);
            coll.Add(def2);
            coll.Insert(2, def4);
            coll.Insert(2, def3);

            Assert.AreEqual(4, coll.Count);
            Assert.AreEqual("def1", coll[0].GetName());

            MgPropertyDefinition tmp = coll[0];

            coll.Remove(def1);
            Assert.AreEqual(3, coll.Count);
            coll.Insert(0, tmp);


            string txt = "";

            foreach (MgPropertyDefinition def in coll)
            {
                txt += "[" + def.GetName() + "]";
            }
            Assert.AreEqual("[def1][def2][def3][def4]", txt);
        }
示例#2
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            var     wkt   = new MgWktReaderWriter();
            MgPoint geom1 = wkt.Read("POINT XY (1.0 1.0)") as MgPoint;
            MgPoint geom2 = wkt.Read("POINT XY (2.0 2.0)") as MgPoint;
            MgPoint geom3 = wkt.Read("POINT XY (1.0 1.0)") as MgPoint;

            MgPointCollection coll = new MgPointCollection();

            coll.Add(geom1);
            coll.Add(geom2);
            coll.Add(geom3);

            Assert.AreEqual(3, coll.Count);
            Assert.IsTrue(geom1.Equals(coll[0]));
            Assert.IsTrue(coll[0].Equals(coll[2]));
            Assert.IsFalse(coll[0].Equals(coll[1]));
            coll[0] = coll[1];
            Assert.IsTrue(coll[0].Equals(coll[1]));

            double x = 0.0;

            foreach (MgPoint geom in coll)
            {
                x += geom.GetCoordinate().GetX();
            }
            Assert.AreEqual(5.0, x);
        }
示例#3
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            var       build = new GeomBuild();
            MgPolygon geom1 = build.CreatePolygon(2.0);
            MgPolygon geom2 = build.CreatePolygon(12.0);
            MgPolygon geom3 = build.CreatePolygon(2.0);

            MgPolygonCollection coll = new MgPolygonCollection();

            coll.Add(geom1);
            coll.Add(geom2);
            coll.Add(geom3);

            Assert.AreEqual(3, coll.Count);
            Assert.IsTrue(geom1.Equals(coll[0]));
            Assert.IsTrue(coll[0].Equals(coll[2]));
            Assert.IsFalse(coll[0].Equals(coll[1]));
            coll[0] = coll[1];
            Assert.IsTrue(coll[0].Equals(coll[1]));

            double width = 0.0;

            foreach (MgPolygon geom in coll)
            {
                width += geom.Envelope().GetWidth();
            }
            Assert.AreEqual(geom1.Envelope().GetWidth() * 3.0, width);
        }
示例#4
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            logger.WriteLine("Skipping CollectionTestsLayerCollection: MgLayerGroupCollection constructor not visible");

            /*
             * MgLayerGroup group1 = new MgLayerGroup("group1");
             * MgLayerGroup group2 = new MgLayerGroup("group2");
             * MgLayerGroup group3 = new MgLayerGroup("group3");
             * MgLayerGroup group4 = new MgLayerGroup("group4");
             *
             * MgLayerGroupCollection coll = new MgLayerGroupCollection();
             * coll.Add(group1);
             * coll.Insert(1, group2);
             * coll.Add(group3);
             * coll.Insert(3, group4);
             *
             * Assert.AreEqual(4, coll.Count);
             * Assert.AreEqual(coll[2].GetName(), "group3");
             *
             * coll[1] = coll[2];
             *
             * string txt = "";
             * foreach (MgLayerGroup group in coll)
             * {
             *  txt += "[" + group.GetName() + "]";
             * }
             * Assert.AreEqual("[group1][group3][group3][group4]", txt);
             */
        }
示例#5
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            string     coordsys = "GEOGCS[\"LL84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9108\"]],AXIS[\"Lat\",NORTH],AXIS[\"Long\",EAST],AUTHORITY[\"EPSG\",\"4326\"]]";
            MgEnvelope env      = new MgEnvelope(10, 10, 20, 20);



            MgMapBase map1 = factory.CreateMap(coordsys, env, "map1");
            MgMapBase map2 = factory.CreateMap(coordsys, env, "map2");
            MgMapBase map3 = factory.CreateMap(coordsys, env, "map3");
            MgMapBase map4 = factory.CreateMap(coordsys, env, "map4");

            MgMapCollection coll = new MgMapCollection();

            coll.Add(map1);
            coll.Insert(1, map2);
            coll.Add(map3);

            Assert.AreEqual(3, coll.Count);
            Assert.AreEqual(coll[2].GetName(), "map3");

            coll[1] = map4;


            string txt = "";

            foreach (MgMapBase map in coll)
            {
                txt += "[" + map.GetName() + "]";
            }
            Assert.AreEqual("[map1][map4][map3]", txt);
        }
示例#6
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            MgPropertyCollection propVals = new MgPropertyCollection();
            MgInt32Property      prop     = new MgInt32Property("prop", 1);

            propVals.Add(prop);
            MgUpdateFeatures update = new MgUpdateFeatures("class2", propVals, "where cat < dog");
            MgInsertFeatures insert = new MgInsertFeatures("class3", propVals);
            MgDeleteFeatures del    = new MgDeleteFeatures("class1", "where cat > dog");

            MgFeatureCommandCollection coll = new MgFeatureCommandCollection();

            coll.Add(update);
            coll.Add(insert);
            coll.Add(del);

            Assert.AreEqual(3, coll.Count);
            Assert.AreEqual(MgFeatureCommandType.DeleteFeatures, coll[2].GetCommandType());
            coll[0] = coll[1];

            string txt = "";

            foreach (MgFeatureCommand cmd in coll)
            {
                txt += "[" + cmd.GetCommandType() + "]";
            }
            Assert.AreEqual("[0][0][2]", txt);
        }
示例#7
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            MgGeometryFactory gf = new MgGeometryFactory();
            MgCoordinate      c1 = gf.CreateCoordinateXY(1.0, 1.0);
            MgCoordinate      c2 = gf.CreateCoordinateXY(2.0, 2.0);
            MgCoordinate      c3 = gf.CreateCoordinateXY(3.0, 3.0);
            MgCoordinate      c4 = gf.CreateCoordinateXY(4.0, 4.0);

            MgCoordinateCollection coll = new MgCoordinateCollection();

            coll.Add(c1);
            coll.Insert(1, c2);
            coll.Add(c3);
            coll.Add(c4);

            Assert.AreEqual(4, coll.Count);
            Assert.AreEqual(1.0, coll[0].GetX());
            coll[3] = coll[2];
            Assert.AreEqual(3.0, coll[3].GetX());

            double sum = 0.0;

            foreach (MgCoordinate coord in coll)
            {
                sum += coord.GetX();
            }
            Assert.AreEqual(9.0, sum);
        }
示例#8
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            MgPropertyCollection coll     = new MgPropertyCollection();
            MgDoubleProperty     dblProp  = new MgDoubleProperty("DoubleProp", 1.1111);
            MgInt32Property      intProp  = new MgInt32Property("IntProp", 1);
            MgDateTime           dateTime = new MgDateTime(2006, 9, 21);
            MgDateTimeProperty   dateProp = new MgDateTimeProperty("DateProp", dateTime);
            MgSingleProperty     single   = new MgSingleProperty("SingleProp", (float)2.2222);

            coll.Add(dblProp);
            coll.Add(intProp);
            coll.Add(dateProp);
            coll[2] = single;

            Assert.AreEqual(1.1111, (coll[0] as MgDoubleProperty).GetValue());
            Assert.AreEqual(MgPropertyType.Double, coll[0].GetPropertyType());
            Assert.AreEqual(MgPropertyType.Int32, coll[1].GetPropertyType());
            Assert.AreEqual(MgPropertyType.Single, coll[2].GetPropertyType());
            Assert.AreEqual((float)2.2222, (coll[2] as MgSingleProperty).GetValue());
            Assert.AreEqual(3, coll.Count);

            Assert.AreEqual(MgPropertyType.Double, coll[0].GetPropertyType());

            string str = "";

            foreach (MgProperty prop in coll)
            {
                str = str + "[" + prop.GetName() + "]";
            }
            Assert.AreEqual("[DoubleProp][IntProp][SingleProp]", str);
        }
示例#9
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            StringCollection strColl = new StringCollection();

            strColl.Add("string1");
            strColl.Add("string2");
            strColl.Add("string3");
            strColl.Add("string3");

            MgStringCollection coll1 = new MgStringCollection();

            coll1.Add("Hello");

            MgStringCollection coll2 = new MgStringCollection(strColl);

            Assert.AreEqual(4, coll2.GetCount());
            StringCollection coll3 = coll2;

            Assert.AreEqual(4, coll3.Count);
            for (int i = 0; i < 4; i++)
            {
                Assert.AreEqual(strColl[i], coll2.GetItem(i));
                Assert.AreEqual(strColl[i], coll3[i]);
            }
        }
示例#10
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            MgGeometryFactory      gf          = new MgGeometryFactory();
            MgCoordinate           pt1         = gf.CreateCoordinateXY(0, 0);
            MgCoordinate           pt2         = gf.CreateCoordinateXY(0, 10);
            MgCoordinate           pt3         = gf.CreateCoordinateXY(10, 10);
            MgCoordinate           pt4         = gf.CreateCoordinateXY(10, 0);
            MgCoordinateCollection coordinates = new MgCoordinateCollection();

            coordinates.Add(pt1);
            coordinates.Add(pt2);
            coordinates.Add(pt3);
            coordinates.Add(pt4);
            MgLinearSegment          linearSegment = gf.CreateLinearSegment(coordinates);
            MgCurveSegmentCollection curveSegments = new MgCurveSegmentCollection();

            curveSegments.Add(linearSegment);
            MgCurveString           curveString = gf.CreateCurveString(curveSegments);
            MgCurveStringCollection csc         = new MgCurveStringCollection();

            csc.Add(curveString);
            MgMultiCurveString mcs = gf.CreateMultiCurveString(csc);

            Assert.AreEqual(1, mcs.Count);
            Assert.AreEqual(MgGeometryType.MultiCurveString, mcs.GeometryType);
            Assert.AreEqual(1, mcs.Dimension);
        }
示例#11
0
        public static int Execute(IPlatformFactory factory, ITestLogger logger, ref int testsRun)
        {
            int failures = 0;
            var types    = typeof(MapGuideTests).Assembly.GetTypes();

            foreach (var type in types)
            {
                if (typeof(IExternalTest).IsAssignableFrom(type) && type.IsClass && !type.IsAbstract)
                {
                    var test = (IExternalTest)Activator.CreateInstance(type);
                    try
                    {
                        logger.WriteLine("****** Executing MapGuide test: " + type.Name + " *********");
                        Console.WriteLine("Executing external MapGuide test: " + type.Name);
                        test.Execute(factory, logger);
                    }
                    catch (AssertException ex)
                    {
                        logger.WriteLine("Assertion failure: " + ex.Message);
                        failures++;
                    }
                    catch (Exception ex)
                    {
                        logger.WriteLine("General failure: " + ex.ToString());
                        failures++;
                    }
                    finally
                    {
                        testsRun++;
                    }
                }
            }
            return(failures);
        }
示例#12
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            MgDeleteFeatures df = new MgDeleteFeatures("dfClassName", "dfFilterText");

            Assert.AreEqual("dfClassName", df.FeatureClassName);
            Assert.AreEqual("dfFilterText", df.FilterText);
        }
示例#13
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            MgGeometryFactory      gf          = new MgGeometryFactory();
            MgCoordinate           pt1         = gf.CreateCoordinateXY(0, 0);
            MgCoordinate           pt2         = gf.CreateCoordinateXY(0, 10);
            MgCoordinate           pt3         = gf.CreateCoordinateXY(10, 10);
            MgCoordinate           pt4         = gf.CreateCoordinateXY(10, 0);
            MgCoordinateCollection coordinates = new MgCoordinateCollection();

            coordinates.Add(pt1);
            coordinates.Add(pt2);
            coordinates.Add(pt3);
            coordinates.Add(pt4);
            MgLinearSegment          linearSegment = gf.CreateLinearSegment(coordinates);
            MgCurveSegmentCollection curveSegments = new MgCurveSegmentCollection();

            curveSegments.Add(linearSegment);
            MgCurveRing    outerRing = gf.CreateCurveRing(curveSegments);
            MgCurvePolygon cp        = gf.CreateCurvePolygon(outerRing, null);

            Assert.AreEqual(outerRing.ToString(), cp.ExteriorRing.ToString());
            Assert.AreEqual(0, cp.InteriorRingCount);
            Assert.AreEqual(MgGeometryType.CurvePolygon, cp.GeometryType);
            Assert.AreEqual(2, cp.Dimension);
        }
 public CucumberMessageSender(ICucumberMessageFactory cucumberMessageFactory, IPlatformFactory platformFactory, ICucumberMessageSink cucumberMessageSink, IFieldValueProvider fieldValueProvider)
 {
     _cucumberMessageFactory = cucumberMessageFactory;
     _platformFactory        = platformFactory;
     _cucumberMessageSink    = cucumberMessageSink;
     _fieldValueProvider     = fieldValueProvider;
 }
示例#15
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            MgDataPropertyDefinition dpd = new MgDataPropertyDefinition("DataPropDefName");

            dpd.DataType = MgPropertyType.Int32;
            Assert.AreEqual(MgPropertyType.Int32, dpd.DataType);

            dpd.Length = 0;
            Assert.AreEqual(0, dpd.Length);

            dpd.Precision = 0;
            Assert.AreEqual(0, dpd.Precision);

            dpd.Scale = 0;
            Assert.AreEqual(0, dpd.Scale);

            dpd.DefaultValue = "123";
            Assert.AreEqual("123", dpd.DefaultValue);

            dpd.Nullable = true;
            Assert.IsTrue(dpd.Nullable);

            dpd.ReadOnly = false;
            Assert.IsFalse(dpd.ReadOnly);
        }
示例#16
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            MgGeometryFactory      gf          = new MgGeometryFactory();
            MgCoordinate           pt1         = gf.CreateCoordinateXY(0, 0);
            MgCoordinate           pt2         = gf.CreateCoordinateXY(0, 10);
            MgCoordinate           pt3         = gf.CreateCoordinateXY(10, 10);
            MgCoordinate           pt4         = gf.CreateCoordinateXY(10, 0);
            MgCoordinateCollection coordinates = new MgCoordinateCollection();

            coordinates.Add(pt1);
            coordinates.Add(pt2);
            coordinates.Add(pt3);
            coordinates.Add(pt4);
            MgLinearSegment          linearSegment = gf.CreateLinearSegment(coordinates);
            MgCurveSegmentCollection curveSegments = new MgCurveSegmentCollection();

            curveSegments.Add(linearSegment);
            MgCurveString curveString = gf.CreateCurveString(curveSegments);

            Assert.AreEqual(1, curveString.Count);
            Assert.AreEqual(pt1.ToString(), curveString.StartCoordinate.ToString());
            Assert.AreEqual(pt4.ToString(), curveString.EndCoordinate.ToString());
            Assert.AreEqual(MgGeometryType.CurveString, curveString.GeometryType);
            Assert.AreEqual(1, curveString.Dimension);
        }
示例#17
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            MgLayerGroup lg = new MgLayerGroup("TestLayerGroupName");

            Assert.AreEqual("TestLayerGroupName", lg.Name);
            Assert.AreEqual(MgLayerGroupType.Normal, lg.LayerGroupType);

            lg.Group = new MgLayerGroup("AnotherTestLayerGroupName");
            Assert.AreEqual("AnotherTestLayerGroupName", lg.Group.Name);

            lg.Visible = true;
            Assert.IsTrue(lg.Visible);
            lg.Visible = false;
            Assert.IsFalse(lg.Visible);

            lg.DisplayInLegend = true;
            Assert.IsTrue(lg.DisplayInLegend);
            lg.DisplayInLegend = false;
            Assert.IsFalse(lg.DisplayInLegend);

            Assert.IsFalse(lg.ExpandInLegend);

            lg.LegendLabel = "TestLegendLabel";
            Assert.AreEqual("TestLegendLabel", lg.LegendLabel);
        }
示例#18
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            MgStringProperty prop1 = new MgStringProperty("prop1", "val1");
            MgStringProperty prop2 = new MgStringProperty("prop2", "val2");
            MgStringProperty prop3 = new MgStringProperty("prop3", "val3");
            MgStringProperty prop4 = new MgStringProperty("prop4", "val4");

            MgStringPropertyCollection coll = new MgStringPropertyCollection();

            coll.Add(prop1);
            coll.Add(prop2);
            coll.Remove(prop3);
            coll.Remove(coll[1]);
            Assert.AreEqual(1, coll.Count);
            coll.Add(prop3);
            coll[1] = prop2;
            coll.Insert(2, prop3);
            Assert.AreEqual(2, coll.IndexOf(prop3));
            coll.Add(prop4);

            string txt = "";

            foreach (MgStringProperty prop in coll)
            {
                txt += "[" + prop.GetName() + "]";
            }
            Assert.AreEqual("[prop1][prop2][prop3][prop4]", txt);
        }
示例#19
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            MgGeometryFactory      gf          = new MgGeometryFactory();
            MgCoordinate           pt1         = gf.CreateCoordinateXY(0, 0);
            MgCoordinate           pt2         = gf.CreateCoordinateXY(0, 10);
            MgCoordinate           pt3         = gf.CreateCoordinateXY(10, 10);
            MgCoordinate           pt4         = gf.CreateCoordinateXY(10, 0);
            MgCoordinateCollection coordinates = new MgCoordinateCollection();

            coordinates.Add(pt1);
            coordinates.Add(pt2);
            coordinates.Add(pt3);
            coordinates.Add(pt4);
            MgLinearSegment          linearSegment = gf.CreateLinearSegment(coordinates);
            MgCurveSegmentCollection curveSegments = new MgCurveSegmentCollection();
            MgCurveRing              curveRing     = gf.CreateCurveRing(curveSegments);
            MgCurvePolygon           cp            = gf.CreateCurvePolygon(curveRing, null);
            MgCurvePolygonCollection cpc           = new MgCurvePolygonCollection();

            cpc.Add(cp);
            MgMultiCurvePolygon mcp = gf.CreateMultiCurvePolygon(cpc);

            Assert.AreEqual(1, mcp.Count);
            Assert.AreEqual(MgGeometryType.MultiCurvePolygon, mcp.GeometryType);
            Assert.AreEqual(2, mcp.Dimension);
        }
示例#20
0
 static Factory()
 {
     if (Configuration.RunningOnWindows) Default = new Windows.WinFactory();
     else if (Configuration.RunningOnMacOS) Default = new MacOS.MacOSFactory();
     else if (Configuration.RunningOnX11) Default = new X11.X11Factory();
     else throw new NotSupportedException( "Running on an unsupported platform, please refer to http://www.opentk.com for more information." );
 }
示例#21
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            MgStringProperty sp = new MgStringProperty("TestStringName", "TestStringValue");

            Assert.AreEqual("TestStringValue", sp.Value);
            Assert.AreEqual("TestStringName", sp.Name);
        }
示例#22
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            ByteReaderTestData.Init();
            var nBytes      = ByteReaderTestData.nBytes;
            var nBlocks     = ByteReaderTestData.nBlocks;
            var testBytes   = ByteReaderTestData.testBytes;
            var infileName  = ByteReaderTestData.infileName;
            var outfileName = ByteReaderTestData.outfileName;

            byte[]       buf    = new byte[nBytes];
            MgByteReader reader = new MgByteReader(infileName, "png", false);

            Assert.AreEqual(nBlocks * nBytes, reader.GetLength());
            reader.Read(buf, nBytes);
            Assert.AreEqual(buf, testBytes);
            Assert.AreEqual((nBlocks - 1) * nBytes, reader.GetLength());
            reader.Rewind();
            Assert.AreEqual(nBlocks * nBytes, reader.GetLength());
            reader.ToFile(outfileName);
            reader.Rewind();

            byte[] buf2             = new byte[nBytes];
            System.IO.FileStream fp = System.IO.File.OpenRead(outfileName);
            for (int j = 0; j < nBlocks; j++)
            {
                fp.Read(buf2, 0, nBytes);
                reader.Read(buf, nBytes);
                Assert.AreEqual(buf, buf2);
            }
            fp.Close();
        }
示例#23
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            string tmp = Path.GetTempFileName();

            try
            {
                File.WriteAllText(tmp, "Hello World");

                MgByteSource bs     = new MgByteSource(tmp);
                MgByteReader reader = bs.GetReader();

                MgGeometryProperty gp      = new MgGeometryProperty("GeomPropName", reader);
                MgByteSource       bs2     = new MgByteSource("../../TestData/DrawingService/SpaceShip.dwf");
                MgByteReader       reader2 = bs2.GetReader();

                gp.Value = reader2;
                Assert.AreEqual(reader2.GetLength(), gp.Value.GetLength());

                Assert.AreEqual(MgPropertyType.Geometry, gp.PropertyType);
            }
            finally
            {
                try
                {
                    File.Delete(tmp);
                }
                catch { }
            }
        }
示例#24
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            MgFileFeatureSourceParams csp = new MgFileFeatureSourceParams();

            csp.ProviderName = "OSGeo.SDF";
            Assert.AreEqual("OSGeo.SDF", csp.ProviderName);

            csp.SpatialContextName = "TestSpatialContextName";
            Assert.AreEqual("TestSpatialContextName", csp.SpatialContextName);

            csp.SpatialContextDescription = "TestSpatialContextDescription";
            Assert.AreEqual("TestSpatialContextDescription", csp.SpatialContextDescription);

            csp.CoordinateSystemWkt = "TestCoordSysWkt";
            Assert.AreEqual("TestCoordSysWkt", csp.CoordinateSystemWkt);

            csp.XYTolerance = 0.0001;
            Assert.AreEqual(0.0001, csp.XYTolerance);

            csp.ZTolerance = 0.01;
            Assert.AreEqual(0.01, csp.ZTolerance);

            MgFeatureSchema schema = new MgFeatureSchema("SchemaName", "SchemaDescription");

            csp.FeatureSchema = schema;
            Assert.AreEqual(schema.Name, csp.FeatureSchema.Name);
            Assert.AreEqual(schema.Description, csp.FeatureSchema.Description);
        }
示例#25
0
        public GraphicsContext(GraphicsMode mode, IWindowInfo window, int major, int minor, GraphicsContextFlags flags)
        {
            lock (GraphicsContext.SyncRoot)
            {
                bool local_0 = false;
                if (mode == null && window == null)
                {
                    local_0 = true;
                }
                else
                {
                    if (mode == null)
                    {
                        throw new ArgumentNullException("mode", "Must be a valid GraphicsMode.");
                    }
                    if (window == null)
                    {
                        throw new ArgumentNullException("window", "Must point to a valid window.");
                    }
                }
                if (major <= 0)
                {
                    major = 1;
                }
                if (minor < 0)
                {
                    minor = 0;
                }
                IGraphicsContext local_1_1 = GraphicsContext.FindSharedContext();
                if (local_0)
                {
                    this.implementation = (IGraphicsContext) new DummyGLContext();
                }
                else
                {
                    IPlatformFactory local_2 = (IPlatformFactory)null;
                    switch ((flags & GraphicsContextFlags.Embedded) == GraphicsContextFlags.Embedded)
                    {
                    case false:
                        local_2 = Factory.Default;
                        break;

                    case true:
                        local_2 = Factory.Embedded;
                        break;
                    }
                    this.implementation = local_2.CreateGLContext(mode, window, local_1_1, GraphicsContext.direct_rendering, major, minor, flags);
                    if (GraphicsContext.GetCurrentContext == null)
                    {
                        GraphicsContext.GetCurrentContextDelegate local_3 = local_2.CreateGetCurrentGraphicsContext();
                        if (local_3 != null)
                        {
                            GraphicsContext.GetCurrentContext = local_3;
                        }
                    }
                }
                GraphicsContext.available_contexts.Add(this.Context, new WeakReference((object)this));
            }
        }
示例#26
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            MgDoubleProperty dp = new MgDoubleProperty("DoublePropName", 4.251973);

            Assert.AreEqual("DoublePropName", dp.Name);
            Assert.AreEqual(MgPropertyType.Double, dp.PropertyType);
            Assert.AreEqual(4.251973, dp.Value);
        }
示例#27
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            MgInt64Property ip = new MgInt64Property("Int64PropName", -9223372036854775808);

            Assert.AreEqual("Int64PropName", ip.Name);
            Assert.AreEqual(MgPropertyType.Int64, ip.PropertyType);
            Assert.AreEqual(Int64.MinValue, ip.Value);
        }
示例#28
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            MgFeatureProperty fp = new MgFeatureProperty("FeatureProp", null);

            Assert.AreEqual("FeatureProp", fp.Name);
            Assert.AreEqual(MgPropertyType.Feature, fp.PropertyType);
            Assert.IsNull(fp.Value);
        }
示例#29
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            MgSingleProperty sp = new MgSingleProperty("SinglePropName", 4.251973f);

            Assert.AreEqual("SinglePropName", sp.Name);
            Assert.AreEqual(MgPropertyType.Single, sp.PropertyType);
            Assert.AreEqual(4.251973f, sp.Value);
        }
示例#30
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            MgRasterProperty rp = new MgRasterProperty("RasterPropName", null);

            Assert.AreEqual("RasterPropName", rp.Name);
            Assert.AreEqual(MgPropertyType.Raster, rp.PropertyType);
            Assert.IsNull(rp.Value);
        }
示例#31
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            MgInt32Property ip = new MgInt32Property("Int32PropName", -2147483648);

            Assert.AreEqual("Int32PropName", ip.Name);
            Assert.AreEqual(MgPropertyType.Int32, ip.PropertyType);
            Assert.AreEqual(Int32.MinValue, ip.Value);
        }
示例#32
0
		static Services ()
		{
#if WIN32
			factory = new WindowsFactory ();
#elif MAC
			factory = new MacFactory ();
#else
			factory = new GnomeFactory ();
#endif
			
			nativeApp = factory.CreateNativeApplication ();
		}