public void TesScrollRange()
 {
     NativeScrollBar hscroll = new NativeScrollBar(testDlg.IdentifyFromDialogId(1027));
     int min = 0, max = 0;
     hscroll.GetScrollRange(ref min, ref max);
     Assert.AreEqual(1, min);
     Assert.AreEqual(100, max);
 }
 public void TestConstructor()
 {
     //WindowControlから作成。
     {
         NativeScrollBar scroll = new NativeScrollBar(testDlg.IdentifyFromDialogId(1027));
         Assert.AreEqual(50, scroll.ScrollPos);
     }
     //ハンドルから作成。
     {
         NativeScrollBar scroll = new NativeScrollBar(app, testDlg.IdentifyFromDialogId(1027).Handle);
         Assert.AreEqual(50, scroll.ScrollPos);
     }
 }
 public void TestIsVertical()
 {
     NativeScrollBar hscroll = new NativeScrollBar(testDlg.IdentifyFromDialogId(1027));
     NativeScrollBar vscroll = new NativeScrollBar(testDlg.IdentifyFromDialogId(1028));
     Assert.IsTrue(vscroll.IsVertical);
     Assert.IsFalse(hscroll.IsVertical);
 }
 public void TestScrollPosEventAsync()
 {
     //非同期実行。
     NativeScrollBar scroll = new NativeScrollBar(testDlg.IdentifyFromDialogId(1029));
     Async async = new Async();
     scroll.EmulateScroll(20, async);
     Assert.IsTrue(0 < MessageBoxUtility.CloseAll(testDlg, async));
 }
        public void TestScrollPosEvent()
        {
            NativeScrollBar hscroll = new NativeScrollBar(testDlg.IdentifyFromDialogId(1027));
            Assert.IsTrue(EventChecker.IsSameTestEvent(testDlg,
                delegate { hscroll.EmulateScroll(30); },
                new CodeInfo(1027, NativeMethods.WM_HSCROLL, SB_THUMBTRACK, 30),
                new CodeInfo(1027, NativeMethods.WM_HSCROLL, SB_THUMBPOSITION, 30),
                new CodeInfo(1027, NativeMethods.WM_HSCROLL, SB_ENDSCROLL, 0)));

            NativeScrollBar vscroll = new NativeScrollBar(testDlg.IdentifyFromDialogId(1028));
            Assert.IsTrue(EventChecker.IsSameTestEvent(testDlg,
                delegate { vscroll.EmulateScroll(30); },
                new CodeInfo(1028, NativeMethods.WM_VSCROLL, SB_THUMBTRACK, 30),
                new CodeInfo(1028, NativeMethods.WM_VSCROLL, SB_THUMBPOSITION, 30),
                new CodeInfo(1028, NativeMethods.WM_VSCROLL, SB_ENDSCROLL, 0)));
        }
        public void TestScrollPosValue()
        {
            NativeScrollBar hscroll = new NativeScrollBar(testDlg.IdentifyFromDialogId(1027));
            hscroll.EmulateScroll(30);
            Assert.AreEqual(30, hscroll.ScrollPos);

            NativeScrollBar vscroll = new NativeScrollBar(testDlg.IdentifyFromDialogId(1028));
            vscroll.EmulateScroll(30);
            Assert.AreEqual(30, vscroll.ScrollPos);

            //非同期で実行しても同様の効果があることを確認。
            Async a = new Async();
            vscroll.EmulateScroll(50, a);
            while (!a.IsCompleted)
            {
                Thread.Sleep(10);
            }
            Assert.AreEqual(50, vscroll.ScrollPos);
        }