コード例 #1
0
ファイル: ProfileGridTests.cs プロジェクト: hrpasl/ApsimX
        public void TestEditingNullProperty()
        {
            ExplorerPresenter explorerPresenter = UITestUtilities.OpenResourceFileInTab(Assembly.GetExecutingAssembly(),
                                                                                        "UnitTests.ApsimNG.Resources.SampleFiles.NullSample.apsimx");

            GtkUtilities.WaitForGtkEvents();

            Simulations sims   = explorerPresenter.ApsimXFile;
            Soil        soil   = sims.FindInScope <Soil>();
            Sample      sample = soil.FindChild <Sample>();

            explorerPresenter.SelectNode(sample);
            GtkUtilities.WaitForGtkEvents();

            Assert.IsNull(sample.NO3);

            ProfileView view = explorerPresenter.CurrentRightHandView as ProfileView;
            GridView    grid = view.ProfileGrid as GridView;

            // Click on the first cell in the second column (the NO3N column) and type 1.1 and then hit enter.
            GtkUtilities.ClickOnGridCell(grid, 0, 1, Gdk.EventType.ButtonPress, Gdk.ModifierType.None, GtkUtilities.ButtonPressType.LeftClick);
            GtkUtilities.SendKeyPress(grid.Grid, '1');
            GtkUtilities.SendKeyPress(grid.Grid, '.');
            GtkUtilities.SendKeyPress(grid.Grid, '1');
            GtkUtilities.TypeKey(grid.Grid, Gdk.Key.Return, Gdk.ModifierType.None);

            // The sample's NO3N property should now be an array containing 1.1.
            Assert.NotNull(sample.NO3);
            Assert.AreEqual(new double[1] {
                1.1
            }, sample.NO3);
        }
コード例 #2
0
ファイル: TablePresenterTests.cs プロジェクト: hrpasl/ApsimX
        public void OpenTestFileInTab()
        {
            // Open a simple .apsimx file in the GUI.
            explorerPresenter = UITestUtilities.OpenResourceFileInTab(Assembly.GetExecutingAssembly(),
                                                                      "UnitTests.ApsimNG.Resources.SampleFiles.BasicSimulation.apsimx");
            // Create a table model.
            model      = new DualTableModel();
            model.Name = "Table";

            // Create a datatable and assign it to the model.
            DataTable table = new DataTable();

            table.Columns.Add("test_col", typeof(string));
            table.Rows.Add("test");
            model.Tables = new List <DataTable>()
            {
                table, table.Copy()
            };

            // Add the model to the .apsimx file.
            Structure.Add(model, explorerPresenter.ApsimXFile);
            explorerPresenter.Refresh();

            // Select the table model in the GUI.
            explorerPresenter.SelectNode(model);
            GtkUtilities.WaitForGtkEvents();
        }
コード例 #3
0
ファイル: GridViewTests.cs プロジェクト: hrpasl/ApsimX
 public void OpenTestFileInTab()
 {
     explorerPresenter = UITestUtilities.OpenResourceFileInTab(Assembly.GetExecutingAssembly(),
                                                               "UnitTests.ApsimNG.Resources.SampleFiles.BasicSimulation.apsimx");
     Structure.Add(new SampleModel(), explorerPresenter.ApsimXFile);
 }