Пример #1
0
        public void TestAddItemsToStoryboard()
        {
            _w.output("START");
            System.Windows.Forms.Form form = new System.Windows.Forms.Form();
            _TestSingleTon.Instance._SetupForLayoutPanelTests();

            FAKE_LayoutPanel panel = new FAKE_LayoutPanel(CoreUtilities.Constants.BLANK, false);

            form.Controls.Add(panel);
            form.Show();

            //NOTE: For now remember that htis ADDS 1 Extra notes
            panel.NewLayout("mynewpanel", true, null);
            NoteDataXML basicNote = new NoteDataXML();

            basicNote.Caption = "note1";

            panel.AddNote(basicNote);
            //basicNote.CreateParent(panel);


            NoteDataXML_GroupEm StoryBoard = new NoteDataXML_GroupEm();

            panel.AddNote(StoryBoard);

            //panel.MoveNote(
            // create four panels A and B at root level. C inside A. D inside C
            FAKE_NoteDataXML_Panel panelA = new FAKE_NoteDataXML_Panel();

            panelA.Caption = "PanelA";
            panel.AddNote(panelA);               // 1



            StoryBoard             = new NoteDataXML_GroupEm();
            StoryBoard.GuidForNote = "storyboard2";
            StoryBoard.Caption     = "storyboard";
            panelA.AddNote(StoryBoard);
            StoryBoard.CreateParent(panelA.GetPanelsLayout());

            Assert.AreEqual(0, StoryBoard.CountStoryBoardItems());


            CoreUtilities.Links.LinkTableRecord record = new CoreUtilities.Links.LinkTableRecord();
            record.sFileName = "PanelA";            //StoryBoard.GuidForNote;
            record.sKey      = "*";
            record.sText     = "*";
            record.sSource   = StoryBoard.GuidForNote;
            panel.GetLinkTable().Add(record);
            Assert.AreEqual(1, panel.GetLinkTable().Count());
            StoryBoard.Refresh();
            Assert.AreEqual(1, StoryBoard.CountStoryBoardItems());
        }
Пример #2
0
        public void TestLinkTables()
        {
            System.Windows.Forms.Form form = new System.Windows.Forms.Form();
            _TestSingleTon.Instance._SetupForLayoutPanelTests();
            LayoutDetails.Instance.AddToList(typeof(FAKE_NoteDataPicture), "pictures");



            FAKE_LayoutPanel panel = new FAKE_LayoutPanel(CoreUtilities.Constants.BLANK, false);

            form.Controls.Add(panel);
            form.Show();

            //NOTE: For now remember that htis ADDS 1 Extra notes
            panel.NewLayout("mynewpanel", true, null);
            NoteDataXML basicNote = new NoteDataXML();

            basicNote.Caption = "note1";

            panel.AddNote(basicNote);
            //basicNote.CreateParent(panel);



            //panel.MoveNote(

            FAKE_NoteDataXML_Panel panelA = new FAKE_NoteDataXML_Panel();

            panelA.Caption = "PanelA";

            FAKE_NoteDataXML_Panel panelB = new FAKE_NoteDataXML_Panel();

            panelB.Caption = "PanelB";


            panel.AddNote(panelA);
            panelA.CreateParent(panel);

            // b is inside A
            panelA.AddNote(panelB);
            panelB.CreateParent(panelA.GetPanelsLayout());


            FAKE_NoteDataPicture picture = new FAKE_NoteDataPicture();

            panelB.AddNote(picture);
            picture.CreateParent(panelB.GetPanelsLayout());
            // add a few more pictures
            picture = new FAKE_NoteDataPicture();
            panelB.AddNote(picture);
            picture.CreateParent(panelB.GetPanelsLayout());


            picture = new FAKE_NoteDataPicture();
            panelB.AddNote(picture);
            picture.CreateParent(panelB.GetPanelsLayout());



            panel.SaveLayout();
            // basic note + LINKTABLE + Default Note + Panel A + Panel B + Picture1 + Picture2 + Picture3= 8
            Assert.AreEqual(8, panel.CountNotes());
            // create several pictures, including in a subpanel, and then count linktables=1
            CoreUtilities.Links.LinkTable panelLinkTable = panelB.GetPanelsLayout().GetLinkTable();
            CoreUtilities.Links.LinkTable MainLinkTable  = panel.GetLinkTable();

            Assert.AreEqual(panelLinkTable, MainLinkTable);

            CoreUtilities.Links.LinkTable dodgeball = new CoreUtilities.Links.LinkTable();
            Assert.AreNotEqual(MainLinkTable, dodgeball);
            //Assert.AreNotEqual(MainLinkTable, panelLinkTable);


            // moves one of the pictures out of the Folder B and into FolderA
            Assert.AreEqual(4, panelA.CountNotes());
            panelB.myLayoutPanel().MoveNote(picture.GuidForNote, "up");
            Assert.AreEqual(4, panelA.CountNotes());              // count should stay the same
            panelA.myLayoutPanel().MoveNote(picture.GuidForNote, "up");
            Assert.AreEqual(3, panelA.CountNotes());              // now that the note is out the count should go down
            Assert.AreEqual(8, panel.CountNotes());
        }