public void AddsGestureConfigDescriptionOnError()
            {
                const string name = "Test-Name";

                var gesture = GestureConfig.ByName(name);

                gesture.Finder = driver => MockFor <IWebElement>();

                Services.Inject(gesture);

                var specContext          = MockFor <ISpecContext>();
                var applicationUnderTest = MockFor <IApplicationUnderTest>();
                var fixture = MockFor <ScreenFixture>();

                fixture.Context = specContext;
                specContext.Stub(x => x.Service <IApplicationUnderTest>()).Return(applicationUnderTest);
                applicationUnderTest.Stub(x => x.Driver).Return(MockFor <IWebDriver>());

                var stepValues = new StepValues("id");

                fixture.SetUp();
                Services.Inject(fixture);

                var exception = Exception <Exception> .ShouldBeThrownBy(() => {
                    ClassUnderTest.Execute(stepValues, null);
                });

                exception.ToString().ShouldContain(name);
            }
예제 #2
0
        public static void gesture_radius(Arg arg)
        {
            BasePlayer basePlayer = ArgEx.Player(arg);

            if (basePlayer == null || !basePlayer.IsAdmin)
            {
                return;
            }
            float         @float = arg.GetFloat(0);
            List <string> list   = Facepunch.Pool.GetList <string>();

            for (int i = 0; i < 5; i++)
            {
                if (!string.IsNullOrEmpty(arg.GetString(i + 1)))
                {
                    list.Add(arg.GetString(i + 1));
                }
            }
            if (list.Count == 0)
            {
                arg.ReplyWith("No gestures provided. eg. player.gesture_radius 10f cabbagepatch raiseroof");
                return;
            }
            List <BasePlayer> obj = Facepunch.Pool.GetList <BasePlayer>();

            global::Vis.Entities(basePlayer.transform.position, @float, obj, 131072);
            foreach (BasePlayer item in obj)
            {
                GestureConfig toPlay = basePlayer.gestureList.StringToGesture(list[Random.Range(0, list.Count)]);
                item.Server_StartGesture(toPlay);
            }
            Facepunch.Pool.FreeList(ref obj);
        }
예제 #3
0
        private ClickGrammar grammarForId(string id)
        {
            var config = new GestureConfig {
                Finder            = () => Driver.FindElement(By.Id(id)),
                FinderDescription = "#" + id,
                Template          = "Clicking " + id
            };

            return(new ClickGrammar(config));
        }
예제 #4
0
        private CheckValueGrammar grammarForId(string id)
        {
            var config = new GestureConfig {
                Finder            = () => theDriver.FindElement(By.Id(id)),
                FinderDescription = "#" + id,
                CellName          = "data"
            };

            return(new CheckValueGrammar(config));
        }
예제 #5
0
        private EnterValueGrammar grammarForName(string name)
        {
            var def = new GestureConfig {
                Template          = "enter {data} for textbox",
                Finder            = () => theDriver.FindElement(By.Name(name)),
                FinderDescription = "name=" + name,
                Description       = "Enter data for blah",
                CellName          = "data",
            };

            return(new EnterValueGrammar(def));
        }
예제 #6
0
    public void loadJSON()
    {
        config = null;
        menu.DirectoryCheck();

        //ファイルがない場合: 初期設定ファイルの生成
        if (!File.Exists(jsonPath))
        {
            config = new GestureConfig();
            makeJSON();
        }

        //ファイルの読込を試行
        try
        {
            //ファイルの内容を一括読み出し
            string jsonString = File.ReadAllText(jsonPath, new UTF8Encoding(false));
            //設定クラスをJSONデコードして生成
            config = JsonUtility.FromJson <GestureConfig>(jsonString);

            //ファイルのバージョンが古い場合は、デフォルト設定にして警告(nullの可能性も考慮してtry内)
            if (config.jsonVer != jsonVerMaster)
            {
                menu.ShowDialogOKCancel(LanguageManager.config.jsonloaders.OLD_CONFIG_HEAD, "" + jsonPath + LanguageManager.config.jsonloaders.OLD_CONFIG_BODY, 3f, () => {
                    //OK
                    makeJSON();
                }, () => {
                    //キャンセル
                });
                config = new GestureConfig();
            }
        }
        catch (System.Exception e)
        {
            //JSONデコードに失敗した場合
            Debug.Log(e.ToString());
            config = null;
        }

        //デコード失敗した場合は、デフォルト設定にして警告
        if (config == null)
        {
            config = new GestureConfig();
            menu.ShowDialogOKCancel(LanguageManager.config.jsonloaders.CORRUPT_CONFIG_HEAD, "" + jsonPath + LanguageManager.config.jsonloaders.CORRUPT_CONFIG_BODY, 3f, () => {
                //OK
                makeJSON();
            }, () => {
                //キャンセル
            });
        }
    }
예제 #7
0
        protected IGrammar Click(By selector  = null, string id       = null, string css = null, string name = null,
                                 string label = null, string template = null)
        {
            var by = selector ?? id.ById() ?? css.ByCss() ?? name.ByName();

            if (by == null)
            {
                throw new InvalidOperationException("Must specify either the selector, css, or name property");
            }

            label = label ?? by.ToString().Replace("By.", "");

            var config = new GestureConfig {
                Template          = template ?? "Click " + label,
                Description       = "Click " + label,
                Finder            = () => SearchContext.FindElement(by),
                FinderDescription = by.ToString()
            };

            return(new ClickGrammar(config));
        }
예제 #8
0
 public static extern bool SetGestureConfig(IntPtr hWnd, int dwReserved, int cIDs, ref GestureConfig pGestureConfig, int cbSize);
 public ErrorGeneratingGesture(ScreenFixture fixture, GestureConfig config) : base(fixture, config)
 {
 }