public void TestConstructor()
 {
     //WindowControlから作成。
     {
         NativeSlider slider = new NativeSlider(testDlg.IdentifyFromDialogId(1019));
         Assert.AreEqual(1000, slider.Max);
     }
     //ハンドルから作成。
     {
         NativeSlider slider = new NativeSlider(app, testDlg.IdentifyFromDialogId(1019).Handle);
         Assert.AreEqual(1000, slider.Max);
     }
 }
 public void TestIsVertical()
 {
     NativeSlider slider = new NativeSlider(testDlg.IdentifyFromDialogId(1019));
     NativeSlider vslider = new NativeSlider(testDlg.IdentifyFromDialogId(1026));
     Assert.IsFalse(slider.IsVertical);
     Assert.IsTrue(vslider.IsVertical);
 }
 public void TestMax()
 {
     NativeSlider slider = new NativeSlider(testDlg.IdentifyFromDialogId(1019));
     Assert.AreEqual(1000, slider.Max);
 }
 public void TestPosEventAsync()
 {
     NativeSlider slider = new NativeSlider(testDlg.IdentifyFromDialogId(1020));
     Async async = new Async();
     slider.EmulateChangePos(100, async);
     Assert.IsTrue(0 < MessageBoxUtility.CloseAll(testDlg, async));
 }
        public void TestPosEvent()
        {
            NativeSlider slider = new NativeSlider(testDlg.IdentifyFromDialogId(1019));
            NativeSlider vslider = new NativeSlider(testDlg.IdentifyFromDialogId(1026));

            //同期実行。
            Assert.IsTrue(EventChecker.IsSameTestEvent(testDlg,
                delegate { slider.EmulateChangePos(100); },
                new CodeInfo(1019, NativeMethods.WM_NOTIFY, TRBN_THUMBPOSCHANGING),
                new CodeInfo(1019, NativeMethods.WM_HSCROLL, SB_THUMBPOSITION, 100)));

            //同期実行 縦方向。
            Assert.IsTrue(EventChecker.IsSameTestEvent(testDlg,
                delegate { vslider.EmulateChangePos(100); },
                new CodeInfo(1026, NativeMethods.WM_NOTIFY, TRBN_THUMBPOSCHANGING),
                new CodeInfo(1026, NativeMethods.WM_VSCROLL, SB_THUMBPOSITION, 100)));

            //詳細な通知内容の確認。
            NMTRBTHUMBPOSCHANGING[] expectation = new NMTRBTHUMBPOSCHANGING[1];
            expectation[0].nReason = TB_THUMBTRACK;
            expectation[0].dwPos = 150;
            Assert.IsTrue(EventChecker.CheckNotifyDetail(testDlg,
                delegate { slider.EmulateChangePos(150); },
                expectation));
        }
        public void TestPosValue()
        {
            NativeSlider slider = new NativeSlider(testDlg.IdentifyFromDialogId(1019));
            slider.EmulateChangePos(150);
            Assert.AreEqual(150, slider.Pos);

            //非同期でも同様の効果があることを確認。
            Async a = new Async();
            slider.EmulateChangePos(200, a);
            while (!a.IsCompleted)
            {
                Thread.Sleep(10);
            }
            Assert.AreEqual(200, slider.Pos);
        }