Ignore:
Timestamp:
2018-12-14T22:23:47+13:00 (5 years ago)
Author:
ak19
Message:

For GUI testing, it's far and away easier if only GUI components had names. Else it's a real pain to access components from the AssertJ Swing API. Introducing setNamesRecursively, a new method (run on the Event Dispatch Thread EDT as is required by the code) that uses reflection to automate setting the names of hopefully all if not all the most important for testing GUI components of GLI. It's called from Gatherer's openGUI which is performed on the EDT, so no need to call invokeLater() to force this method to take place on the Event Dispatch Thread. There are 2 caveats: not sure all the components are named and not all of them appear to have a unique name, so I may expand the code hereafter to add numbering after checking against a hash map for uniqueness if I find this to be necessary

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/gli/src/org/greenstone/gatherer/Gatherer.java

    r32050 r32686  
    755755        }
    756756    }*/
    757 
     757        g_man.setName("GUIManager"); // g_man has a name "frame0" assigned automatically
     758        // setNamesRecursively won't assign a name if one is already set
     759        // Setting explicitly since GUIManager is preferred for its name
     760        GUIManager.setNamesRecursively("", g_man);
     761        GUIManager.printComponentNames(g_man, "");
     762       
    758763        // If there was a collection left open last time, reopen it
    759764        if (open_collection_file_path == null || new File(Gatherer.open_collection_file_path).isDirectory()) {
Note: See TracChangeset for help on using the changeset viewer.