-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
39 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import os | ||
import sys | ||
import tkinter | ||
|
||
sys.path.append(os.path.abspath(os.path.join(os.path.abspath(__file__), '../../../sources/Overwatch Rank Tracker'))) | ||
import MainWindow # noqa: E402. It imports it and recognizes it, I don't know why the Python interpreter is flagging an error | ||
|
||
|
||
def test_center_window(): | ||
"""""" | ||
|
||
# create window | ||
test_window = tkinter.Tk() | ||
|
||
# set window size | ||
window_width = 125 | ||
window_height = 225 | ||
|
||
# calling window centering function | ||
MainWindow.center_window(window=test_window, window_height=window_height, window_width=window_width) | ||
|
||
# getting window coordinates after centering | ||
x_coord = test_window.winfo_x() | ||
y_coord = test_window.winfo_y() | ||
|
||
# calculate expected coordinates for centered window | ||
screen_width = test_window.winfo_screenwidth() | ||
screen_height = test_window.winfo_screenheight() | ||
expected_x = (screen_width / 2) - (window_width / 2) | ||
expected_y = (screen_height / 2) - (window_height / 2) | ||
|
||
assert (x_coord, y_coord) == (expected_x, expected_y) |
Empty file.
Empty file.
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