test_menu: add CTermWindow() test

Origin commit data
------------------
Commit: 2ec0b463aa
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2018-01-15 (Mon, 15 Jan 2018)
This commit is contained in:
Stefan Seyfried
2018-01-15 19:54:52 +01:00
committed by vanhofen
parent 6ec6be1a41
commit 8e7dc910a8
2 changed files with 21 additions and 0 deletions

View File

@@ -52,6 +52,7 @@
#include <gui/widget/msgbox.h>
#include <gui/widget/progresswindow.h>
#include <gui/widget/termwindow.h>
#include <gui/scan.h>
#include <gui/scan_setup.h>
#include <zapit/zapit.h>
@@ -116,6 +117,11 @@ CTestMenu::~CTestMenu()
//static int test_pos[4] = { 130, 192, 282, 360 };
void CTestMenu::handleShellOutput(std::string *line, int *, bool *)
{
fprintf(stderr, "%s: %s\n", __func__, line->c_str());
}
int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey)
{
dprintf(DEBUG_DEBUG, "init test menu\n");
@@ -991,6 +997,19 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey)
return res;
}
else if (actionKey == "shellwindow"){
sigc::slot3<void, std::string*, int *, bool *> sl_shell_output;
sl_shell_output = sigc::mem_fun(*this, &CTestMenu::handleShellOutput);
int r = 0;
const char *c = getenv("TEST_COMMAND");
std::string cmd = "/bin/ps auxwf";
if (c)
cmd = (std::string)c;
CTermWindow term(cmd, CTermWindow::VERBOSE | CTermWindow::ACKNOWLEDGE, &r, false);
term.OnShellOutputLoop.connect(sl_shell_output);
term.exec();
return menu_return::RETURN_REPAINT;
}
else if (actionKey == "footer_key"){
CHintBox hintBox(LOCALE_MESSAGEBOX_INFO, "Footer-Key pressed. Press EXIT to return", 350, NULL, NULL, CComponentsHeader::CC_BTN_EXIT);
hintBox.setTimeOut(15);
@@ -1110,6 +1129,7 @@ int CTestMenu::showTestMenu()
CMenuWidget w_test(rev /*"Test menu"*/, NEUTRINO_ICON_INFO, width, MN_WIDGET_ID_TESTMENU);
w_test.addIntroItems();
w_test.addItem(new CMenuForwarder("Shell Window Test", true, NULL, this, "shellwindow"));
//hardware
CMenuWidget * w_hw = new CMenuWidget("Hardware Test", NEUTRINO_ICON_INFO, width, MN_WIDGET_ID_TESTMENU_HARDWARE);
w_test.addItem(new CMenuForwarder(w_hw->getName(), true, NULL, w_hw));

View File

@@ -62,6 +62,7 @@ class CTestMenu : public CMenuTarget
void showCCTests(CMenuWidget *widget);
void showMsgTests(CMenuWidget *widget);
void showRecords();
void handleShellOutput(std::string *line, int *, bool *);
public:
CTestMenu();
~CTestMenu();