-
-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Work Area: Update Profiler - Readability - OSMAN
- Loading branch information
Showing
29 changed files
with
880 additions
and
153 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# ---------------------------------------------------------------------- | ||
# Wordless: Tests - Utilities - Threading | ||
# Copyright (C) 2018-2024 Ye Lei (叶磊) | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# ---------------------------------------------------------------------- | ||
|
||
from tests import wl_test_init | ||
from wordless.wl_dialogs import wl_dialogs_misc | ||
from wordless.wl_utils import wl_threading | ||
|
||
main = wl_test_init.Wl_Test_Main() | ||
|
||
def test_wl_worker(): | ||
dialog_progress = wl_dialogs_misc.Wl_Dialog_Progress(main, 'test') | ||
wl_threading.Wl_Worker(main, dialog_progress, lambda: None) | ||
|
||
def test_wl_worker_no_progress(): | ||
wl_threading.Wl_Worker_No_Progress(main, lambda: None) | ||
|
||
def test_wl_worker_no_callback(): | ||
dialog_progress = wl_dialogs_misc.Wl_Dialog_Progress(main, 'test') | ||
wl_threading.Wl_Worker_No_Callback(main, dialog_progress) | ||
|
||
def test_wl_thread(): | ||
dialog_progress = wl_dialogs_misc.Wl_Dialog_Progress(main, 'test') | ||
worker = wl_threading.Wl_Worker(main, dialog_progress, lambda: None) | ||
worker.run = lambda: None | ||
|
||
wl_threading.Wl_Thread(worker) | ||
|
||
def test_wl_thread_no_progress(): | ||
worker = wl_threading.Wl_Worker_No_Progress(main, lambda: None) | ||
worker.run = lambda: None | ||
|
||
wl_threading.Wl_Thread_No_Progress(worker).start_worker() | ||
|
||
if __name__ == '__main__': | ||
test_wl_worker() | ||
test_wl_worker_no_progress() | ||
test_wl_worker_no_callback() | ||
|
||
test_wl_thread() | ||
test_wl_thread_no_progress() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
# ---------------------------------------------------------------------- | ||
# Wordless: Tests - Widgets - Boxes | ||
# Copyright (C) 2018-2024 Ye Lei (叶磊) | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# ---------------------------------------------------------------------- | ||
|
||
from tests import wl_test_init | ||
from wordless.wl_widgets import wl_boxes | ||
|
||
main = wl_test_init.Wl_Test_Main() | ||
|
||
def test_wl_combo_box(): | ||
wl_boxes.Wl_Combo_Box(main) | ||
|
||
def test_wl_combo_box_adjustable(): | ||
wl_boxes.Wl_Combo_Box_Adjustable(main) | ||
|
||
def test_wl_combo_box_enums(): | ||
combo_box_enums = wl_boxes.Wl_Combo_Box_Enums(main, {'test1': 1, 'test2': 2}) | ||
assert combo_box_enums.get_val() == 1 | ||
|
||
combo_box_enums.set_val(2) | ||
assert combo_box_enums.get_val() == 2 | ||
|
||
def test_wl_combo_box_yes_no(): | ||
combo_box_yes_no = wl_boxes.Wl_Combo_Box_Yes_No(main) | ||
assert combo_box_yes_no.get_yes_no() | ||
|
||
combo_box_yes_no.set_yes_no(False) | ||
assert not combo_box_yes_no.get_yes_no() | ||
|
||
def test_wl_combo_box_lang(): | ||
wl_boxes.Wl_Combo_Box_Lang(main) | ||
|
||
def test_wl_combo_box_encoding(): | ||
wl_boxes.Wl_Combo_Box_Encoding(main) | ||
|
||
def test_wl_combo_box_measure(): | ||
mapping_measures = list(list(main.settings_global['mapping_measures'].values())[0].items()) | ||
|
||
combo_box_measure = wl_boxes.Wl_Combo_Box_Measure(main, list(main.settings_global['mapping_measures'])[0]) | ||
assert combo_box_measure.get_measure() == mapping_measures[0][1] | ||
|
||
combo_box_measure.set_measure(mapping_measures[1][1]) | ||
assert combo_box_measure.get_measure() == mapping_measures[1][1] | ||
|
||
def test_wl_combo_box_file_to_filter(): | ||
table = wl_test_init.Wl_Test_Table(main) | ||
table.settings['file_area']['files_open'] = [{'selected': True, 'name': 'test'}] | ||
|
||
combo_box_file_to_filter = wl_boxes.Wl_Combo_Box_File_To_Filter(main, table) | ||
combo_box_file_to_filter.table_item_changed() | ||
|
||
def test_wl_combo_box_file(): | ||
combo_box_file = wl_boxes.Wl_Combo_Box_File(main) | ||
combo_box_file.wl_files_changed() | ||
combo_box_file.get_file() | ||
|
||
def test_wl_combo_box_font_family(): | ||
wl_boxes.Wl_Combo_Box_Font_Family(main) | ||
|
||
def test_wl_spin_box(): | ||
wl_boxes.Wl_Spin_Box(main) | ||
|
||
def test_wl_spin_box_window(): | ||
spin_box_window = wl_boxes.Wl_Spin_Box_Window(main) | ||
spin_box_window.setValue(-100) | ||
spin_box_window.stepBy(1) | ||
spin_box_window.setValue(-100) | ||
spin_box_window.stepBy(1) | ||
|
||
def test_wl_spin_box_font_size(): | ||
wl_boxes.Wl_Spin_Box_Font_Size(main) | ||
|
||
def test_wl_spin_box_font_weight(): | ||
wl_boxes.Wl_Spin_Box_Font_Weight(main) | ||
|
||
def test_wl_double_spin_box(): | ||
wl_boxes.Wl_Double_Spin_Box(main) | ||
|
||
def test_wl_double_spin_box_alpha(): | ||
wl_boxes.Wl_Double_Spin_Box_Alpha(main) | ||
|
||
def test_wl_spin_box_no_limit(): | ||
_, checkbox_no_limit = wl_boxes.wl_spin_box_no_limit(main, double = True) | ||
|
||
checkbox_no_limit.setChecked(True) | ||
checkbox_no_limit.setChecked(False) | ||
|
||
wl_boxes.wl_spin_box_no_limit(main, double = False) | ||
|
||
def test_wl_spin_boxes_min_max(): | ||
spin_box_min, spin_box_max = wl_boxes.wl_spin_boxes_min_max(main, double = True) | ||
|
||
spin_box_min.setValue(100) | ||
spin_box_max.setValue(1) | ||
|
||
wl_boxes.wl_spin_boxes_min_max(main, double = False) | ||
|
||
def test_wl_spin_boxes_min_max_no_limit(): | ||
_, checkbox_min_no_limit, _, checkbox_max_no_limit = wl_boxes.wl_spin_boxes_min_max_no_limit(main, double = True) | ||
|
||
checkbox_min_no_limit.setChecked(True) | ||
checkbox_min_no_limit.setChecked(False) | ||
checkbox_max_no_limit.setChecked(True) | ||
checkbox_max_no_limit.setChecked(False) | ||
|
||
wl_boxes.wl_spin_boxes_min_max_no_limit(main, double = False) | ||
|
||
def test_wl_spin_boxes_min_max_sync(): | ||
checkbox_sync, _, spin_box_min, _, spin_box_max = wl_boxes.wl_spin_boxes_min_max_sync(main, double = True) | ||
|
||
checkbox_sync.setChecked(True) | ||
spin_box_min.setValue(100) | ||
spin_box_max.setValue(100) | ||
|
||
wl_boxes.wl_spin_boxes_min_max_sync(main, double = False) | ||
|
||
def test_wl_spin_boxes_min_max_sync_window(): | ||
checkbox_sync, _, spin_box_left, _, spin_box_right = wl_boxes.wl_spin_boxes_min_max_sync_window(main) | ||
|
||
checkbox_sync.setChecked(True) | ||
spin_box_left.setValue(100) | ||
spin_box_right.setValue(100) | ||
|
||
wl_boxes.wl_spin_boxes_min_max_sync_window(main) | ||
|
||
if __name__ == '__main__': | ||
test_wl_combo_box() | ||
test_wl_combo_box_adjustable() | ||
test_wl_combo_box_enums() | ||
test_wl_combo_box_yes_no() | ||
test_wl_combo_box_lang() | ||
test_wl_combo_box_encoding() | ||
test_wl_combo_box_measure() | ||
test_wl_combo_box_file_to_filter() | ||
test_wl_combo_box_file() | ||
test_wl_combo_box_font_family() | ||
|
||
test_wl_spin_box() | ||
test_wl_spin_box_window() | ||
test_wl_spin_box_font_size() | ||
test_wl_spin_box_font_weight() | ||
|
||
test_wl_double_spin_box() | ||
test_wl_double_spin_box_alpha() | ||
|
||
test_wl_spin_box_no_limit() | ||
test_wl_spin_boxes_min_max() | ||
test_wl_spin_boxes_min_max_no_limit() | ||
test_wl_spin_boxes_min_max_sync() | ||
test_wl_spin_boxes_min_max_sync_window() |
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,47 @@ | ||
# ---------------------------------------------------------------------- | ||
# Wordless: Tests - Widgets - Buttons | ||
# Copyright (C) 2018-2024 Ye Lei (叶磊) | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# ---------------------------------------------------------------------- | ||
|
||
from PyQt5.QtWidgets import QLineEdit | ||
|
||
from tests import wl_test_init | ||
from wordless.wl_widgets import wl_buttons | ||
|
||
main = wl_test_init.Wl_Test_Main() | ||
|
||
def test_wl_button(): | ||
wl_buttons.Wl_Button('test', main) | ||
|
||
def test_wl_button_browse(): | ||
wl_buttons.Wl_Button_Browse(main, 'test', QLineEdit(), 'test', ['test']) | ||
|
||
def test_wl_button_color(): | ||
button = wl_buttons.Wl_Button_Color(main) | ||
button.get_color() | ||
button.set_color('test') | ||
|
||
wl_buttons.wl_button_color(main, allow_transparent = True) | ||
wl_buttons.wl_button_color(main, allow_transparent = False) | ||
|
||
def test_wl_button_restore_defaults(): | ||
wl_buttons.Wl_Button_Restore_Defaults(main, 'test') | ||
|
||
if __name__ == '__main__': | ||
test_wl_button() | ||
test_wl_button_browse() | ||
test_wl_button_color() | ||
test_wl_button_restore_defaults() |
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,28 @@ | ||
# ---------------------------------------------------------------------- | ||
# Wordless: Tests - Widgets - Editors | ||
# Copyright (C) 2018-2024 Ye Lei (叶磊) | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# ---------------------------------------------------------------------- | ||
|
||
from tests import wl_test_init | ||
from wordless.wl_widgets import wl_editors | ||
|
||
main = wl_test_init.Wl_Test_Main() | ||
|
||
def test_wl_text_browser(): | ||
wl_editors.Wl_Text_Browser(main) | ||
|
||
if __name__ == '__main__': | ||
test_wl_text_browser() |
Oops, something went wrong.