# -*- coding: utf-8 -*-

def main():
    startApplication("sasview")
    activateItem(waitForObjectItem(":MainWindow.menubar_QMenuBar", "File"))
    activateItem(waitForObjectItem(":MainWindow.menu_File_QMenu", "Load Data File(s)"))
    test.compare(waitForObjectExists(":QFileDialog_QFileDialog").visible, True)
    test.compare(waitForObjectExists(":QFileDialog_QFileDialog").enabled, True)
    test.compare(str(waitForObjectExists(":Data Explorer.fileTypeCombo_QComboBox").currentText), "All (*.*)")
    sendEvent("QCloseEvent", waitForObject(":QFileDialog_QFileDialog"))
    activateItem(waitForObjectItem(":MainWindow.menubar_QMenuBar", "File"))
    activateItem(waitForObjectItem(":MainWindow.menu_File_QMenu", "Load Data Folder"))
    test.compare(waitForObjectExists(":QFileDialog_QFileDialog").visible, True)
    test.compare(waitForObjectExists(":QFileDialog_QFileDialog").enabled, True)
    test.compare(str(waitForObjectExists(":QFileDialog_QFileDialog").windowTitle), "Choose a directory")
    test.compare(str(waitForObjectExists(":Data Explorer.fileTypeCombo_QComboBox").currentText), "Directories")
    clickButton(waitForObject(":buttonBox.Cancel_QPushButton"))
    activateItem(waitForObjectItem(":MainWindow.menubar_QMenuBar", "File"))
    activateItem(waitForObjectItem(":MainWindow.menu_File_QMenu", "Open Project"))
    test.compare(str(waitForObjectExists(":QFileDialog_QFileDialog").windowTitle), "Open Project")
    test.compare(waitForObjectExists(":QFileDialog_QFileDialog").visible, True)
    test.compare(waitForObjectExists(":QFileDialog_QFileDialog").enabled, True)
    test.compare(str(waitForObjectExists(":Data Explorer.fileTypeCombo_QComboBox").currentText), "Project (*.json)")
    clickButton(waitForObject(":buttonBox.Cancel_QPushButton"))
    activateItem(waitForObjectItem(":MainWindow.menubar_QMenuBar", "File"))
    activateItem(waitForObjectItem(":MainWindow.menu_File_QMenu", "Save Project"))
    test.compare(str(waitForObjectExists(":QFileDialog_QFileDialog").windowTitle), "Save Project")
    test.compare(waitForObjectExists(":QFileDialog_QFileDialog").visible, True)
    test.compare(waitForObjectExists(":QFileDialog_QFileDialog").enabled, True)
    test.compare(str(waitForObjectExists(":Data Explorer.fileTypeCombo_QComboBox").currentText), "Project (*.json)")
    clickButton(waitForObject(":buttonBox.Cancel_QPushButton"))
    activateItem(waitForObjectItem(":MainWindow.menubar_QMenuBar", "File"))
    activateItem(waitForObjectItem(":MainWindow.menu_File_QMenu", "Quit"))
    test.compare(str(waitForObjectExists(":Information_QMessageBox").text), "Are you sure you want to exit the application?")
    test.compare(waitForObjectExists(":Information_QMessageBox").visible, True)
    test.compare(waitForObjectExists(":Information.Yes_QPushButton").default, True)
    clickButton(waitForObject(":Information.No_QPushButton"))
