示例#1
0
 public void ActivateTest()
 {
     TestPage samplePage = new TestPage();
     Mocks.TestHostingForm hostingForm = new PropertyPageBaseTest.Mocks.TestHostingForm();
     using (hostingForm)
     {
         hostingForm.CreateControl();
         RECT hostingRectangle;
         hostingRectangle.left = 0;
         hostingRectangle.top = 0;
         hostingRectangle.right = 100;
         hostingRectangle.bottom = 100;
         samplePage.Activate(hostingForm.Handle, new RECT[] { hostingRectangle } , 0);
         TestIPageView testPageView = samplePage.MyPageView as TestIPageView;
         Assert.AreEqual(hostingForm, testPageView.MyParent);
         Assert.AreEqual(Rectangle.FromLTRB(0, 0, 100, 100), testPageView.MyLocation);
         Assert.AreEqual(false, testPageView.IsVisible);
     }
 }
示例#2
0
 public void DeactivateTest()
 {
     TestPage testPage = new TestPage();
     TestIPropertyPageSite testSite = new TestIPropertyPageSite();
     testPage.SetPageSite(testSite);
     Mocks.TestHostingForm hostingForm = new PropertyPageBaseTest.Mocks.TestHostingForm();
     using (hostingForm)
     {
         hostingForm.CreateControl();
         RECT hostingRectangle;
         hostingRectangle.left = 0;
         hostingRectangle.top = 0;
         hostingRectangle.right = 100;
         hostingRectangle.bottom = 100;
         testPage.Activate(hostingForm.Handle, new RECT[] { hostingRectangle } , 0);
         TestIPageView pageView = testPage.MyPageView as TestIPageView;
         Assert.AreEqual(hostingForm, pageView.MyParent);
         testPage.Deactivate();
         Assert.IsNull(pageView.MyParent);
     }
 }
示例#3
0
 public void ShowTest()
 {
     TestPage testPage = new TestPage();
     Mocks.TestHostingForm hostingForm = new PropertyPageBaseTest.Mocks.TestHostingForm();
     using (hostingForm)
     {
         hostingForm.CreateControl();
         RECT hostingRectangle;
         hostingRectangle.left = 0;
         hostingRectangle.top = 0;
         hostingRectangle.right = 100;
         hostingRectangle.bottom = 100;
         testPage.Activate(hostingForm.Handle, new RECT[] { hostingRectangle } , 0);
         TestIPageView pageView = testPage.MyPageView as TestIPageView;
         Assert.IsFalse(pageView.IsVisible);
         testPage.Show(Constants.SW_SHOW);
         Assert.IsTrue(pageView.IsVisible);
         testPage.Show(Constants.SW_HIDE);
         Assert.IsFalse(pageView.IsVisible);
         testPage.Show(Constants.SW_SHOWNORMAL);
         Assert.IsTrue(pageView.IsVisible);
         testPage.Show(7);
         Assert.IsTrue(pageView.IsVisible);
     }
 }
示例#4
0
        public void TranslateAcceleratorTest()
        {
            TestPage testPage = new TestPage();
            Mocks.TestHostingForm hostingForm = new PropertyPageBaseTest.Mocks.TestHostingForm();
            using (hostingForm)
            {
                hostingForm.CreateControl();
                RECT hostingRectangle;
                hostingRectangle.left = 0;
                hostingRectangle.top = 0;
                hostingRectangle.right = 100;
                hostingRectangle.bottom = 100;
                testPage.Activate(hostingForm.Handle, new RECT[] { hostingRectangle } , 0);
                TestIPageView pageView = testPage.MyPageView as TestIPageView;
                pageView.sampleChildHwnd = new IntPtr(10);
                pageView.outLParam = new IntPtr(11);
                pageView.outWParam = new IntPtr(12);

                MSG[] recognizedAcceleratorMessage = new MSG[] { new MSG() };
                recognizedAcceleratorMessage[0].hwnd = pageView.sampleChildHwnd;
                recognizedAcceleratorMessage[0].message = 1;
                recognizedAcceleratorMessage[0].wParam = new IntPtr(2);
                recognizedAcceleratorMessage[0].lParam = new IntPtr(3);

                int hr = testPage.TranslateAccelerator(recognizedAcceleratorMessage);
                Assert.AreEqual(VSConstants.S_OK, hr);
                Assert.AreEqual(pageView.outLParam, recognizedAcceleratorMessage[0].lParam);
                Assert.AreEqual(pageView.outWParam, recognizedAcceleratorMessage[0].wParam);

                MSG[] unrecognizedAcceleratorMessage = new MSG[] { new MSG() };
                unrecognizedAcceleratorMessage[0].hwnd = new IntPtr(100);
                unrecognizedAcceleratorMessage[0].message = 1;
                unrecognizedAcceleratorMessage[0].wParam = new IntPtr(2);
                unrecognizedAcceleratorMessage[0].lParam = new IntPtr(3);

                hr = testPage.TranslateAccelerator(unrecognizedAcceleratorMessage);
                Assert.AreEqual(VSConstants.S_FALSE, hr);
                Assert.AreEqual(new IntPtr(2), unrecognizedAcceleratorMessage[0].wParam);
                Assert.AreEqual(new IntPtr(3), unrecognizedAcceleratorMessage[0].lParam);
            }
        }
示例#5
0
        public void MoveTest()
        {
            TestPage samplePage = new TestPage();
            TestIPropertyPageSite testSite = new TestIPropertyPageSite();

            samplePage.SetPageSite(testSite);
            Mocks.TestHostingForm hostingForm = new PropertyPageBaseTest.Mocks.TestHostingForm();
            using (hostingForm)
            {
                hostingForm.CreateControl();
                RECT hostingRectangle;
                hostingRectangle.left = 0;
                hostingRectangle.top = 0;
                hostingRectangle.right = 100;
                hostingRectangle.bottom = 100;
                samplePage.Activate(hostingForm.Handle, new RECT[] { hostingRectangle } , 0);
                hostingRectangle.left = 0;
                hostingRectangle.top = 0;
                hostingRectangle.right = 90;
                hostingRectangle.bottom = 90;
                samplePage.Move(new RECT[] { hostingRectangle });
                TestIPageView pageView = samplePage.MyPageView as TestIPageView;
                Assert.AreEqual(Rectangle.FromLTRB(0, 0, 90, 90), pageView.MyLocation);
            }
        }