public IEnumerator CheckGetInhibitionScoreForSpecialCase() { ClearInhibitionMeasure(); yield return(null); InhibitionMeasure.imagehitData = new ImageHitStorage(); InhibitionMeasure.imagehitData.Rounds = new List <List <ImageHitRound> >(); for (int i = 0; i <= 10; i++) { List <ImageHitRound> testRound = new List <ImageHitRound>(); for (int j = 0; j <= 10; j++) { ImageHitRound testro = new ImageHitRound(); testro.imageName = "111"; testro.isKeyPressed = true; testRound.Add(testro); } InhibitionMeasure.imagehitData.Rounds.Add(testRound); } float d = InhibitionMeasure.GetInhibitionScore(); Assert.IsTrue(d == 0); }
public IEnumerator CheckGetImageFromRound12() { yield return(null); ObjectRecognitionMeasure.imagehitData = null; ObjectRecognitionMeasure.imagehitData = new ImageHitStorage(); ObjectRecognitionMeasure.imagehitData.Rounds = new List <List <ImageHitRound> >(); List <ImageHitRound> testRound = ObjectRecognitionMeasure.GetImageFromRound12(new ImageHitRound(), null); Assert.True(testRound.Count == 0, "message no Source"); ImageHitRound testro = new ImageHitRound(); testro.imageName = "1"; testro.imageTheme = "1"; List <ImageHitRound> testRound1 = new List <ImageHitRound>(); testRound1.Add(testro); List <ImageHitRound> testRound3 = ObjectRecognitionMeasure.GetImageFromRound12(testro, testRound1); Assert.True(testRound3.Count == 2, "message no Source"); }
public IEnumerator CheckGetInhibitionScoreFromRound12() { ClearInhibitionMeasure(); // Call tested function yield return(null); List <ImageHitRound> ihr = new List <ImageHitRound>(); ihr = null; InhibitionMeasure.GetInhibitionScoreFromRound12(ihr); List <ImageHitRound> ihr1 = new List <ImageHitRound>(); ImageHitRound ih = new ImageHitRound(); ih.isCorrectlyIdentified = true; ihr1.Add(ih); InhibitionMeasure.GetInhibitionScoreFromRound12(ihr1); ihr1 = new List <ImageHitRound>(); ih.isCorrectlyIdentified = false; ih.isSpaceKey = false; ih.isKeyPressed = true; ihr1.Add(ih); InhibitionMeasure.GetInhibitionScoreFromRound12(ihr1); ihr1 = new List <ImageHitRound>(); ImageHitRound ih2 = new ImageHitRound(); ih.isCorrectlyIdentified = true; ih.isSpaceKey = false; ih.isKeyPressed = true; ih2.isCorrectlyIdentified = false; ih2.isSpaceKey = false; ih2.isKeyPressed = true; ihr1.Add(ih); ihr1.Add(ih2); InhibitionMeasure.GetInhibitionScoreFromRound12(ihr1); ihr1 = new List <ImageHitRound>(); ih2 = new ImageHitRound(); ih.isCorrectlyIdentified = true; ih.isSpaceKey = false; ih.isKeyPressed = true; ih2.isCorrectlyIdentified = true; ih2.isSpaceKey = false; ih2.isKeyPressed = true; ihr1.Add(ih); ihr1.Add(ih2); }
public IEnumerator CheckGetKeyNum() { ClearSelectiveVisualMeasure(); yield return(null); SelectiveVisualMeasure.imagehitData = null; float source = SelectiveVisualMeasure.GetKeyNum(0); Assert.True(source == 0, "message no Source"); SelectiveVisualMeasure.imagehitData = new ImageHitStorage(); SelectiveVisualMeasure.imagehitData.Rounds = new List <List <ImageHitRound> >(); for (int i = 0; i <= 10; i++) { List <ImageHitRound> testRound = new List <ImageHitRound>(); for (int j = 0; j <= 10; j++) { ImageHitRound testro = new ImageHitRound(); testro.imageName = "111"; testRound.Add(testro); } SelectiveVisualMeasure.imagehitData.Rounds.Add(testRound); } float source1 = SelectiveVisualMeasure.GetKeyNum(0); Assert.True(source1 == 0, "message no Source"); SelectiveVisualMeasure.imagehitData = null; SelectiveVisualMeasure.imagehitData = new ImageHitStorage(); SelectiveVisualMeasure.imagehitData.Rounds = new List <List <ImageHitRound> >(); for (int i = 0; i <= 10; i++) { List <ImageHitRound> testRound = new List <ImageHitRound>(); for (int j = 0; j <= 10; j++) { ImageHitRound testro = new ImageHitRound(); testro.imageName = "111"; testro.isKeyPressed = j % 2 != 0; testRound.Add(testro); } SelectiveVisualMeasure.imagehitData.Rounds.Add(testRound); } float source2 = SelectiveVisualMeasure.GetKeyNum(0); Assert.True(source2 == 20, "message no Source"); }
public IEnumerator WHEN_ImageHitRound_THEN_ImageHitStorageGetestThemeValue() { round = new ImageHitRound(); round.testTheme = "Test"; // float value string testTheme = "Test"; yield return(null); Assert.IsTrue(testTheme == round.testTheme, "ImageHit getter returning incorrect value: "); }
public IEnumerator WHEN_ImageHitRound_THEN_ImageHitStorageGetskeyPressTimeValue() { round = new ImageHitRound(); round.keyPressTime = 4.9f; // float value float keyPressTime = 4.9f; yield return(null); Assert.IsTrue(keyPressTime == round.keyPressTime, "ImageHit getter returning incorrect value: "); }
public IEnumerator WHEN_ImageHitRoun_THEN_ImageHitStorageGeIsSpaceKeyValue() { round = new ImageHitRound(); round.isSpaceKey = false; bool isSpaceKey = false; yield return(null); Assert.IsTrue(isSpaceKey == round.isSpaceKey, "ImageHit getter returning incorrect value:"); }
public IEnumerator WHEN_ImageHitRoun_THEN_ImageHitStorageGetIsKeyPressedValue() { round = new ImageHitRound(); round.isKeyPressed = false; bool isKeyPressed = false; yield return(null); Assert.IsTrue(isKeyPressed == round.isKeyPressed, "ImageHit getter returning incorrect value:"); }
/// <summary> /// To find images of TImage type. /// After the first stage of the game (the first ten images), the wrong images will be redisplayed. /// FindImage looks for the image in the test image list imagesToFound according to the image name and theme in the previous part of the game. /// Images with identical theme and name are the same images. /// </summary> /// <param name="img"></param> /// <param name="sp"></param> /// <returns>the images find of the images</returns> public TImage FindImage(List <TImage> imagesToFound, ImageHitRound round) { if (imagesToFound != null) { for (int i = 0; i < imagesToFound.Count; i++) { if (imagesToFound[i].imageTheme == round.imageTheme && imagesToFound[i].sprite.name == round.imageName) //The theme of images is the same as the specified theme { return(imagesToFound[i]); } } } return(null); }
/// <summary> /// Called by the system before calling Update() for the first time to initialize data /// </summary> void Start() { currentRoundTestData = new List <ImageHitRound>(); currentImageHitRound = new ImageHitRound(); currentImageHitRound.UnidentifiedKeysPressed = new List <TimeAndKey>(); { imageHitData = new ImageHitStorage(); { imageHitData.Rounds = new List <List <ImageHitRound> >(); } } gameState = -1; mRoundStart = OnRoundStart; StartGame(); }
/// <summary> /// To display the next image /// </summary> public void NextImage() { if (canShowNextImage) { if (serialNumber >= 0 && serialNumber < initialTestImages.Count) { currentImageHitRound = new ImageHitRound(); //The data of this game currentImageHitRound.testTheme = specifiedTheme; //The image theme of this game currentImageHitRound.imageName = initialTestImages[serialNumber].sprite.name; //The name of the specified image currentImageHitRound.imageTheme = initialTestImages[serialNumber].imageTheme; //The theme of the specified image keyPressStartTime = Time.time; //To record the pressing time currentRoundTestData.Add(currentImageHitRound); imageDisplay.sprite = initialTestImages[serialNumber].sprite; // The next image object keyPressStartTime = Time.time; // Start to display the time canShowNextImage = false; } else // images display is done { if (gameState == 0) // The first part is over { gameState = 1; OnRound1Over(); imageDisplayedTime = 0; gameInfo.text = ""; timer.text = ""; imageDisplay.sprite = null; imageDisplay.color = Color.black; prepareTime = 1; } else // the second part is over { gameState = 2; } if (gameState == 2) // the game is over { OnRound2Over(); gameState = -1; gameInfo.text = "ImageHit Test Complete"; timer.text = ""; } } } }
public IEnumerator CheckGetImageFromRound12() { ClearInhibitionMeasure(); // Call tested function yield return(null); ImageHitRound r1 = new ImageHitRound(); List <ImageHitRound> r2 = new List <ImageHitRound>(); r1 = null; InhibitionMeasure.GetImageFromRound12(r1, r2); r1 = new ImageHitRound(); r1.imageName = "1"; r2.Add(r1); InhibitionMeasure.GetImageFromRound12(r1, r2); }
public IEnumerator CheckGetImageKeyPressTimeFromRound12() { yield return(null); ObjectRecognitionMeasure.imagehitData = null; ObjectRecognitionMeasure.imagehitData = new ImageHitStorage(); ObjectRecognitionMeasure.imagehitData.Rounds = new List <List <ImageHitRound> >(); List <ImageHitRound> testRound = new List <ImageHitRound>(); for (int j = 0; j <= 10; j++) { ImageHitRound testro = new ImageHitRound(); testro.imageName = "111"; testro.isCorrectlyIdentified = true; testro.keyPressTime = 0.2f; testRound.Add(testro); } testRound = null; float source1 = ObjectRecognitionMeasure.GetImageKeyTimeFromRound12(testRound); Assert.True(source1 == 0, "message no Source"); ObjectRecognitionMeasure.imagehitData = null; ObjectRecognitionMeasure.imagehitData = new ImageHitStorage(); ObjectRecognitionMeasure.imagehitData.Rounds = new List <List <ImageHitRound> >(); List <ImageHitRound> testRound2 = new List <ImageHitRound>(); for (int j = 0; j <= 10; j++) { ImageHitRound testro = new ImageHitRound(); testro.imageName = "111"; testro.isCorrectlyIdentified = true; testro.keyPressTime = 0.2f; testRound2.Add(testro); } float source2 = ObjectRecognitionMeasure.GetImageKeyTimeFromRound12(testRound2); Assert.True(source2.ToString() == "2.2", "message no Source"); }
public IEnumerator TEST_GetTotalKeyTime_Method() { // Use the Assert class to test conditions. // yield to skip a frame List <ImageHitRound> imagedata = new List <ImageHitRound>(); yield return(null); float temp = TImage.GetTotalKeyTime(imagedata); Assert.IsTrue(temp == 0, "Incorrect GetTotalKeyTime..."); List <ImageHitRound> imagedata1 = new List <ImageHitRound>(); var testRound = new ImageHitRound(); testRound.keyPressTime = 0.2f; imagedata1.Add(testRound); float temp1 = TImage.GetTotalKeyTime(imagedata1); Assert.IsTrue(temp1 == 0.2f, "Incorrect GetTotalKeyTime..."); }
/// <summary> /// Find the images corresponding to the first stage among the images used in the second stage. /// </summary> /// <param name="pround1">Game data (including theme name and image name)</param> /// <param name="pround2">Game data (including theme name and image name)</param> /// <returns></returns> public static List <ImageHitRound> GetImageFromRound12(ImageHitRound pround1, List <ImageHitRound> pround2) { List <ImageHitRound> res = new List <ImageHitRound>(); if (pround1 == null || pround2 == null) { return(res); } int len = pround2.Count; for (int i = 0; i < len; i++) { if (pround2[i].imageName == pround1.imageName && pround2[i].imageTheme == pround1.imageTheme) //Images with identical theme and name are the same images. { res.Add(pround2[i]); } } res.Add(pround1); return(res); }
public IEnumerator TEST_GetKeyPressCount_Method() { // Use the Assert class to test conditions. // yield to skip a frame yield return(null); List <ImageHitRound> imagedata = new List <ImageHitRound>(); int temp = TImage.GetKeyPressCount(imagedata); Assert.IsTrue(temp == 0, "Incorrect GetKeyPressCount value"); List <ImageHitRound> imagedata1 = new List <ImageHitRound>(); var testRound = new ImageHitRound(); testRound.isKeyPressed = true; imagedata1.Add(testRound); int tem1p = TImage.GetKeyPressCount(imagedata1); Assert.IsTrue(tem1p == 1, "Incorrect GetKeyPressCount value"); }
public IEnumerator TEST_GetRightCounte_Method() { // Use the Assert class to test conditions. // yield to skip a frame yield return(null); List <ImageHitRound> imagedata = new List <ImageHitRound>(); float temp = TImage.GetRightCount(imagedata); Assert.IsTrue(temp == 0, "Incorrect GetRightCount..."); List <ImageHitRound> imagedata1 = new List <ImageHitRound>(); var testRound = new ImageHitRound(); testRound.isCorrectlyIdentified = true; imagedata1.Add(testRound); float temp1 = TImage.GetRightCount(imagedata1); Assert.IsTrue(temp1 == 1, "Incorrect GetRightCount..."); }
/// <summary> /// Get the seletive visual ability score each image and store it /// </summary> /// <param name="tmp"> the data of the game</param> /// <returns> The selective visual score for the image hit game </returns> public static float GetScoreFromOneImage(ImageHitRound tmp, float oneKeyScore) { if (tmp == null) { return(0); } if (!tmp.isKeyPressed) // Only when the space bar is pressed, this ability score can count { return(0); } float keyPressTime = tmp.keyPressTime; float level = 0; // In the case of pressing the space, the basic score is 0 points. // If the player presses the space n times, if it is correct to press the space, // each response time is less than 0.5 seconds to get 100/npoints, // 0.5-1 second to get 100/n*85% points, 1-1.5 seconds to get 100/n *75% points, // 1.5-2 seconds to get 100/n*60% points, 2-2.5 seconds to get 100/n*45% points, 2.5-3 seconds to get 100/n*30% points. // In the case of an error by pressing the space, the score will be reduced by two levels according to the correct situation, // that is, 100/n*75% points will be obtained within 0.5 seconds, and so on. In the case of an error, // the reaction time of more than 2 seconds will not be scored. if (tmp.isCorrectlyIdentified) { if (keyPressTime <= 0.5f) { level = 1f; } else if (keyPressTime <= 1.0f) { level = 0.85f; } else if (keyPressTime <= 1.5f) { level = 0.75f; } else if (keyPressTime <= 2.0f) { level = 0.6f; } else if (keyPressTime <= 2.5f) { level = 0.45f; } else if (keyPressTime <= 3.0f) { level = 0.3f; } } else { if (keyPressTime <= 0.5f) { level = 0.75f; } else if (keyPressTime <= 1.0f) { level = 0.6f; } else if (keyPressTime <= 1.5f) { level = 0.45f; } else if (keyPressTime <= 2.0f) { level = 0.3f; } } float fscore = level * oneKeyScore; return(fscore); }
public IEnumerator CheckOnRound1Over() { ImageHit imagehit = imageHitScritps; yield return(new WaitForSeconds(0.5f)); ImageHit.imageHitData = new ImageHitStorage(); imagehit.currentRoundTestData = new List <ImageHitRound>(); imagehit.OnRound1Over(); Assert.True(imagehit.canShowNextImage, "message :The no CheckOnRound1Over"); ImageHit.imageHitData = new ImageHitStorage(); imagehit.currentRoundTestData = new List <ImageHitRound>(); ImageHitRound image1 = new ImageHitRound(); ImageHitRound image2 = new ImageHitRound(); image1.isCorrectlyIdentified = true; imagehit.currentRoundTestData.Add(image1); imagehit.currentRoundTestData.Add(image2); imagehit.OnRound1Over(); Assert.True(imagehit.canShowNextImage, "message :The no CheckOnRound1Over"); ImageHit.imageHitData = new ImageHitStorage(); imagehit.currentRoundTestData = new List <ImageHitRound>(); ImageHitRound image3 = new ImageHitRound(); ImageHitRound image4 = new ImageHitRound(); ImageHitRound image5 = new ImageHitRound(); ImageHitRound image6 = new ImageHitRound(); image3.isCorrectlyIdentified = true; image4.isCorrectlyIdentified = true; image5.isCorrectlyIdentified = true; image6.isCorrectlyIdentified = true; imagehit.currentRoundTestData.Add(image3); imagehit.currentRoundTestData.Add(image4); imagehit.currentRoundTestData.Add(image5); imagehit.currentRoundTestData.Add(image6); imagehit.OnRound1Over(); Assert.True(imagehit.canShowNextImage, "message :The no CheckOnRound1Over"); ImageHit.imageHitData = new ImageHitStorage(); imagehit.currentRoundTestData = new List <ImageHitRound>(); ImageHitRound image7 = new ImageHitRound(); ImageHitRound image8 = new ImageHitRound(); ImageHitRound image9 = new ImageHitRound(); ImageHitRound image10 = new ImageHitRound(); imagehit.currentRoundTestData.Add(image7); imagehit.currentRoundTestData.Add(image8); imagehit.currentRoundTestData.Add(image9); imagehit.currentRoundTestData.Add(image10); imagehit.OnRound1Over(); Assert.True(imagehit.canShowNextImage, "message :The no CheckOnRound1Over"); }
public IEnumerator CheckGetObjectRecognitionScore() { yield return(null); ObjectRecognitionMeasure.imagehitData = null; ObjectRecognitionMeasure.imagehitData = new ImageHitStorage(); ObjectRecognitionMeasure.imagehitData.Rounds = new List <List <ImageHitRound> >(); for (int i = 0; i <= 10; i++) { List <ImageHitRound> testRound = new List <ImageHitRound>(); for (int j = 0; j <= 10; j++) { ImageHitRound testro = new ImageHitRound(); testro.imageName = "111"; testro.isCorrectlyIdentified = true; testro.keyPressTime = 0.2f; testRound.Add(testro); } ObjectRecognitionMeasure.imagehitData.Rounds.Add(testRound); } float source1 = ObjectRecognitionMeasure.GetObjectRecognitionScore(); Assert.True(source1 == 100, "message no Source"); ObjectRecognitionMeasure.imagehitData = null; ObjectRecognitionMeasure.imagehitData = new ImageHitStorage(); ObjectRecognitionMeasure.imagehitData.Rounds = new List <List <ImageHitRound> >(); for (int i = 0; i <= 10; i++) { List <ImageHitRound> testRound = new List <ImageHitRound>(); for (int j = 0; j <= 10; j++) { ImageHitRound testro = new ImageHitRound(); testro.imageName = "111"; testro.isCorrectlyIdentified = true; testro.keyPressTime = 0.7f; testRound.Add(testro); } ObjectRecognitionMeasure.imagehitData.Rounds.Add(testRound); } float source2 = ObjectRecognitionMeasure.GetObjectRecognitionScore(); Assert.True(source2 == 95, "message no Source"); ObjectRecognitionMeasure.imagehitData = null; ObjectRecognitionMeasure.imagehitData = new ImageHitStorage(); ObjectRecognitionMeasure.imagehitData.Rounds = new List <List <ImageHitRound> >(); for (int i = 0; i <= 10; i++) { List <ImageHitRound> testRound = new List <ImageHitRound>(); for (int j = 0; j <= 10; j++) { ImageHitRound testro = new ImageHitRound(); testro.imageName = "111"; testro.isCorrectlyIdentified = true; testro.keyPressTime = 1.2f; testRound.Add(testro); } ObjectRecognitionMeasure.imagehitData.Rounds.Add(testRound); } float source3 = ObjectRecognitionMeasure.GetObjectRecognitionScore(); Assert.True(source3 == 90, "message no Source"); ObjectRecognitionMeasure.imagehitData = null; ObjectRecognitionMeasure.imagehitData = new ImageHitStorage(); ObjectRecognitionMeasure.imagehitData.Rounds = new List <List <ImageHitRound> >(); for (int i = 0; i <= 10; i++) { List <ImageHitRound> testRound = new List <ImageHitRound>(); for (int j = 0; j <= 10; j++) { ImageHitRound testro = new ImageHitRound(); testro.imageName = "111"; testro.isCorrectlyIdentified = true; testro.keyPressTime = 1.8f; testRound.Add(testro); } ObjectRecognitionMeasure.imagehitData.Rounds.Add(testRound); } float source4 = ObjectRecognitionMeasure.GetObjectRecognitionScore(); Assert.True(source4 == 85, "message no Source"); ObjectRecognitionMeasure.imagehitData = null; ObjectRecognitionMeasure.imagehitData = new ImageHitStorage(); ObjectRecognitionMeasure.imagehitData.Rounds = new List <List <ImageHitRound> >(); for (int i = 0; i <= 10; i++) { List <ImageHitRound> testRound = new List <ImageHitRound>(); for (int j = 0; j <= 10; j++) { ImageHitRound testro = new ImageHitRound(); testro.imageName = "111"; testro.isCorrectlyIdentified = true; testro.keyPressTime = 2.3f; testRound.Add(testro); } ObjectRecognitionMeasure.imagehitData.Rounds.Add(testRound); } float source5 = ObjectRecognitionMeasure.GetObjectRecognitionScore(); Assert.True(source5 == 80, "message no Source"); }
public IEnumerator CheckGetScoreFromOneImage() { ClearSelectiveVisualMeasure(); yield return(null); ImageHitRound imageHitRound = new ImageHitRound(); imageHitRound.isKeyPressed = true; imageHitRound.isCorrectlyIdentified = true; float source = SelectiveVisualMeasure.GetScoreFromOneImage(imageHitRound, 30f); Assert.AreEqual(30, source, "message no Source"); ImageHitRound imageHitRound2 = new ImageHitRound(); imageHitRound2.isKeyPressed = true; imageHitRound2.isCorrectlyIdentified = false; imageHitRound2.keyPressTime = 0.6f; float source2 = SelectiveVisualMeasure.GetScoreFromOneImage(imageHitRound2, 30f); Assert.AreEqual(18, source2, "message no Source"); ImageHitRound imageHitRound3 = null; //imageHitRound.isKeyPressed = true; //imageHitRound.isCorrectlyIdentified = false; float source3 = SelectiveVisualMeasure.GetScoreFromOneImage(imageHitRound3, 30f); Assert.AreEqual(0, source3, "message no Source"); ImageHitRound imageHitRound4 = new ImageHitRound(); imageHitRound4.isKeyPressed = false; imageHitRound4.isCorrectlyIdentified = true; imageHitRound4.keyPressTime = 1.2f; float source4 = SelectiveVisualMeasure.GetScoreFromOneImage(imageHitRound4, 30f); Assert.AreEqual(0, source4, "message no Source"); ImageHitRound imageHitRound5 = new ImageHitRound(); imageHitRound5.isKeyPressed = false; imageHitRound5.isCorrectlyIdentified = true; imageHitRound5.keyPressTime = 1.6f; float source5 = SelectiveVisualMeasure.GetScoreFromOneImage(imageHitRound5, 30f); Assert.AreEqual(0, source5, "message no Source"); ImageHitRound imageHitRound6 = new ImageHitRound(); imageHitRound6.isKeyPressed = false; imageHitRound6.isCorrectlyIdentified = true; imageHitRound6.keyPressTime = 2.1f; float source6 = SelectiveVisualMeasure.GetScoreFromOneImage(imageHitRound6, 30f); Assert.AreEqual(0, source6, "message no Source"); ImageHitRound imageHitRound7 = new ImageHitRound(); imageHitRound7.isKeyPressed = false; imageHitRound7.isCorrectlyIdentified = true; imageHitRound7.keyPressTime = 2.6f; float source7 = SelectiveVisualMeasure.GetScoreFromOneImage(imageHitRound7, 30f); Assert.AreEqual(0, source7, "message no Source"); ImageHitRound imageHitRound8 = new ImageHitRound(); imageHitRound8.isKeyPressed = false; imageHitRound8.isCorrectlyIdentified = false; float source8 = SelectiveVisualMeasure.GetScoreFromOneImage(imageHitRound8, 30f); Assert.AreEqual(0, source8, "message no Source"); ImageHitRound imageHitRound9 = new ImageHitRound(); imageHitRound9.isKeyPressed = false; imageHitRound9.isCorrectlyIdentified = false; imageHitRound9.keyPressTime = 0.9f; float source9 = SelectiveVisualMeasure.GetScoreFromOneImage(imageHitRound9, 30f); Assert.AreEqual(0, source9, "message no Source"); ImageHitRound imageHitRound10 = new ImageHitRound(); imageHitRound10.isKeyPressed = false; imageHitRound10.isCorrectlyIdentified = false; imageHitRound10.keyPressTime = 1.1f; float source10 = SelectiveVisualMeasure.GetScoreFromOneImage(imageHitRound10, 30f); Assert.AreEqual(0, source10, "message no Source"); ImageHitRound imageHitRound11 = new ImageHitRound(); imageHitRound11.isKeyPressed = false; imageHitRound11.isCorrectlyIdentified = false; imageHitRound11.keyPressTime = 1.6f; float source11 = SelectiveVisualMeasure.GetScoreFromOneImage(imageHitRound11, 30f); Assert.AreEqual(0, source11, "message no Source"); }
public void SetUp() { // Create example clicks: List <TimeAndPosition> exampleClicks = new List <TimeAndPosition>(); TimeAndPosition timeAndPosition_longTime = new TimeAndPosition(1.5, new Position2D(0, 0)); exampleClicks.Add(timeAndPosition_longTime); // Create example balloon rounds: // balloonRound is an exmaple of round balloonRound.BalloonSize = 60; balloonRound.DestinationPoint = new Position2D(100, 200); balloonRound.DestinationClickTime = 0.8; balloonRound.Clicks = new List <TimeAndPosition>(); balloonRound.SuccessClickPoint = new Position2D(102, 197); // balloonRound_shortestPossibleDestClickTime is an exmaple of round with extreme short DestinationClickTime // which is smaller than 0.15s(the fastest human reaction time) // other fields are the same with balloonRound balloonRound_shortestPossibleDestClickTime.BalloonSize = 60; balloonRound_shortestPossibleDestClickTime.DestinationPoint = new Position2D(100, 200); balloonRound_shortestPossibleDestClickTime.DestinationClickTime = 0.1; // time smaller than 0.15 which is the fastest human reaction time balloonRound_shortestPossibleDestClickTime.Clicks = new List <TimeAndPosition>(); balloonRound_shortestPossibleDestClickTime.SuccessClickPoint = new Position2D(102, 197); // balloonRound_longMoveTimeInDestinationClickTime is an exmaple of round with long DestinationClickTime // other fields are the same with balloonRound balloonRound_longDestinationClickTime.BalloonSize = 60; balloonRound_longDestinationClickTime.DestinationPoint = new Position2D(100, 200); balloonRound_longDestinationClickTime.DestinationClickTime = 1.5; // long destination click time balloonRound_longDestinationClickTime.Clicks = new List <TimeAndPosition>(); balloonRound_longDestinationClickTime.SuccessClickPoint = new Position2D(102, 197); // balloonRound_longMoveTimeInClicks is an exmaple of round with long time in clicks items // other fields are the same with balloonRound balloonRound_longTimeInClicks.BalloonSize = 60; balloonRound_longTimeInClicks.DestinationPoint = new Position2D(100, 200); balloonRound_longTimeInClicks.DestinationClickTime = 0.8; balloonRound_longTimeInClicks.Clicks = exampleClicks; // long time in clicks item balloonRound_longTimeInClicks.SuccessClickPoint = new Position2D(102, 197); // Example squares IndexAndPosition IndexAndPositionIndex0 = new IndexAndPosition(0, new Position2D(0, 0)); IndexAndPosition IndexAndPositionIndex1 = new IndexAndPosition(1, new Position2D(1, 1)); // Set data for round where Highlighted and Recalled are identical in Squares mini-game squareRound_sameOrder.HighlightedSquares = new List <IndexAndPosition>(); squareRound_sameOrder.HighlightedSquares.Add(IndexAndPositionIndex0); squareRound_sameOrder.HighlightedSquares.Add(IndexAndPositionIndex1); squareRound_sameOrder.RecalledSquares = new List <IndexAndPosition>(); squareRound_sameOrder.RecalledSquares.Add(IndexAndPositionIndex0); squareRound_sameOrder.RecalledSquares.Add(IndexAndPositionIndex1); squareRound_sameOrder.RecallTime = 4f; squareRound_sameOrder.SquareHighlightInterval = 0.7f; squareRound_sameOrder.SquareHighlightInterval = 0.7f; // Set data for round where Highlighted and Recalled squares are in a different order in Squares mini-game squareRound_differentOrder.HighlightedSquares = new List <IndexAndPosition>(); squareRound_differentOrder.HighlightedSquares.Add(IndexAndPositionIndex0); squareRound_differentOrder.HighlightedSquares.Add(IndexAndPositionIndex1); squareRound_differentOrder.RecalledSquares = new List <IndexAndPosition>(); squareRound_differentOrder.RecalledSquares.Add(IndexAndPositionIndex1); squareRound_differentOrder.RecalledSquares.Add(IndexAndPositionIndex0); squareRound_differentOrder.RecallTime = 4f; squareRound_differentOrder.SquareHighlightInterval = 0.7f; squareRound_differentOrder.SquareHighlightInterval = 0.7f; // Set data for round where Recalled squares has a gap value in Squares mini-game squareRound_gap.HighlightedSquares = new List <IndexAndPosition>(); squareRound_gap.HighlightedSquares.Add(IndexAndPositionIndex0); squareRound_gap.HighlightedSquares.Add(IndexAndPositionIndex1); squareRound_gap.RecalledSquares = new List <IndexAndPosition>(); squareRound_gap.RecalledSquares.Add(IndexAndPositionIndex0); squareRound_gap.RecallTime = 4f; squareRound_gap.SquareHighlightInterval = 0.7f; squareRound_gap.SquareHighlightInterval = 0.7f; // Set data for round where Recalled squares has a mismatch value in Squares mini-game squareRound_mismatch.HighlightedSquares = new List <IndexAndPosition>(); squareRound_mismatch.HighlightedSquares.Add(IndexAndPositionIndex0); squareRound_mismatch.HighlightedSquares.Add(IndexAndPositionIndex1); squareRound_mismatch.RecalledSquares = new List <IndexAndPosition>(); squareRound_mismatch.RecalledSquares.Add(IndexAndPositionIndex0); squareRound_mismatch.RecallTime = 4f; squareRound_mismatch.SquareHighlightInterval = 0.7f; squareRound_mismatch.SquareHighlightInterval = 0.7f; catchRound.IsIdentifiedKeyPressed = true; catchRound.identifiedKeyPressTime = 0.15f; catchRound.ThiefAppearInRound = false; catchRound.PersonAppearInRound = true; catchRound_longTimeInClicks.IsIdentifiedKeyPressed = true; catchRound_longTimeInClicks.identifiedKeyPressTime = 0.5f; catchRound_longTimeInClicks.ThiefAppearInRound = true; catchRound_longTimeInClicks.PersonAppearInRound = false; catchRound_showTimeInClicks.IsIdentifiedKeyPressed = true; catchRound_showTimeInClicks.identifiedKeyPressTime = 0.8f; catchRound_showTimeInClicks.ThiefAppearInRound = true; catchRound_showTimeInClicks.PersonAppearInRound = false; catchRound_showTimeInClicks.IsIdentifiedKeyPressed = true; catchRound_showTimeInClicks.identifiedKeyPressTime = 0.8f; catchRound_showTimeInClicks.ThiefAppearInRound = true; catchRound_showTimeInClicks.PersonAppearInRound = false; imaghtHitRound.Add(new ImageHitRound()); imahtHitRound_longTimeInClicks.Add(new ImageHitRound()); imageHit_showTimeInClicks.Add(new ImageHitRound()); imaghtHitRound[0] = new ImageHitRound(); imaghtHitRound[0].imageName = ""; imaghtHitRound[0].imageTheme = ""; imaghtHitRound[0].isCorrectlyIdentified = false; imaghtHitRound[0].isKeyPressed = false; imaghtHitRound[0].isSpaceKey = false; imaghtHitRound[0].keyPressTime = 0.5f; imaghtHitRound[0].testTheme = ""; imahtHitRound_longTimeInClicks[0] = new ImageHitRound(); imahtHitRound_longTimeInClicks[0].imageName = ""; imahtHitRound_longTimeInClicks[0].imageTheme = ""; imahtHitRound_longTimeInClicks[0].isCorrectlyIdentified = false; imahtHitRound_longTimeInClicks[0].isKeyPressed = false; imahtHitRound_longTimeInClicks[0].isSpaceKey = false; imahtHitRound_longTimeInClicks[0].keyPressTime = 0.2f; imahtHitRound_longTimeInClicks[0].testTheme = ""; imageHit_showTimeInClicks[0] = new ImageHitRound(); imageHit_showTimeInClicks[0].imageName = ""; imageHit_showTimeInClicks[0].imageTheme = ""; imageHit_showTimeInClicks[0].isCorrectlyIdentified = false; imageHit_showTimeInClicks[0].isKeyPressed = false; imageHit_showTimeInClicks[0].isSpaceKey = false; imageHit_showTimeInClicks[0].keyPressTime = 0.8f; imageHit_showTimeInClicks[0].testTheme = ""; }
public void CreateExampleObjects() { // Create example clicks: List <TimeAndPosition> exampleClicks_normal = new List <TimeAndPosition>(); TimeAndPosition timeAndPosition_normal = new TimeAndPosition(0.8, new Position2D(0, 0)); exampleClicks_normal.Add(timeAndPosition_normal); List <TimeAndPosition> exampleClicks_longTime = new List <TimeAndPosition>(); TimeAndPosition timeAndPosition_longTime = new TimeAndPosition(1.5, new Position2D(0, 0)); exampleClicks_longTime.Add(timeAndPosition_normal); // Create example balloon rounds: // balloonRound is an exmaple of round balloonRound.BalloonSize = 60; balloonRound.DestinationPoint = new Position2D(100, 200); balloonRound.DestinationClickTime = 0.8; balloonRound.Clicks = new List <TimeAndPosition>(); balloonRound.SuccessClickPoint = new Position2D(102, 197); // balloonRound_shortestPossibleDestClickTime is an exmaple of round with extreme short DestinationClickTime // which is smaller than 0.15s(the fastest human reaction time) // other fields are the same with balloonRound balloonRound_shortestPossibleDestClickTime.BalloonSize = 60; balloonRound_shortestPossibleDestClickTime.DestinationPoint = new Position2D(100, 200); balloonRound_shortestPossibleDestClickTime.DestinationClickTime = 0.1; // time smaller than 0.15 which is the fastest human reaction time balloonRound_shortestPossibleDestClickTime.Clicks = new List <TimeAndPosition>(); balloonRound_shortestPossibleDestClickTime.SuccessClickPoint = new Position2D(102, 197); // balloonRound_longDestinationClickTime is an exmaple of round with long DestinationClickTime // other fields are the same with balloonRound balloonRound_longDestinationClickTime.BalloonSize = 60; balloonRound_longDestinationClickTime.DestinationPoint = new Position2D(100, 200); balloonRound_longDestinationClickTime.DestinationClickTime = 1.5; // long destination click time balloonRound_longDestinationClickTime.Clicks = new List <TimeAndPosition>(); balloonRound_longDestinationClickTime.SuccessClickPoint = new Position2D(102, 197); // balloonRound_longTimeInClicks is an exmaple of round with long time in clicks items // other fields are the same with balloonRound balloonRound_longTimeInClicks.BalloonSize = 60; balloonRound_longTimeInClicks.DestinationPoint = new Position2D(100, 200); balloonRound_longTimeInClicks.DestinationClickTime = 0.8; balloonRound_longTimeInClicks.Clicks = exampleClicks_longTime; // long time in clicks item balloonRound_longTimeInClicks.SuccessClickPoint = new Position2D(102, 197); // balloonRound_hasUnsuccessfulClicks is an exmaple of round with one unsuccessful click // other fields are the same with balloonound balloonRound_hasOneUnsuccessfulClick.BalloonSize = 60; balloonRound_hasOneUnsuccessfulClick.DestinationPoint = new Position2D(100, 200); balloonRound_hasOneUnsuccessfulClick.DestinationClickTime = 0.8; balloonRound_hasOneUnsuccessfulClick.Clicks = exampleClicks_normal; // one unsuccessful clicks balloonRound_hasOneUnsuccessfulClick.SuccessClickPoint = new Position2D(102, 197); // balloonRound_has4UnsuccessfulClick has 4 same click items as in balloonRound_hasUnsuccessfulClicks // other fields are the same with balloonRound_hasUnsuccessfulClicks balloonRound_has4UnsuccessfulClick.BalloonSize = 60; balloonRound_has4UnsuccessfulClick.DestinationPoint = new Position2D(100, 200); balloonRound_has4UnsuccessfulClick.Clicks = AddClickItemsNTimes(timeAndPosition_normal, 4); balloonRound_has4UnsuccessfulClick.SuccessClickPoint = new Position2D(102, 197); // balloonRound_has9UnsuccessfulClick has 9 same click items as in balloonRound_hasUnsuccessfulClicks // other fields are the same with balloonRound_hasUnsuccessfulClicks balloonRound_has9UnsuccessfulClick.BalloonSize = 60; balloonRound_has9UnsuccessfulClick.DestinationPoint = new Position2D(100, 200); balloonRound_has9UnsuccessfulClick.Clicks = AddClickItemsNTimes(timeAndPosition_normal, 9); balloonRound_has9UnsuccessfulClick.SuccessClickPoint = new Position2D(102, 197); // balloonRound_has14UnsuccessfulClick has 14 same click items as in balloonRound_hasUnsuccessfulClicks // other fields are the same with balloonRound_hasUnsuccessfulClicks balloonRound_has14UnsuccessfulClick.BalloonSize = 60; balloonRound_has14UnsuccessfulClick.DestinationPoint = new Position2D(100, 200); balloonRound_has14UnsuccessfulClick.Clicks = AddClickItemsNTimes(timeAndPosition_normal, 14); balloonRound_has14UnsuccessfulClick.SuccessClickPoint = new Position2D(102, 197); // balloonRound_has20UnsuccessfulClick has 20 same click items as in balloonRound_hasUnsuccessfulClicks // other fields are the same with balloonRound_hasUnsuccessfulClicks balloonRound_has20UnsuccessfulClick.BalloonSize = 60; balloonRound_has20UnsuccessfulClick.DestinationPoint = new Position2D(100, 200); balloonRound_has20UnsuccessfulClick.Clicks = AddClickItemsNTimes(timeAndPosition_normal, 20); balloonRound_has20UnsuccessfulClick.SuccessClickPoint = new Position2D(102, 197); catchRound.IsIdentifiedKeyPressed = true; catchRound.identifiedKeyPressTime = 0.15f; catchRound.ThiefAppearInRound = false; catchRound.PersonAppearInRound = true; catchRound_longTimeInClicks.IsIdentifiedKeyPressed = true; catchRound_longTimeInClicks.identifiedKeyPressTime = 0.5f; catchRound_longTimeInClicks.ThiefAppearInRound = true; catchRound_longTimeInClicks.PersonAppearInRound = false; catchRound_showTimeInClicks.IsIdentifiedKeyPressed = true; catchRound_showTimeInClicks.identifiedKeyPressTime = 0.8f; catchRound_showTimeInClicks.ThiefAppearInRound = true; catchRound_showTimeInClicks.PersonAppearInRound = false; imaghtHitRound.Add(new ImageHitRound()); imahtHitRound_longTimeInClicks.Add(new ImageHitRound()); imageHit_showTimeInClicks.Add(new ImageHitRound()); imaghtHitRound[0].imageName = ""; imaghtHitRound[0].imageTheme = ""; imaghtHitRound[0].isCorrectlyIdentified = false; imaghtHitRound[0].isKeyPressed = false; imaghtHitRound[0].isSpaceKey = false; imaghtHitRound[0].keyPressTime = 0.5f; imaghtHitRound[0].testTheme = ""; imahtHitRound_longTimeInClicks[0] = new ImageHitRound(); imahtHitRound_longTimeInClicks[0].imageName = ""; imahtHitRound_longTimeInClicks[0].imageTheme = ""; imahtHitRound_longTimeInClicks[0].isCorrectlyIdentified = false; imahtHitRound_longTimeInClicks[0].isKeyPressed = false; imahtHitRound_longTimeInClicks[0].isSpaceKey = false; imahtHitRound_longTimeInClicks[0].keyPressTime = 0.2f; imahtHitRound_longTimeInClicks[0].testTheme = ""; imageHit_showTimeInClicks[0] = new ImageHitRound(); imageHit_showTimeInClicks[0].imageName = ""; imageHit_showTimeInClicks[0].imageTheme = ""; imageHit_showTimeInClicks[0].isCorrectlyIdentified = false; imageHit_showTimeInClicks[0].isKeyPressed = false; imageHit_showTimeInClicks[0].isSpaceKey = false; imageHit_showTimeInClicks[0].keyPressTime = 0.8f; imageHit_showTimeInClicks[0].testTheme = ""; }