updated the keyboard shortcut test to reflect the new config file format

This commit is contained in:
fgerlits 2006-03-31 19:39:09 +00:00
parent 462f8aa936
commit e04f313474
5 changed files with 29 additions and 38 deletions

View file

@ -1,23 +1,17 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE keyboardShortcutContainer [
<!ELEMENT keyboardShortcutContainer (windowName, keyboardShortcut+) >
<!ELEMENT windowName (#PCDATA) >
<!ELEMENT keyboardShortcut (action, key+) >
<!ELEMENT action (#PCDATA) >
<!ELEMENT key (#PCDATA) >
<!ELEMENT keyboardShortcutContainer (keyboardShortcut+) >
<!ATTLIST keyboardShortcutContainer windowName CDATA #REQUIRED >
<!ELEMENT keyboardShortcut EMPTY >
<!ATTLIST keyboardShortcut action CDATA #REQUIRED >
<!ATTLIST keyboardShortcut key CDATA #REQUIRED >
]>
<keyboardShortcutContainer>
<windowName>hiMyNameIsWindow</windowName>
<keyboardShortcut>
<action>playAudio</action>
<key>P</key>
</keyboardShortcut>
<keyboardShortcut>
<action>pauseAudio</action>
<key>Ctrl-P</key>
<key>Space</key>
</keyboardShortcut>
<keyboardShortcutContainer windowName = "hiMyNameIsWindow">
<keyboardShortcut action = "playAudio" key = "p" />
<keyboardShortcut action = "pauseAudio" key = "&lt;Control&gt;p" />
<keyboardShortcut action = "stopAudio" key = "space" />
</keyboardShortcutContainer>

View file

@ -73,7 +73,7 @@ const std::string configFileName = "etc/keyboardShortcut.xml";
* Set up the test environment
*----------------------------------------------------------------------------*/
void
KeyboardShortcutTest :: setUp(void) throw ()
KeyboardShortcutTest :: setUp(void) throw (CPPUNIT_NS::Exception)
{
std::ifstream ifs;
ifs.open(configFileName.c_str());
@ -97,11 +97,11 @@ KeyboardShortcutTest :: setUp(void) throw ()
} catch (std::invalid_argument &e) {
ifs.close();
CPPUNIT_FAIL("semantic error in audio player configuration file: "
CPPUNIT_FAIL("semantic error in keyboard shortcuts configuration file: "
+ std::string(e.what()));
} catch (xmlpp::exception &e) {
ifs.close();
CPPUNIT_FAIL("syntax error in audio player configuration file: "
CPPUNIT_FAIL("syntax error in keyboard shortcuts configuration file: "
+ std::string(e.what()));
}
ifs.close();
@ -124,25 +124,25 @@ void
KeyboardShortcutTest :: firstTest(void)
throw (CPPUNIT_NS::Exception)
{
CPPUNIT_ASSERT(ksc->findAction(0, GDK_P)
CPPUNIT_ASSERT(ksc->findAction(Gdk::ModifierType(0), GDK_p)
== KeyboardShortcut::playAudio);
CPPUNIT_ASSERT(ksc->findAction(GDK_MOD2_MASK|GDK_LOCK_MASK, GDK_P)
CPPUNIT_ASSERT(ksc->findAction(Gdk::MOD2_MASK | Gdk::LOCK_MASK, GDK_p)
== KeyboardShortcut::playAudio);
CPPUNIT_ASSERT(ksc->findAction(GDK_CONTROL_MASK, GDK_P)
CPPUNIT_ASSERT(ksc->findAction(Gdk::CONTROL_MASK, GDK_p)
== KeyboardShortcut::pauseAudio);
CPPUNIT_ASSERT(ksc->findAction(0, GDK_space)
== KeyboardShortcut::pauseAudio);
CPPUNIT_ASSERT(ksc->findAction(Gdk::ModifierType(0), GDK_space)
== KeyboardShortcut::stopAudio);
CPPUNIT_ASSERT(ksc->findAction(0, GDK_Q)
CPPUNIT_ASSERT(ksc->findAction(Gdk::ModifierType(0), GDK_q)
== KeyboardShortcut::noAction);
CPPUNIT_ASSERT(ksc->findAction(GDK_CONTROL_MASK, GDK_W)
CPPUNIT_ASSERT(ksc->findAction(Gdk::CONTROL_MASK, GDK_w)
== KeyboardShortcut::noAction);
CPPUNIT_ASSERT(ksc->findAction(0xffffff, 0xffffff)
CPPUNIT_ASSERT(ksc->findAction(Gdk::ModifierType(0xffffff), 0xffffff)
== KeyboardShortcut::noAction);
}

View file

@ -96,7 +96,7 @@ class KeyboardShortcutTest : public BaseTestMethod
* Set up the environment for the test case.
*/
void
setUp(void) throw ();
setUp(void) throw (CPPUNIT_NS::Exception);
/**
* Clean up the environment after the test case.

View file

@ -109,8 +109,6 @@ Ptr<std::string>::Ref xsltFileName;
/* =============================================== local function prototypes */
namespace {
/**
* Print program version.
*
@ -140,7 +138,6 @@ printUsage ( const char invocation[],
bool
processArguments(int argc, char *argv[]);
}
/* ============================================================= module code */
@ -194,7 +191,7 @@ main( int argc,
/*------------------------------------------------------------------------------
* Process command line arguments.
*----------------------------------------------------------------------------*/
static bool
bool
processArguments(int argc, char *argv[])
{
int i;
@ -248,7 +245,7 @@ processArguments(int argc, char *argv[])
/*------------------------------------------------------------------------------
* Print program version.
*----------------------------------------------------------------------------*/
static void
void
printVersion ( std::ostream & os )
{
os << PACKAGE_NAME << ' ' << PACKAGE_VERSION << std::endl
@ -260,7 +257,7 @@ printVersion ( std::ostream & os )
/*------------------------------------------------------------------------------
* Print program usage.
*----------------------------------------------------------------------------*/
static void
void
printUsage ( const char invocation[],
std::ostream & os )
{

View file

@ -96,7 +96,7 @@ const struct option longOptions[] =
*
* @param os the std::ostream to print to.
*/
static void
void
printVersion ( std::ostream & os );
/**
@ -105,7 +105,7 @@ printVersion ( std::ostream & os );
* @param invocation the command line command used to invoke this program.
* @param os the std::ostream to print to.
*/
static void
void
printUsage ( const char invocation[],
std::ostream & os );
@ -191,7 +191,7 @@ int main ( int argc,
/*------------------------------------------------------------------------------
* Print program version.
*----------------------------------------------------------------------------*/
static void
void
printVersion ( std::ostream & os )
{
os << PACKAGE_NAME << ' ' << PACKAGE_VERSION << std::endl
@ -202,7 +202,7 @@ printVersion ( std::ostream & os )
/*------------------------------------------------------------------------------
* Print program usage.
*----------------------------------------------------------------------------*/
static void
void
printUsage ( const char invocation[],
std::ostream & os )
{