/hg/gfx-test: Added new functionality to gfx. test harness: user...
ptisnovs at icedtea.classpath.org
ptisnovs at icedtea.classpath.org
Thu Oct 7 08:24:53 PDT 2010
changeset faa962e7e25b in /hg/gfx-test
details: http://icedtea.classpath.org/hg/gfx-test?cmd=changeset;node=faa962e7e25b
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Thu Oct 07 17:25:10 2010 +0200
Added new functionality to gfx. test harness: users can now change
paths to reference JRE and tested JRE from GUI, setup basic compile
and run options and also load/store configuration from/to property
file.
diffstat:
5 files changed, 175 insertions(+), 6 deletions(-)
Makefile | 4
gfx_harness.properties | 2
src/org/gfxtest/harness/Configuration.java | 24 ++++-
src/org/gfxtest/harness/Dialogs.java | 24 +++++
src/org/gfxtest/harness/MainWindow.java | 127 ++++++++++++++++++++++++++++
diffs (274 lines):
diff -r 0e7637965815 -r faa962e7e25b Makefile
--- a/Makefile Thu Oct 07 16:34:58 2010 +0200
+++ b/Makefile Thu Oct 07 17:25:10 2010 +0200
@@ -231,7 +231,7 @@ harness: gfxtest.jar
harness: gfxtest.jar
java -cp gfxtest.jar org.gfxtest.harness.MainWindow
-cleanall: clean clean-output clean-results clean-samples
+cleanall: clean clean-output clean-results clean-samples clean-test-build
clean-all: cleanall
@@ -244,6 +244,8 @@ clean-output:
clean-output:
rm -rf $(OUTPUT)
+clean-test-build:
+
clean-results:
rm -rf $(RESULTS)
diff -r 0e7637965815 -r faa962e7e25b gfx_harness.properties
--- a/gfx_harness.properties Thu Oct 07 16:34:58 2010 +0200
+++ b/gfx_harness.properties Thu Oct 07 17:25:10 2010 +0200
@@ -1,4 +1,4 @@
-#Thu Oct 07 15:15:51 CEST 2010
+#Thu Oct 07 17:05:19 CEST 2010
paths.samplesDirectory=samples
paths.outputDirectory=output
compile.verbose=false
diff -r 0e7637965815 -r faa962e7e25b src/org/gfxtest/harness/Configuration.java
--- a/src/org/gfxtest/harness/Configuration.java Thu Oct 07 16:34:58 2010 +0200
+++ b/src/org/gfxtest/harness/Configuration.java Thu Oct 07 17:25:10 2010 +0200
@@ -89,8 +89,10 @@ public class Configuration
e.printStackTrace();
}
- public void readConfiguration()
+ public boolean readConfiguration()
{
+ boolean result = true;
+
// Read properties file.
Properties properties = new Properties();
try
@@ -99,11 +101,13 @@ public class Configuration
}
catch (FileNotFoundException e)
{
+ result = false;
this.printErrorMessage(e);
this.setDefaultValues();
}
catch (IOException e)
{
+ result = false;
this.printErrorMessage(e);
this.setDefaultValues();
}
@@ -111,14 +115,24 @@ public class Configuration
this.setTestedJava(properties.getProperty("jre.tested"));
this.setVerboseCompile("true".equals(properties.getProperty("compile.verbose")));
this.setVerboseRun("true".equals(properties.getProperty("run.verbose")));
- this.setMainWindowWidth(Integer.parseInt(properties.getProperty("mainWindow.width")));
- this.setMainWindowHeight(Integer.parseInt(properties.getProperty("mainWindow.height")));
+ try
+ {
+ this.setMainWindowWidth(Integer.parseInt(properties.getProperty("mainWindow.width")));
+ this.setMainWindowHeight(Integer.parseInt(properties.getProperty("mainWindow.height")));
+ }
+ catch (NumberFormatException e)
+ {
+ System.err.println("warning: can't read integer value from property file");
+ }
this.setSamplesDirectory(properties.getProperty("paths.samplesDirectory"));
this.setOutputDirectory(properties.getProperty("paths.outputDirectory"));
+ return result;
}
- public void writeConfiguration()
+ public boolean writeConfiguration()
{
+ boolean result = true;
+
// Write properties file.
Properties properties = new Properties();
properties.setProperty("jre.reference", this.getReferenceJava());
@@ -136,8 +150,10 @@ public class Configuration
}
catch (IOException e)
{
+ result = false;
e.printStackTrace();
}
+ return result;
}
public String getReferenceJava()
diff -r 0e7637965815 -r faa962e7e25b src/org/gfxtest/harness/Dialogs.java
--- a/src/org/gfxtest/harness/Dialogs.java Thu Oct 07 16:34:58 2010 +0200
+++ b/src/org/gfxtest/harness/Dialogs.java Thu Oct 07 17:25:10 2010 +0200
@@ -90,4 +90,28 @@ public class Dialogs
{
this.infoMessage(ABOUT_TEXT);
}
+
+ public void showDialogAfterLoadConfiguration(boolean result)
+ {
+ if (result)
+ {
+ this.infoMessage("Configuration successfully loaded");
+ }
+ else
+ {
+ this.errorMessage("Error occured during configuration loading!");
+ }
+ }
+
+ public void showDialogAfterSaveConfiguration(boolean result)
+ {
+ if (result)
+ {
+ this.infoMessage("Configuration successfully saved");
+ }
+ else
+ {
+ this.errorMessage("Error occured during configuration saving!");
+ }
+ }
}
diff -r 0e7637965815 -r faa962e7e25b src/org/gfxtest/harness/MainWindow.java
--- a/src/org/gfxtest/harness/MainWindow.java Thu Oct 07 16:34:58 2010 +0200
+++ b/src/org/gfxtest/harness/MainWindow.java Thu Oct 07 17:25:10 2010 +0200
@@ -127,6 +127,81 @@ public class MainWindow
{
JMenu configureMenu = new JMenu("Configure");
configureMenu.setMnemonic(KeyEvent.VK_C);
+
+ JCheckBoxMenuItem verboseCompilation = new JCheckBoxMenuItem("Verbose compilation", this.configuration.isVerboseCompile());
+ verboseCompilation.setHorizontalTextPosition(SwingConstants.RIGHT);
+ verboseCompilation.addItemListener(new ItemListener()
+ {
+ @Override
+ public void itemStateChanged(ItemEvent e)
+ {
+ onCompilationVerboseCheckBoxChanged(e.getStateChange() == ItemEvent.SELECTED);
+ }
+ });
+ configureMenu.add(verboseCompilation);
+
+ JCheckBoxMenuItem verboseTestRun = new JCheckBoxMenuItem("Verbose test run", this.configuration.isVerboseRun());
+ verboseTestRun.setHorizontalTextPosition(SwingConstants.RIGHT);
+ verboseTestRun.addItemListener(new ItemListener()
+ {
+ @Override
+ public void itemStateChanged(ItemEvent e)
+ {
+ onTestRunVerboseCheckBoxChanged(e.getStateChange() == ItemEvent.SELECTED);
+ }
+ });
+ configureMenu.add(verboseTestRun);
+
+ configureMenu.addSeparator();
+
+ JMenuItem referenceJava = new JMenuItem("Path to reference JRE");
+ referenceJava.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_R, ActionEvent.CTRL_MASK));
+ referenceJava.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ onSetReferenceJavaMenuItemSelected();
+ }
+ });
+ configureMenu.add(referenceJava);
+
+ JMenuItem testedJava = new JMenuItem("Path to tested JRE");
+ testedJava.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T, ActionEvent.CTRL_MASK));
+ testedJava.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ onSetTestedJavaMenuItemSelected();
+ }
+ });
+ configureMenu.add(testedJava);
+
+ configureMenu.addSeparator();
+
+ JMenuItem loadConfiguration = new JMenuItem("Load configuration");
+ loadConfiguration.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ onLoadConfigurationMenuItemSelected();
+ }
+ });
+ configureMenu.add(loadConfiguration);
+
+ JMenuItem saveConfiguration = new JMenuItem("Save configuration");
+ saveConfiguration.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ onSaveConfigurationMenuItemSelected();
+ }
+ });
+ configureMenu.add(saveConfiguration);
+
return configureMenu;
}
@@ -487,6 +562,58 @@ public class MainWindow
this.tableIsErasing = false;
}
+ protected void onCompilationVerboseCheckBoxChanged(boolean verboseCompile)
+ {
+ this.configuration.setVerboseCompile(verboseCompile);
+ }
+
+ protected void onTestRunVerboseCheckBoxChanged(boolean verboseRun)
+ {
+ this.configuration.setVerboseRun(verboseRun);
+ }
+
+ private String selectPathToJava(String oldPath, String message)
+ {
+ JFileChooser fc = new JFileChooser(new File(oldPath));
+ fc.setDialogTitle(message);
+ if (fc.showOpenDialog(this.mainWindow) == JFileChooser.APPROVE_OPTION)
+ {
+ File file = fc.getSelectedFile();
+ System.out.println("selected path: " + file.toString());
+ return file.getAbsolutePath();
+ }
+ return null;
+ }
+
+ protected void onSetReferenceJavaMenuItemSelected()
+ {
+ String selectedPath = selectPathToJava(this.configuration.getReferenceJava(),
+ "Path to reference JRE (to file java)");
+ if (selectedPath != null)
+ {
+ this.configuration.setReferenceJava(selectedPath);
+ }
+ }
+
+ protected void onSetTestedJavaMenuItemSelected()
+ {
+ String selectedPath = selectPathToJava(this.configuration.getTestedJava(), "Path to tested JRE (to file java)");
+ if (selectedPath != null)
+ {
+ this.configuration.setTestedJava(selectedPath);
+ }
+ }
+
+ protected void onLoadConfigurationMenuItemSelected()
+ {
+ this.dialogs.showDialogAfterLoadConfiguration(this.configuration.readConfiguration());
+ }
+
+ protected void onSaveConfigurationMenuItemSelected()
+ {
+ this.dialogs.showDialogAfterSaveConfiguration(this.configuration.writeConfiguration());
+ }
+
protected void onHelpAboutMenuSelected()
{
this.dialogs.showAboutDialog();
More information about the distro-pkg-dev
mailing list