-
Notifications
You must be signed in to change notification settings - Fork 627
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhancement UI changes to ensure copy paste protections. (#162)
Co-authored-by: Undid Iridium <[email protected]>
- Loading branch information
Showing
4 changed files
with
75 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/test/java/com/rarchives/ripme/ui/RipButtonHandlerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.rarchives.ripme.ui; | ||
|
||
import org.junit.jupiter.api.Tag; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import javax.swing.*; | ||
import java.awt.event.ActionEvent; | ||
import java.io.IOException; | ||
import java.util.Collections; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
public class RipButtonHandlerTest { | ||
|
||
|
||
@Test | ||
@Tag("flaky") | ||
public void duplicateUrlTestCase() throws IOException { | ||
// Simulating the MainWindow in our test | ||
MainWindow testMainWindow = new MainWindow(); | ||
SwingUtilities.invokeLater(testMainWindow); | ||
|
||
MainWindow.RipButtonHandler rbHandler = new MainWindow.RipButtonHandler(testMainWindow); | ||
// Creating a RipButtonHandler instance - Changing fake text to cause github to rebuild 1. | ||
|
||
// Add some URL to the model (assuming there's a method for adding URLs) | ||
testMainWindow.getRipTextfield().setText("http://example.com"); | ||
rbHandler.actionPerformed(null); | ||
testMainWindow.getRipTextfield().setText("http://example.com"); | ||
rbHandler.actionPerformed(null); | ||
|
||
// Assuming your MainWindow or RipButtonHandler sets some flag or state | ||
// indicating that a duplicate URL was encountered | ||
assertEquals(testMainWindow.getRipTextfield().getText(), ""); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters