This commit is contained in:
top19 2020-05-01 15:38:53 +01:00
commit e49f675bd3
26 changed files with 225 additions and 215 deletions

View file

@ -1,5 +1,5 @@
/**
* @(#) AddWordController.java 0,1 2020/04/30
* @(#) AddWordController.java 0,1 2020/05/01
* <p>
* Copyright (c) 2020 Aberystwyth University.
* All rights reserved.

View file

@ -1,5 +1,5 @@
/**
* @(#) Application.java 0,2 2020/04/30
* @(#) Application.java 0,2 2020/05/01
* <p>
* Copyright (c) 2020 Aberystwyth University.
* All rights reserved.

View file

@ -1,5 +1,5 @@
/**
* @(#) DictionaryController.java 0,1 2020/04/07
* @(#) DictionaryController.java 0,1 2020/05/01
* <p>
* Copyright (c) 2020 Aberystwyth University.
* All rights reserved.

View file

@ -1,5 +1,5 @@
/**
* @(#) FlashcardController.java 0,1 2020/05/07
* @(#) FlashcardController.java 0,1 2020/05/01
*
* Copyright (c) 2020 Aberystwyth University.
* All rights reserved.

View file

@ -1,10 +1,11 @@
package uk.ac.aber.cs221.group20.javafx;
/**
* @(#) MyController.java 0,1 2020/04/07
* @(#) MatchTheMeaningController.java 0,1 2020/05/01
* <p>
* Copyright (c) 2020 Aberystwyth University.
* All rights reserved.
*/
package uk.ac.aber.cs221.group20.javafx;
import javafx.fxml.FXML;
import javafx.scene.control.Alert;

View file

@ -1,5 +1,5 @@
/**
* @(#) PracticeListController.java 0.2 2020/04/30
* @(#) PracticeListController.java 0.2 2020/05/01
* <p>
* Copyright (c) 2020 Aberystwyth University.
* All rights reserved.

View file

@ -1,10 +1,11 @@
package uk.ac.aber.cs221.group20.javafx;
/**
* @(#) ScreenSwitch.java 0.1 2020/04/07
* @(#) ScreenSwitch.java 0.1 2020/05/01
* <p>
* Copyright (c) 2020 Aberystwyth University.
* All rights reserved.
*/
package uk.ac.aber.cs221.group20.javafx;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;

View file

@ -1,5 +1,5 @@
/**
* @(#) FlashcardController.java 0,1 2020/05/07
* @(#) FlashcardController.java 0,1 2020/05/01
*
* Copyright (c) 2020 Aberystwyth University.
* All rights reserved.

View file

@ -1,5 +1,5 @@
/**
* @(#) SixMeaningsController.java 0,1 2020/04/27
* @(#) SixMeaningsController.java 0,1 2020/05/01
*
* Copyright (c) 2020 Aberystwyth University.
* All rights reserved.

View file

@ -1,7 +1,16 @@
/**
@(#) TranslationController.java 1.1 2020/05/01
Copyright (c) 2020 Aberystwyth University.
All rights reserved.
*/
package uk.ac.aber.cs221.group20.javafx;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Alert;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
@ -21,7 +30,7 @@ package uk.ac.aber.cs221.group20.javafx;
* Controller for the translationTest fxml file.
*
* @author Brad Corbett brc9
* @version 0.1
* @version 1.1
*/
public class TranslationController extends SharedCodeController {
@ -83,16 +92,20 @@ public class TranslationController extends SharedCodeController {
@FXML
private void initialize() {
setup();
//Setup of image on screen
currentPageIcon.setImage(new Image("file:src/main/resources/assets/icons/white_icons/50px/pass-fail-50.png"));
currentPageText.setText("Study");
//Setup of image on screen
studyIcon.setImage(new Image("file:src/main/resources/assets/icons/black_icons/50px/pass-fail-50.png"));
studyText.setFill(Color.BLACK);
//Setup of image on screen
submitButton.setImage(new Image("file:src/main/resources/assets/icons/black_icons/50px/right-50.png"));
//Sets answer counters to correct values
correctAnswer.setText(": " + AssessmentGenerator.getTotalCorrectAnswers());
totalAnswer.setText(": " + AssessmentGenerator.getTotalAnswers());
@ -111,16 +124,27 @@ public class TranslationController extends SharedCodeController {
@FXML
void translateWord() {
ArrayList<String> usersInput = new ArrayList<>();
usersInput.add(translationBox.getText());
//Checks to ensure the user has entered a value
if(translationBox.getText().equalsIgnoreCase("")){
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("Error");
alert.setHeaderText("Please enter an answer");
alert.setContentText("Please ensure you enter an answer before clicking submit.");
alert.showAndWait();
}else {
ArrayList<DictionaryEntry> correctTranslation = new ArrayList<>();
correctTranslation.add(answer);
//Creates ArrayList of answers and ArrayList of user answers to check
ArrayList<String> usersInput = new ArrayList<>();
usersInput.add(translationBox.getText());
ArrayList<DictionaryEntry> correctTranslation = new ArrayList<>();
correctTranslation.add(answer);
Question.checkAnswer(correctTranslation, usersInput, AssessmentGenerator.isEnglish());
AssessmentGenerator.goToNextQuestion();
//check user answers against correct answers
Question.checkAnswer(correctTranslation, usersInput, AssessmentGenerator.isEnglish());
//Open the next question of the assessment.
AssessmentGenerator.goToNextQuestion();
}
}

View file

@ -1,5 +1,5 @@
/**
* @(#) DictionaryEntry.java 0,1 2020/04/07
* @(#) DictionaryEntry.java 0,1 2020/05/01
* <p>
* Copyright (c) 2020 Aberystwyth University.
* All rights reserved.

View file

@ -1,11 +1,12 @@
package uk.ac.aber.cs221.group20.json;
/**
* @(#) JsonProcessing.java 0,1 2020/04/27
* @(#) JsonProcessing.java 0,1 2020/05/01
* <p>
* Copyright (c) 2020 Aberystwyth University.
* All rights reserved.
*/
package uk.ac.aber.cs221.group20.json;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

View file

@ -1,3 +1,10 @@
/**
* @(#) AssessmentGenerator.java 0,1 2020/05/01
* <p>
* Copyright (c) 2020 Aberystwyth University.
* All rights reserved.
*/
package uk.ac.aber.cs221.group20.selfassessment;
import javafx.scene.control.Alert;

View file

@ -1,3 +1,10 @@
/**
* @(#) MatchTheMeaningQuestion.java 0,1 2020/05/01
* <p>
* Copyright (c) 2020 Aberystwyth University.
* All rights reserved.
*/
package uk.ac.aber.cs221.group20.selfassessment;
import uk.ac.aber.cs221.group20.json.DictionaryEntry;

View file

@ -1,3 +1,10 @@
/**
* @(#) Question.java 0,1 2020/05/01
* <p>
* Copyright (c) 2020 Aberystwyth University.
* All rights reserved.
*/
package uk.ac.aber.cs221.group20.selfassessment;
import javafx.scene.control.Alert;

View file

@ -1,3 +1,9 @@
/**
* @(#) SixMeaningsQuestion.java 0,1 2020/05/01
* <p>
* Copyright (c) 2020 Aberystwyth University.
* All rights reserved.
*/
package uk.ac.aber.cs221.group20.selfassessment;
import uk.ac.aber.cs221.group20.json.DictionaryEntry;

View file

@ -1,3 +1,9 @@
/**
* @(#) TranslationQuestion.java 0,1 2020/05/01
* <p>
* Copyright (c) 2020 Aberystwyth University.
* All rights reserved.
*/
package uk.ac.aber.cs221.group20.selfassessment;
import uk.ac.aber.cs221.group20.json.DictionaryEntry;

View file

@ -1,51 +0,0 @@
package uk.ac.aber.cs221.group20.test;
import javafx.event.ActionEvent;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import uk.ac.aber.cs221.group20.javafx.AddWordController;
import uk.ac.aber.cs221.group20.javafx.AddWordController;
import static org.junit.jupiter.api.Assertions.*;
class AddWordControllerTest {
AddWordController testController = new AddWordController();
@BeforeEach
void setUp() {
}
@AfterEach
void tearDown() {
}
@Test
void addButtonClick() {
testController.getEnglish();
// assertEquals();*
}
@Test
void testSpecialCharacters(ActionEvent actionEvent) {
testController.addCharch(actionEvent);
testController.addChardd(actionEvent);
testController.addCharff(actionEvent);
testController.addCharng(actionEvent);
testController.addCharll(actionEvent);
testController.addCharph(actionEvent);
testController.addCharrh(actionEvent);
testController.addCharth(actionEvent);
String allChars = "chddffngllphrhth";
assertEquals(allChars,testController.getWelsh().getText());
}
}

View file

@ -1,9 +1,14 @@
/**
* @(#) DictionaryEntryTest.java 0,1 2020/05/01
* <p>
* Copyright (c) 2020 Aberystwyth University.
* All rights reserved.
*/
package uk.ac.aber.cs221.group20.test;
import org.junit.jupiter.api.Test;
import uk.ac.aber.cs221.group20.json.DictionaryEntry;
import uk.ac.aber.cs221.group20.json.JsonProcessing;
import java.util.*;
@ -11,59 +16,59 @@ import static org.junit.jupiter.api.Assertions.*;
/**
* A test class for various tests regarding DictionaryEntry.
* @Author Kab74
* @author Kain Bryan-Jones [kab74]
*/
class DictionaryEntryTest {
LinkedList<DictionaryEntry> testList;
LinkedList<DictionaryEntry> testList;
/**
* Tests whether the default constructor sets isPracticeWord to false upon declaration of a new DictionaryEntry.
*/
@Test
void testPracticeWordFalse(){
DictionaryEntry testDefaultConstructor = new DictionaryEntry();
assertFalse(testDefaultConstructor.isPracticeWord());
}
/**
* Tests whether the default constructor sets isPracticeWord to false upon declaration of a new DictionaryEntry.
*/
@Test
void testPracticeWordFalse(){
DictionaryEntry testDefaultConstructor = new DictionaryEntry();
assertFalse(testDefaultConstructor.isPracticeWord());
}
/**
* Tests whether the setters and getters of the DictionaryEntry class work as intended.
*/
@Test
void testAllSettersAndGetters() {
String english = "abbey";
String welsh = "abaty";
wordTypeEnum wordType = wordTypeEnum.nm;
/**
* Tests whether the setters and getters of the DictionaryEntry class work as intended.
*/
@Test
void testAllSettersAndGetters() {
String english = "abbey";
String welsh = "abaty";
DictionaryEntry.wordTypeEnum wordType = DictionaryEntry.wordTypeEnum.nm;
DictionaryEntry testSettersAndGetters = new DictionaryEntry();
testSettersAndGetters.setEnglish(english);
testSettersAndGetters.setWelsh(welsh);
testSettersAndGetters.setWordType(wordType);
assertTrue(testSettersAndGetters.getEnglish().equals(english) &&
testSettersAndGetters.getWelsh().equals(welsh) &&
testSettersAndGetters.getWordType().equals(wordType));
}
DictionaryEntry testSettersAndGetters = new DictionaryEntry();
testSettersAndGetters.setEnglish(english);
testSettersAndGetters.setWelsh(welsh);
testSettersAndGetters.setWordType(wordType);
assertTrue(testSettersAndGetters.getEnglish().equals(english) &&
testSettersAndGetters.getWelsh().equals(welsh) &&
testSettersAndGetters.getWordType().equals(wordType));
}
/**
* A true-positive test for the equals method in DictionaryEntry.
*/
@Test
public void testEqualsTruePossitive() {
String english = "abbey";
String welsh = "abaty";
wordTypeEnum wordType = wordTypeEnum.nm;
testList = new LinkedList<>(Arrays.asList(new DictionaryEntry(english,welsh,wordType),new DictionaryEntry(english,welsh,wordType)));
assertTrue(testList.get(0).equals(testList.get(1)));
}
/**
* A true-positive test for the equals method in DictionaryEntry.
*/
@Test
public void testEqualsTruePossitive() {
String english = "abbey";
String welsh = "abaty";
DictionaryEntry.wordTypeEnum wordType = DictionaryEntry.wordTypeEnum.nm;
testList = new LinkedList<>(Arrays.asList(new DictionaryEntry(english,welsh,wordType),new DictionaryEntry(english,welsh,wordType)));
assertTrue(testList.get(0).equals(testList.get(1)));
}
/**
* A true-negative test for the equals method in DictionaryEntry.
*/
@Test
public void testEqualsTrueNegative(){
testList = new LinkedList<>(Arrays.asList(new DictionaryEntry("abbey","abaty", wordTypeEnum.nm),new DictionaryEntry("above","dramor",wordTypeEnum.other)));
assertFalse(testList.get(0).equals(testList.get(1)));
}
/**
* A true-negative test for the equals method in DictionaryEntry.
*/
@Test
public void testEqualsTrueNegative(){
testList = new LinkedList<>(Arrays.asList(new DictionaryEntry("abbey","abaty", DictionaryEntry.wordTypeEnum.nm),new DictionaryEntry("above","dramor", DictionaryEntry.wordTypeEnum.other)));
assertFalse(testList.get(0).equals(testList.get(1)));
}

View file

@ -1,54 +0,0 @@
package uk.ac.aber.cs221.group20.test;
/**
* Class that contains methods to test that the application class is correctly storing the full
* list of dictionary definitions.
* Furthermore, this class will also test that the elements such as the sliding menu and score counter are
* working as intended, along with testing that scenes are ending and transitioning correctly when
* applicable.
* @Author
* @Version
* @See
*/
public class JavaFXTest {
/**
* Tests to confirm that the dictionary definitions loaded match to an
* identical base set.
*/
@test public void testDefinition(){
}
/**
* Test to confirm that the user score counter correctly increases
* by increments on one.
*/
@test public void testScoreCounter(){
}
/**
* A preset search test to confirm that words are being searched for
* correctly.
*/
@test public void testFindWord(){
}
/**
* A test to check that a new word is correctly added and saved to
* the JSON file.
*/
@test public void testAddWord(){
}
/**
*A test to check that the JSON file is correctly updated when a
* word is removed.
*/
@test public void testRemoveWord(){
}
}

View file

@ -1,3 +1,10 @@
/**
* @(#) QuestionTest.java 0,1 2020/05/01
* <p>
* Copyright (c) 2020 Aberystwyth University.
* All rights reserved.
*/
package uk.ac.aber.cs221.group20.test;
import org.junit.jupiter.api.Test;

View file

@ -1,36 +0,0 @@
package uk.ac.aber.cs221.group20.test;
/**
* This class will test that the lists pulled in the self-assessment package are indeed
* random, while also pulling the matching data from the dictionary.
* @Author
* @Version
* @See
*/
public class SelfAssesmentTest {
/**
* Test to confirm that the random number return is working
* correctly.
*/
@test
public void testRandomReturn(){
}
/**
* Test to check and confirm that the game types are
* either made available or are locked off depending on the number of practice list questions.
*/
@test
public void testAvailableSelfAssessment(){
}
/**
* Test that will check that an input by a user is correctly checked
* to the correct answer.
*/
@test
public void testUserAnswer(){}
}

View file

@ -16,7 +16,7 @@
<?import javafx.collections.FXCollections?>
<?import java.lang.String?>
<BorderPane minHeight="550" minWidth="500" stylesheets="" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="uk.ac.aber.cs221.group20.javafx.AddWordController">
<BorderPane minHeight="550" minWidth="500" stylesheets="" xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml/1" fx:controller="uk.ac.aber.cs221.group20.javafx.AddWordController">
<left>

View file

@ -19,7 +19,7 @@
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>
<BorderPane fx:id="container" minHeight="550" minWidth="450" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="uk.ac.aber.cs221.group20.javafx.MatchTheMeaningController">
<BorderPane fx:id="container" minHeight="550" minWidth="450" xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml/1" fx:controller="uk.ac.aber.cs221.group20.javafx.MatchTheMeaningController">
<left>

View file

@ -15,7 +15,7 @@
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>
<BorderPane fx:id="container" minHeight="550" minWidth="450" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="uk.ac.aber.cs221.group20.javafx.SixMeaningsController">
<BorderPane fx:id="container" minHeight="550" minWidth="450" xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml/1" fx:controller="uk.ac.aber.cs221.group20.javafx.SixMeaningsController">
<left>

View file

@ -1,19 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.String?>
<?import javafx.collections.FXCollections?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.StackPane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.shape.Rectangle?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>
<BorderPane fx:id="container" minHeight="550" minWidth="450" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="uk.ac.aber.cs221.group20.javafx.TranslationController">
<BorderPane fx:id="container" minHeight="550" minWidth="450" xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml/1" fx:controller="uk.ac.aber.cs221.group20.javafx.TranslationController">
<left>
@ -162,9 +169,81 @@
</Text>
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
<children>
<TextField fx:id="translationBox" prefHeight="45.0" prefWidth="188.0" promptText="Enter translation here" />
<TextField fx:id="translationBox" alignment="CENTER" prefHeight="45.0" prefWidth="188.0" promptText="Enter translation here">
<font>
<Font size="14.0" />
</font></TextField>
<ImageView fx:id="submitButton" fitHeight="46.0" fitWidth="69.0" onMouseClicked="#translateWord" pickOnBounds="true" preserveRatio="true" />
</children>
</HBox>
<HBox alignment="CENTER" prefHeight="41.0" prefWidth="597.0">
<children>
<GridPane prefHeight="41.0" prefWidth="273.0">
<columnConstraints>
<ColumnConstraints halignment="CENTER" hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints halignment="CENTER" hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints halignment="CENTER" hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints halignment="CENTER" hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<ComboBox fx:id="specialChar1" onAction="#specialChar1" prefWidth="56.0" promptText="â">
<items>
<FXCollections fx:factory="observableArrayList">
<String fx:value="â" />
<String fx:value="ê" />
<String fx:value="î" />
<String fx:value="ô" />
<String fx:value="û" />
<String fx:value="ŵ" />
<String fx:value="ŷ" />
</FXCollections>
</items>
</ComboBox>
<ComboBox fx:id="specialChar2" onAction="#specialChar2" prefWidth="56.0" promptText="ä" GridPane.columnIndex="2">
<items>
<FXCollections fx:factory="observableArrayList">
<String fx:value="ä" />
<String fx:value="ë" />
<String fx:value="ï" />
<String fx:value="ö" />
<String fx:value="ü" />
<String fx:value="ẅ" />
<String fx:value="ÿ" />
</FXCollections>
</items>
</ComboBox>
<ComboBox fx:id="specialChar3" onAction="#specialChar3" prefWidth="56.0" promptText="á" GridPane.columnIndex="1">
<items>
<FXCollections fx:factory="observableArrayList">
<String fx:value="á" />
<String fx:value="é" />
<String fx:value="í" />
<String fx:value="ó" />
<String fx:value="ú" />
<String fx:value="ẃ" />
<String fx:value="ý" />
</FXCollections>
</items>
</ComboBox>
<ComboBox fx:id="specialChar4" onAction="#specialChar4" prefWidth="56.0" promptText="à" GridPane.columnIndex="3">
<items>
<FXCollections fx:factory="observableArrayList">
<String fx:value="à" />
<String fx:value="è" />
<String fx:value="ì" />
<String fx:value="ò" />
<String fx:value="ù" />
<String fx:value="ẁ" />
<String fx:value="ỳ" />
</FXCollections>
</items>
</ComboBox>
</children>
</GridPane>
</children>
</HBox>
<Text fx:id="typeOfTest" fill="#8d8d8d" strokeType="OUTSIDE" strokeWidth="0.0" text="Translation">
<font>