updated the keyboard shortcut test to reflect the new config file format
This commit is contained in:
parent
462f8aa936
commit
e04f313474
5 changed files with 29 additions and 38 deletions
|
@ -1,23 +1,17 @@
|
||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<!DOCTYPE keyboardShortcutContainer [
|
<!DOCTYPE keyboardShortcutContainer [
|
||||||
|
|
||||||
<!ELEMENT keyboardShortcutContainer (windowName, keyboardShortcut+) >
|
<!ELEMENT keyboardShortcutContainer (keyboardShortcut+) >
|
||||||
<!ELEMENT windowName (#PCDATA) >
|
<!ATTLIST keyboardShortcutContainer windowName CDATA #REQUIRED >
|
||||||
<!ELEMENT keyboardShortcut (action, key+) >
|
|
||||||
<!ELEMENT action (#PCDATA) >
|
<!ELEMENT keyboardShortcut EMPTY >
|
||||||
<!ELEMENT key (#PCDATA) >
|
<!ATTLIST keyboardShortcut action CDATA #REQUIRED >
|
||||||
|
<!ATTLIST keyboardShortcut key CDATA #REQUIRED >
|
||||||
|
|
||||||
]>
|
]>
|
||||||
|
|
||||||
<keyboardShortcutContainer>
|
<keyboardShortcutContainer windowName = "hiMyNameIsWindow">
|
||||||
<windowName>hiMyNameIsWindow</windowName>
|
<keyboardShortcut action = "playAudio" key = "p" />
|
||||||
<keyboardShortcut>
|
<keyboardShortcut action = "pauseAudio" key = "<Control>p" />
|
||||||
<action>playAudio</action>
|
<keyboardShortcut action = "stopAudio" key = "space" />
|
||||||
<key>P</key>
|
|
||||||
</keyboardShortcut>
|
|
||||||
<keyboardShortcut>
|
|
||||||
<action>pauseAudio</action>
|
|
||||||
<key>Ctrl-P</key>
|
|
||||||
<key>Space</key>
|
|
||||||
</keyboardShortcut>
|
|
||||||
</keyboardShortcutContainer>
|
</keyboardShortcutContainer>
|
||||||
|
|
|
@ -73,7 +73,7 @@ const std::string configFileName = "etc/keyboardShortcut.xml";
|
||||||
* Set up the test environment
|
* Set up the test environment
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
KeyboardShortcutTest :: setUp(void) throw ()
|
KeyboardShortcutTest :: setUp(void) throw (CPPUNIT_NS::Exception)
|
||||||
{
|
{
|
||||||
std::ifstream ifs;
|
std::ifstream ifs;
|
||||||
ifs.open(configFileName.c_str());
|
ifs.open(configFileName.c_str());
|
||||||
|
@ -97,11 +97,11 @@ KeyboardShortcutTest :: setUp(void) throw ()
|
||||||
|
|
||||||
} catch (std::invalid_argument &e) {
|
} catch (std::invalid_argument &e) {
|
||||||
ifs.close();
|
ifs.close();
|
||||||
CPPUNIT_FAIL("semantic error in audio player configuration file: "
|
CPPUNIT_FAIL("semantic error in keyboard shortcuts configuration file: "
|
||||||
+ std::string(e.what()));
|
+ std::string(e.what()));
|
||||||
} catch (xmlpp::exception &e) {
|
} catch (xmlpp::exception &e) {
|
||||||
ifs.close();
|
ifs.close();
|
||||||
CPPUNIT_FAIL("syntax error in audio player configuration file: "
|
CPPUNIT_FAIL("syntax error in keyboard shortcuts configuration file: "
|
||||||
+ std::string(e.what()));
|
+ std::string(e.what()));
|
||||||
}
|
}
|
||||||
ifs.close();
|
ifs.close();
|
||||||
|
@ -124,25 +124,25 @@ void
|
||||||
KeyboardShortcutTest :: firstTest(void)
|
KeyboardShortcutTest :: firstTest(void)
|
||||||
throw (CPPUNIT_NS::Exception)
|
throw (CPPUNIT_NS::Exception)
|
||||||
{
|
{
|
||||||
CPPUNIT_ASSERT(ksc->findAction(0, GDK_P)
|
CPPUNIT_ASSERT(ksc->findAction(Gdk::ModifierType(0), GDK_p)
|
||||||
== KeyboardShortcut::playAudio);
|
== 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);
|
== KeyboardShortcut::playAudio);
|
||||||
|
|
||||||
CPPUNIT_ASSERT(ksc->findAction(GDK_CONTROL_MASK, GDK_P)
|
CPPUNIT_ASSERT(ksc->findAction(Gdk::CONTROL_MASK, GDK_p)
|
||||||
== KeyboardShortcut::pauseAudio);
|
== KeyboardShortcut::pauseAudio);
|
||||||
|
|
||||||
CPPUNIT_ASSERT(ksc->findAction(0, GDK_space)
|
CPPUNIT_ASSERT(ksc->findAction(Gdk::ModifierType(0), GDK_space)
|
||||||
== KeyboardShortcut::pauseAudio);
|
== KeyboardShortcut::stopAudio);
|
||||||
|
|
||||||
CPPUNIT_ASSERT(ksc->findAction(0, GDK_Q)
|
CPPUNIT_ASSERT(ksc->findAction(Gdk::ModifierType(0), GDK_q)
|
||||||
== KeyboardShortcut::noAction);
|
== KeyboardShortcut::noAction);
|
||||||
|
|
||||||
CPPUNIT_ASSERT(ksc->findAction(GDK_CONTROL_MASK, GDK_W)
|
CPPUNIT_ASSERT(ksc->findAction(Gdk::CONTROL_MASK, GDK_w)
|
||||||
== KeyboardShortcut::noAction);
|
== KeyboardShortcut::noAction);
|
||||||
|
|
||||||
CPPUNIT_ASSERT(ksc->findAction(0xffffff, 0xffffff)
|
CPPUNIT_ASSERT(ksc->findAction(Gdk::ModifierType(0xffffff), 0xffffff)
|
||||||
== KeyboardShortcut::noAction);
|
== KeyboardShortcut::noAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ class KeyboardShortcutTest : public BaseTestMethod
|
||||||
* Set up the environment for the test case.
|
* Set up the environment for the test case.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
setUp(void) throw ();
|
setUp(void) throw (CPPUNIT_NS::Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean up the environment after the test case.
|
* Clean up the environment after the test case.
|
||||||
|
|
|
@ -109,8 +109,6 @@ Ptr<std::string>::Ref xsltFileName;
|
||||||
|
|
||||||
/* =============================================== local function prototypes */
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print program version.
|
* Print program version.
|
||||||
*
|
*
|
||||||
|
@ -140,7 +138,6 @@ printUsage ( const char invocation[],
|
||||||
bool
|
bool
|
||||||
processArguments(int argc, char *argv[]);
|
processArguments(int argc, char *argv[]);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ============================================================= module code */
|
/* ============================================================= module code */
|
||||||
|
|
||||||
|
@ -194,7 +191,7 @@ main( int argc,
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Process command line arguments.
|
* Process command line arguments.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
static bool
|
bool
|
||||||
processArguments(int argc, char *argv[])
|
processArguments(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -248,7 +245,7 @@ processArguments(int argc, char *argv[])
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Print program version.
|
* Print program version.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
static void
|
void
|
||||||
printVersion ( std::ostream & os )
|
printVersion ( std::ostream & os )
|
||||||
{
|
{
|
||||||
os << PACKAGE_NAME << ' ' << PACKAGE_VERSION << std::endl
|
os << PACKAGE_NAME << ' ' << PACKAGE_VERSION << std::endl
|
||||||
|
@ -260,7 +257,7 @@ printVersion ( std::ostream & os )
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Print program usage.
|
* Print program usage.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
static void
|
void
|
||||||
printUsage ( const char invocation[],
|
printUsage ( const char invocation[],
|
||||||
std::ostream & os )
|
std::ostream & os )
|
||||||
{
|
{
|
||||||
|
|
|
@ -96,7 +96,7 @@ const struct option longOptions[] =
|
||||||
*
|
*
|
||||||
* @param os the std::ostream to print to.
|
* @param os the std::ostream to print to.
|
||||||
*/
|
*/
|
||||||
static void
|
void
|
||||||
printVersion ( std::ostream & os );
|
printVersion ( std::ostream & os );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -105,7 +105,7 @@ printVersion ( std::ostream & os );
|
||||||
* @param invocation the command line command used to invoke this program.
|
* @param invocation the command line command used to invoke this program.
|
||||||
* @param os the std::ostream to print to.
|
* @param os the std::ostream to print to.
|
||||||
*/
|
*/
|
||||||
static void
|
void
|
||||||
printUsage ( const char invocation[],
|
printUsage ( const char invocation[],
|
||||||
std::ostream & os );
|
std::ostream & os );
|
||||||
|
|
||||||
|
@ -191,7 +191,7 @@ int main ( int argc,
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Print program version.
|
* Print program version.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
static void
|
void
|
||||||
printVersion ( std::ostream & os )
|
printVersion ( std::ostream & os )
|
||||||
{
|
{
|
||||||
os << PACKAGE_NAME << ' ' << PACKAGE_VERSION << std::endl
|
os << PACKAGE_NAME << ' ' << PACKAGE_VERSION << std::endl
|
||||||
|
@ -202,7 +202,7 @@ printVersion ( std::ostream & os )
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Print program usage.
|
* Print program usage.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
static void
|
void
|
||||||
printUsage ( const char invocation[],
|
printUsage ( const char invocation[],
|
||||||
std::ostream & os )
|
std::ostream & os )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue