public void TestUniCode()
 {
     if (!isUni)
     {
         return;
     }
     NativeTree tree = new NativeTree(testDlg.IdentifyFromDialogId(1041));
     tree.EmulateEdit(tree.Nodes[0], "𩸽");
     Assert.AreEqual("𩸽", tree.GetItemText(tree.Nodes[0]));
 }
 public void TestEmulateEditEventAsync()
 {
     NativeTree tree = new NativeTree(testDlg.IdentifyFromDialogId(1042));
     Async async = new Async();
     tree.EmulateEdit(tree.Nodes[0], "ttt", async);
     Assert.IsTrue(0 < MessageBoxUtility.CloseAll(testDlg, async));
 }
        public void TestEdit()
        {
            NativeTree tree = new NativeTree(testDlg.IdentifyFromDialogId(1041));
            tree.EmulateEdit(tree.Nodes[0], "test");
            Assert.AreEqual("test", tree.GetItemText(tree.Nodes[0]));

            //非同期でも同様の効果があることの確認。
            Async a = new Async();
            tree.EmulateEdit(tree.Nodes[0], "test2", a);
            while (!a.IsCompleted)
            {
                Thread.Sleep(10);
            }
            Assert.AreEqual("test2", tree.GetItemText(tree.Nodes[0]));
        }
 public void TestEmulateEditEvent()
 {
     //編集開始 TVN_BEGINLABELEDITが通知されること
     NativeTree tree = new NativeTree(testDlg.IdentifyFromDialogId(1041));
     Assert.IsTrue(EventChecker.IsSameTestEvent(testDlg,
         delegate { tree.EmulateEdit(tree.Nodes[0], "xxx"); },
         //無視
         new CodeInfo[] {
             new CodeInfo(0, NativeMethods.WM_COMMAND, EN_SETFOCUS),
             new CodeInfo(0, NativeMethods.WM_COMMAND, EN_UPDATE),
             new CodeInfo(1, NativeMethods.WM_COMMAND, EN_CHANGE),
             new CodeInfo(1041, NativeMethods.WM_NOTIFY, TVN_SELCHANGING),
             new CodeInfo(1041, NativeMethods.WM_NOTIFY, TVN_ITEMCHANGING),
             new CodeInfo(1041, NativeMethods.WM_NOTIFY, TVN_ITEMCHANGED),
             new CodeInfo(1041, NativeMethods.WM_NOTIFY, TVN_SELCHANGED)
         },
         //確認
         new CodeInfo[] {
             new CodeInfo(1041, NativeMethods.WM_NOTIFY, TVN_BEGINLABELEDIT),
             new CodeInfo(1041, NativeMethods.WM_NOTIFY, TVN_ENDLABELEDIT)
         }));
 }
 public void TestGetItemTextOver256()
 {
     NativeTree tree = new NativeTree(testDlg.IdentifyFromDialogId(1041));
     StringBuilder overText = new StringBuilder();
     for (int i = 0; i < 259; i++)//ツリーの文字数最大がデフォルトで259。
     {
         overText.Append((i % 10).ToString());
     }
     tree.EmulateEdit(tree.Nodes[0], overText.ToString());
     Assert.AreEqual(overText.ToString(), tree.GetItemText(tree.Nodes[0]));
 }