Skip to content

Commit

Permalink
Merge pull request #41 from RPA-US/develop
Browse files Browse the repository at this point in the history
Extend variability functions
  • Loading branch information
AntonioRodriguezRuiz authored Aug 2, 2024
2 parents 0705ca0 + 4817169 commit 708f189
Show file tree
Hide file tree
Showing 6 changed files with 323 additions and 27 deletions.
File renamed without changes.
162 changes: 159 additions & 3 deletions configuration/db_populate_v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -1989,7 +1989,7 @@
"filename": "function_trace.json",
"path": "configuration",
"description": "features.experiment.function_trace.description.image_copy_renamed",
"variability_function_category": 4
"variability_function_category": 5
}
},
{
Expand All @@ -2001,7 +2001,7 @@
"filename": "function_trace.json",
"path": "configuration",
"description": "features.experiment.function_trace.description.image_copy_renamed_and_return_path",
"variability_function_category": 4
"variability_function_category": 5
}
},
{
Expand Down Expand Up @@ -2073,7 +2073,7 @@
"filename": "function_trace.json",
"path": "configuration",
"description": "features.experiment.function_trace.description.digits_in_image",
"variability_function_category": 5
"variability_function_category": 4
}
},
{
Expand All @@ -2088,6 +2088,66 @@
"variability_function_category": 4
}
},
{
"model": "wizard.variabilityfunction",
"pk": 29,
"fields": {
"id_code": "person_name_image",
"function_name": "features.experiment.function_trace.name.person_name_image",
"filename": "function_trace.json",
"path": "configuration",
"description": "features.experiment.function_trace.description.person_name_image",
"variability_function_category": 4
}
},
{
"model": "wizard.variabilityfunction",
"pk": 30,
"fields": {
"id_code": "bank_account_image",
"function_name": "features.experiment.function_trace.name.bank_account_image",
"filename": "function_trace.json",
"path": "configuration",
"description": "features.experiment.function_trace.description.bank_account_image",
"variability_function_category": 4
}
},
{
"model": "wizard.variabilityfunction",
"pk": 31,
"fields": {
"id_code": "id_card_image",
"function_name": "features.experiment.function_trace.name.id_card_image",
"filename": "function_trace.json",
"path": "configuration",
"description": "features.experiment.function_trace.description.id_card_image",
"variability_function_category": 4
}
},
{
"model": "wizard.variabilityfunction",
"pk": 32,
"fields": {
"id_code": "digits_text",
"function_name": "features.experiment.function_trace.name.digits_text",
"filename": "function_trace.json",
"path": "configuration",
"description": "features.experiment.function_trace.description.digits_text",
"variability_function_category": 3
}
},
{
"model": "wizard.variabilityfunction",
"pk": 33,
"fields": {
"id_code": "person_name_text",
"function_name": "features.experiment.function_trace.name.person_name_text",
"filename": "function_trace.json",
"path": "configuration",
"description": "features.experiment.function_trace.description.person_name_text",
"variability_function_category": 3
}
},
{
"model": "wizard.functionparam",
"pk": 1,
Expand Down Expand Up @@ -2519,5 +2579,101 @@
"validation_needs": {},
"variability_function": 26
}
},
{
"model": "wizard.functionparam",
"pk": 37,
"fields": {
"id_code": "number_of_digits",
"order": 1,
"description": "features.experiment.param.description.number_of_digits",
"function_param_category": 1,
"validation_needs": {},
"variability_function": 32
}
},
{
"model": "wizard.functionparam",
"pk": 38,
"fields": {
"id_code": "text_number_of_names",
"order": 1,
"description": "features.experiment.param.description.number_of_surnames",
"function_param_category": 1,
"validation_needs": {},
"variability_function": 33
}
},
{
"model": "wizard.functionparam",
"pk": 39,
"fields": {
"id_code": "text_number_of_surnames",
"order": 1,
"description": "features.experiment.param.description.number_of_names",
"function_param_category": 1,
"validation_needs": {},
"variability_function": 33
}
},
{
"model": "wizard.functionparam",
"pk": 40,
"fields": {
"id_code": "person_name_configuration_font",
"order": 1,
"description": "features.experiment.param.description.person_name_configuration_font",
"function_param_category": 4,
"validation_needs": {},
"variability_function": 29
}
},
{
"model": "wizard.functionparam",
"pk": 41,
"fields": {
"id_code": "image_number_of_names",
"order": 2,
"description": "features.experiment.param.description.number_of_names",
"function_param_category": 2,
"validation_needs": {},
"variability_function": 29
}
},
{
"model": "wizard.functionparam",
"pk": 42,
"fields": {
"id_code": "image_number_of_surnames",
"order": 3,
"description": "features.experiment.param.description.number_of_surnames",
"function_param_category": 2,
"validation_needs": {},
"variability_function": 29
}
},
{
"model": "wizard.functionparam",
"pk": 43,
"fields": {
"id_code": "bank_account_configuration_font",
"order": 1,
"description": "features.experiment.param.description.bank_account_configuration_font",
"function_param_category": 4,
"validation_needs": {},
"variability_function": 30
}
},
{
"model": "wizard.functionparam",
"pk": 44,
"fields": {
"id_code": "id_card_configuration_font",
"order": 1,
"description": "features.experiment.param.description.id_card_configuration_font",
"function_param_category": 4,
"validation_needs": {},
"variability_function": 31
}
}
]
7 changes: 6 additions & 1 deletion configuration/function_trace.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,10 @@
"image_copy_renamed_and_return_path": "generate_copied_capture",
"gui_component_status": "gui_component_status",
"status_replace_gui_element_by_other" : "status_replace_gui_element_by_other",
"status_truncated_random_sentence_in_image": "status_truncated_random_sentence_image"
"status_truncated_random_sentence_in_image": "status_truncated_random_sentence_image",
"person_name_image": "person_name_image",
"id_card_image": "id_card_image",
"digits_text": "digits_text",
"person_name_text": "person_name_text",
"bank_account_image": "bank_account_image"
}
29 changes: 29 additions & 0 deletions plugins/screenshot/text_in_image.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import random
from lorem_text import lorem
from .replace_gui_component import insert_text_image
from plugins.text.random_text_lorem import person_name_text, generate_DNI, bank_account_text

###################################################################################################
# Auxiliar functions
Expand Down Expand Up @@ -126,4 +127,32 @@ def truncated_random_sentence_image(args):
s_line_breaks = s[0:num]
args["font_configuration"] = sentence_configuration_font
args["text_to_insert"] = s_line_breaks
return insert_text_image(args)

# Function to insert a name in the image
def person_name_image(args):
"""
Mandatory to have as args Font, Font size, Font color, Background color, Character delimitation, Random max number of word: "args": ["resources/Roboto-Black.ttf", 20, "#000000", "#FFFFFF", 84, 3]
"""
args["text_number_of_names"] = args["image_number_of_names"]
args["text_number_of_surnames"] = args["image_number_of_surnames"]
args["font_configuration"] = args["person_name_configuration_font"]
args["text_to_insert"] = person_name_text(args)
return insert_text_image(args)


def id_card_image(args):
"""
Mandatory to have as args Font, Font size, Font color, Background color, Character delimitation, Random max number of word: "args": ["resources/Roboto-Black.ttf", 20, "#000000", "#FFFFFF", 84, 3]
"""
args["font_configuration"] = args["id_card_configuration_font"]
args["text_to_insert"] = generate_DNI(args)
return insert_text_image(args)

def bank_account_image(args):
"""
Mandatory to have as args Font, Font size, Font color, Background color, Character delimitation, Random max number of word: "args": ["resources/Roboto-Black.ttf", 20, "#000000", "#FFFFFF", 84, 3]
"""
args["font_configuration"] = args["bank_account_configuration_font"]
args["text_to_insert"] = bank_account_text(args)
return insert_text_image(args)
Loading

0 comments on commit 708f189

Please sign in to comment.