diff options
Diffstat (limited to 'sw/qa/uitest/classification/classification.py')
-rw-r--r-- | sw/qa/uitest/classification/classification.py | 251 |
1 files changed, 128 insertions, 123 deletions
diff --git a/sw/qa/uitest/classification/classification.py b/sw/qa/uitest/classification/classification.py index 37feb02c5a42..72f7dd16bb8a 100644 --- a/sw/qa/uitest/classification/classification.py +++ b/sw/qa/uitest/classification/classification.py @@ -38,131 +38,136 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class classification(UITestCase): def test_document_classification_dialog(self): - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() - self.ui_test.execute_dialog_through_command(".uno:ClassificationDialog") - xDialog = self.xUITest.getTopFocusWindow() - classificationEditWindow = xDialog.getChild("classificationEditWindow") - recentlyUsedCB = xDialog.getChild("recentlyUsedCB") - classificationCB = xDialog.getChild("classificationCB") - internationalClassificationCB = xDialog.getChild("internationalClassificationCB") - intellectualPropertyPartEntry = xDialog.getChild("intellectualPropertyPartEntry") - intellectualPropertyPartAddButton = xDialog.getChild("intellectualPropertyPartAddButton") - - select_by_text(classificationCB, "Confidential") - #verify International is set too - self.assertEqual(get_state_as_dict(internationalClassificationCB)["SelectEntryText"], "Confidential") - #verify textBox Content - # self.assertEqual(get_state_as_dict(classificationEditWindow)["Text"], "Conf") - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - - header = document.StyleFamilies.PageStyles.Standard.HeaderText.createEnumeration().nextElement() - self.assertEqual(header.String, "Confidential") - - controller = self.ui_test.get_component().getCurrentController() - self.assertTrue(controller.hasInfobar("classification")) - - #verify watermark - #Bug 122586 - Classification: by using the dialog, Watermark text from policy is not placed in the document - self.ui_test.execute_dialog_through_command(".uno:Watermark") - xDialog = self.xUITest.getTopFocusWindow() - xTextInput = xDialog.getChild("TextInput") - xAngle = xDialog.getChild("Angle") - xTransparency = xDialog.getChild("Transparency") - self.assertEqual(get_state_as_dict(xTextInput)["Text"], "Confidential") - self.assertEqual(get_state_as_dict(xAngle)["Text"], "45°") - self.assertEqual((get_state_as_dict(xTransparency)["Text"])[0:2], "50") - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) - - #TODO - #open dialog and add intellectualProperty text, save - #verify - #reopen and verify classification and Content - - #do the same for Paragraph classification - self.ui_test.execute_dialog_through_command(".uno:ParagraphClassificationDialog") - xDialog = self.xUITest.getTopFocusWindow() - classificationEditWindow = xDialog.getChild("classificationEditWindow") - recentlyUsedCB = xDialog.getChild("recentlyUsedCB") - classificationCB = xDialog.getChild("classificationCB") - internationalClassificationCB = xDialog.getChild("internationalClassificationCB") - intellectualPropertyPartEntry = xDialog.getChild("intellectualPropertyPartEntry") - intellectualPropertyPartAddButton = xDialog.getChild("intellectualPropertyPartAddButton") - - select_by_text(classificationCB, "Confidential") - #verify International is set too - self.assertEqual(get_state_as_dict(internationalClassificationCB)["SelectEntryText"], "Confidential") - #verify textBox Content TODO textbox not supported - #self.assertEqual(get_state_as_dict(classificationEditWindow)["Text"], "Conf") - # print(get_state_as_dict(classificationEditWindow)) - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - - self.assertEqual(document.Text.String[0:6], "(Conf)") - self.assertEqual(header.String, "Confidential") - self.assertTrue(controller.hasInfobar("classification")) + writer_doc = self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + self.ui_test.execute_dialog_through_command(".uno:ClassificationDialog") + xDialog = self.xUITest.getTopFocusWindow() + classificationEditWindow = xDialog.getChild("classificationEditWindow") + recentlyUsedCB = xDialog.getChild("recentlyUsedCB") + classificationCB = xDialog.getChild("classificationCB") + internationalClassificationCB = xDialog.getChild("internationalClassificationCB") + intellectualPropertyPartEntry = xDialog.getChild("intellectualPropertyPartEntry") + intellectualPropertyPartAddButton = xDialog.getChild("intellectualPropertyPartAddButton") + + select_by_text(classificationCB, "Confidential") + #verify International is set too + self.assertEqual(get_state_as_dict(internationalClassificationCB)["SelectEntryText"], "Confidential") + #verify textBox Content + # self.assertEqual(get_state_as_dict(classificationEditWindow)["Text"], "Conf") + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + header = document.StyleFamilies.PageStyles.Standard.HeaderText.createEnumeration().nextElement() + self.assertEqual(header.String, "Confidential") + + controller = self.ui_test.get_component().getCurrentController() + self.assertTrue(controller.hasInfobar("classification")) + + #verify watermark + #Bug 122586 - Classification: by using the dialog, Watermark text from policy is not placed in the document + self.ui_test.execute_dialog_through_command(".uno:Watermark") + xDialog = self.xUITest.getTopFocusWindow() + xTextInput = xDialog.getChild("TextInput") + xAngle = xDialog.getChild("Angle") + xTransparency = xDialog.getChild("Transparency") + self.assertEqual(get_state_as_dict(xTextInput)["Text"], "Confidential") + self.assertEqual(get_state_as_dict(xAngle)["Text"], "45°") + self.assertEqual((get_state_as_dict(xTransparency)["Text"])[0:2], "50") + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + #TODO + #open dialog and add intellectualProperty text, save + #verify + #reopen and verify classification and Content + + #do the same for Paragraph classification + self.ui_test.execute_dialog_through_command(".uno:ParagraphClassificationDialog") + xDialog = self.xUITest.getTopFocusWindow() + classificationEditWindow = xDialog.getChild("classificationEditWindow") + recentlyUsedCB = xDialog.getChild("recentlyUsedCB") + classificationCB = xDialog.getChild("classificationCB") + internationalClassificationCB = xDialog.getChild("internationalClassificationCB") + intellectualPropertyPartEntry = xDialog.getChild("intellectualPropertyPartEntry") + intellectualPropertyPartAddButton = xDialog.getChild("intellectualPropertyPartAddButton") + + select_by_text(classificationCB, "Confidential") + #verify International is set too + self.assertEqual(get_state_as_dict(internationalClassificationCB)["SelectEntryText"], "Confidential") + #verify textBox Content TODO textbox not supported + #self.assertEqual(get_state_as_dict(classificationEditWindow)["Text"], "Conf") + # print(get_state_as_dict(classificationEditWindow)) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.assertEqual(document.Text.String[0:6], "(Conf)") + self.assertEqual(header.String, "Confidential") + self.assertTrue(controller.hasInfobar("classification")) + + self.ui_test.close_doc() def test_paragraph_classification_dialog(self): - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() - #+ new file and do it only for Paragraph classification (no watermark!) - self.ui_test.execute_dialog_through_command(".uno:ParagraphClassificationDialog") - xDialog = self.xUITest.getTopFocusWindow() - classificationEditWindow = xDialog.getChild("classificationEditWindow") - recentlyUsedCB = xDialog.getChild("recentlyUsedCB") - classificationCB = xDialog.getChild("classificationCB") - internationalClassificationCB = xDialog.getChild("internationalClassificationCB") - intellectualPropertyPartEntry = xDialog.getChild("intellectualPropertyPartEntry") - intellectualPropertyPartAddButton = xDialog.getChild("intellectualPropertyPartAddButton") - - select_by_text(classificationCB, "Confidential") - #verify International is set too - self.assertEqual(get_state_as_dict(internationalClassificationCB)["SelectEntryText"], "Confidential") - #verify textBox Content TODO - texbox not supported yet - # self.assertEqual(get_state_as_dict(classificationEditWindow)["Text"], "Conf") - # print(get_state_as_dict(classificationEditWindow)) - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - - controller = self.ui_test.get_component().getCurrentController() - self.assertEqual(document.Text.String[0:6], "(Conf)") - self.assertFalse(controller.hasInfobar("classification")) - self.assertFalse(document.StyleFamilies.PageStyles.Standard.HeaderIsOn) + writer_doc = self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #+ new file and do it only for Paragraph classification (no watermark!) + self.ui_test.execute_dialog_through_command(".uno:ParagraphClassificationDialog") + xDialog = self.xUITest.getTopFocusWindow() + classificationEditWindow = xDialog.getChild("classificationEditWindow") + recentlyUsedCB = xDialog.getChild("recentlyUsedCB") + classificationCB = xDialog.getChild("classificationCB") + internationalClassificationCB = xDialog.getChild("internationalClassificationCB") + intellectualPropertyPartEntry = xDialog.getChild("intellectualPropertyPartEntry") + intellectualPropertyPartAddButton = xDialog.getChild("intellectualPropertyPartAddButton") + + select_by_text(classificationCB, "Confidential") + #verify International is set too + self.assertEqual(get_state_as_dict(internationalClassificationCB)["SelectEntryText"], "Confidential") + #verify textBox Content TODO - texbox not supported yet + # self.assertEqual(get_state_as_dict(classificationEditWindow)["Text"], "Conf") + # print(get_state_as_dict(classificationEditWindow)) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + controller = self.ui_test.get_component().getCurrentController() + self.assertEqual(document.Text.String[0:6], "(Conf)") + self.assertFalse(controller.hasInfobar("classification")) + self.assertFalse(document.StyleFamilies.PageStyles.Standard.HeaderIsOn) + + self.ui_test.close_doc() def test_paragraph_classification_dialog_text(self): - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() - #+ new file and do it only for Paragraph classification (no watermark!) - self.ui_test.execute_dialog_through_command(".uno:ParagraphClassificationDialog") - xDialog = self.xUITest.getTopFocusWindow() - classificationEditWindow = xDialog.getChild("classificationEditWindow") - recentlyUsedCB = xDialog.getChild("recentlyUsedCB") - classificationCB = xDialog.getChild("classificationCB") - internationalClassificationCB = xDialog.getChild("internationalClassificationCB") - intellectualPropertyPartEntry = xDialog.getChild("intellectualPropertyPartEntry") - intellectualPropertyPartAddButton = xDialog.getChild("intellectualPropertyPartAddButton") - #type text AA - intellectualPropertyPartEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"AA"})) - intellectualPropertyPartAddButton.executeAction("CLICK", tuple()) - select_by_text(classificationCB, "Internal Only") - #verify International is set too - self.assertEqual(get_state_as_dict(internationalClassificationCB)["SelectEntryText"], "Internal Only") - #verify textBox Content TODO - texbox not supported yet - # self.assertEqual(get_state_as_dict(classificationEditWindow)["Text"], "Conf") - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - - controller = self.ui_test.get_component().getCurrentController() - self.assertEqual(document.Text.String[0:6], "(AAIO)") - self.assertFalse(controller.hasInfobar("classification")) - self.assertFalse(document.StyleFamilies.PageStyles.Standard.HeaderIsOn) - + writer_doc = self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #+ new file and do it only for Paragraph classification (no watermark!) + self.ui_test.execute_dialog_through_command(".uno:ParagraphClassificationDialog") + xDialog = self.xUITest.getTopFocusWindow() + classificationEditWindow = xDialog.getChild("classificationEditWindow") + recentlyUsedCB = xDialog.getChild("recentlyUsedCB") + classificationCB = xDialog.getChild("classificationCB") + internationalClassificationCB = xDialog.getChild("internationalClassificationCB") + intellectualPropertyPartEntry = xDialog.getChild("intellectualPropertyPartEntry") + intellectualPropertyPartAddButton = xDialog.getChild("intellectualPropertyPartAddButton") + #type text AA + intellectualPropertyPartEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"AA"})) + intellectualPropertyPartAddButton.executeAction("CLICK", tuple()) + select_by_text(classificationCB, "Internal Only") + #verify International is set too + self.assertEqual(get_state_as_dict(internationalClassificationCB)["SelectEntryText"], "Internal Only") + #verify textBox Content TODO - texbox not supported yet + # self.assertEqual(get_state_as_dict(classificationEditWindow)["Text"], "Conf") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + controller = self.ui_test.get_component().getCurrentController() + self.assertEqual(document.Text.String[0:6], "(AAIO)") + self.assertFalse(controller.hasInfobar("classification")) + self.assertFalse(document.StyleFamilies.PageStyles.Standard.HeaderIsOn) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: |