示例#1
0
        public void TestUrlNavigation_SetNewVisible_UrlUpdatedCorrectly()
        {
            JsVisible visibleBefore = vcPageObj.GetViewport();
            JsVisible visibleAfter  = new JsVisible(-6000000000, 2000000000, 6000000);
            JsVisible urlVisible    = new JsVisible();

            // Get the query string and extract number values from it.
            // It looks like this: #x=7Ga&y=2500000000&s=7000000.
            string          query = new Uri(Driver.Url).Fragment;
            MatchCollection match = Regex.Matches(query, @"[\d]+");

            // It stores in Ga units here, so multiply by one billion. Also, it's negative value.
            urlVisible.CenterX = Convert.ToDouble(match[0].Value) * (-1000000000);
            urlVisible.CenterY = Convert.ToDouble(match[1].Value);
            urlVisible.Scale   = Convert.ToDouble(match[2].Value);

            Assert.AreEqual(visibleBefore, urlVisible);

            // Change visible and check that url changed also.
            vcPageObj.MoveToVisible(visibleAfter, false);
            vcPageObj.WaitAnimation();

            ExecuteScript("updateLayout();");

            // Get the query string and extract number values from it.
            query = new Uri(Driver.Url).Fragment;
            match = Regex.Matches(query, @"[\d]+");

            // It stores in Ga units here, so multiply by one billion. Also, it's negative value.
            urlVisible.CenterX = Convert.ToDouble(match[0].Value) * (-1000000000);
            urlVisible.CenterY = Convert.ToDouble(match[1].Value);
            urlVisible.Scale   = Convert.ToDouble(match[2].Value);

            Assert.AreEqual(visibleAfter, urlVisible);
        }