Example #1
0
        public void PasteFromClipboard_WithEmptyClipboard()
        {
            string result = null;

            System.Threading.Thread t = new System.Threading.Thread(() =>
            {
                var pManager = new PersistenceManager();
                var tree     = pManager.NewTree();
                var editor   = new NoteEditor();
                var form     = CreateForm();
                form.Controls.Add(editor);
                var sut     = new ImagePaster(editor, pManager);
                form.Shown += (sender, args) =>
                {
                    Clipboard.Clear();
                    ImagePaster.PasteFromClipboard(editor, tree);
                    result = editor.HTML;
                    form.Close();
                };
                form.ShowDialog();
            });
            t.SetApartmentState(System.Threading.ApartmentState.STA);
            t.Start();
            t.Join();
            Assert.IsNull(result);
        }
Example #2
0
        public void PasteFromClipboard()
        {
            string result = null;

            System.Threading.Thread t = new System.Threading.Thread(() =>
            {
                var pManager = new PersistenceManager();
                var tree     = pManager.NewTree();
                var editor   = new NoteEditor();
                var form     = CreateForm();
                form.Controls.Add(editor);
                var sut     = new ImagePaster(editor, pManager);
                form.Shown += (sender, args) =>
                {
                    Clipboard.SetImage(Bitmap.FromFile(@"Resources\MapCtrl1.png"));
                    ImagePaster.PasteFromClipboard(editor, tree);
                    result = editor.HTML;
                    form.Close();
                };
                form.ShowDialog();
            });
            t.SetApartmentState(System.Threading.ApartmentState.STA);
            t.Start();
            t.Join();
            Assert.IsTrue(result.ToLower().Contains("img"));
        }