Пример #1
0
        public void TestCopyToSquareCanvasWithAllSameSize()
        {
            InterfaceInput inputInterface = Substitute.For <ManagerInputOutput>();

            //Initialize sizes
            float bpmHeight  = 200f;
            float bpmWidth   = 200f;
            int   canvasSize = 200;

            //Determine the ratio for expected results
            float ratio = bpmWidth / canvasSize;

            //Send bitmap with height, width and canvas to tested method
            Bitmap bpmAfterMethodCanvas = inputInterface.CopyToSquareCanevas(new Bitmap((int)bpmWidth, (int)bpmHeight), canvasSize);

            //All expected sizes
            float bpmWidthExpected  = canvasSize;
            float bpmHeightExpected = bpmHeight / ratio;
            //Tested sizes
            float widthResult  = (float)bpmAfterMethodCanvas.Width;
            float heigthResult = (float)bpmAfterMethodCanvas.Height;

            //Compare values
            Assert.AreEqual(bpmWidthExpected, widthResult);
            Assert.AreEqual(bpmHeightExpected, heigthResult);
        }
Пример #2
0
        public void TestLoadImageFromComputer()
        {
            InterfaceInput inputInterface = Substitute.For <ManagerInputOutput>();

            Bitmap orginalBitmap = RetrieveImage.RetrieveOriginalPicture();
            Bitmap bitmapToLoadBeforeCopyToSquare = inputInterface.LoadImage();
            Bitmap bitmapToLoadAfterCopyToSquare  = inputInterface.CopyToSquareCanevas(bitmapToLoadBeforeCopyToSquare, 900);

            Assert.IsTrue(RetrieveImage.Equals(orginalBitmap, bitmapToLoadAfterCopyToSquare));
        }
Пример #3
0
    void Awake()
    {
        instance = this;

#if UNITY_EDITOR
        input = new InputTouchscreen();
#elif UNITY_STANDALONE_WIN
        input = new InputKeyboard();
#elif UNITY_ANDROID
        input = new InputTouchscreen();
#endif
    }
Пример #4
0
 private bool GetRight()
 {
     return(InterfaceInput.Instance().Player.GetButtonDown("right"));
 }
Пример #5
0
 private bool GetLeft()
 {
     return(InterfaceInput.Instance().Player.GetButtonDown("left"));
 }