#include <dbus-c++/dbus.h>

#include "app/KMApplication.h"
#include "common/KMPackageManager.h"

#define TEST_INSTALL 1

typedef void (*testfunptr)();

static void installCallbackTest(KMPMProgressStatus installProgressStatus)
{
    if (!installProgressStatus.refId.c_str() || !installProgressStatus.speed.c_str())
    {
        return;
    }

    kmlogger.info("============> installProgressStatus info:\nrefId:%s progress:%d speed:%s timeout:%d", installProgressStatus.refId.c_str(), installProgressStatus.progress, installProgressStatus.speed.c_str(), installProgressStatus.timeout);
}

/**
 * @brief 测试安装命令
 *
 */
void testInstall()
{
    shared_ptr<KMPackageManager> testInstance = shared_ptr<KMPackageManager>(new KMPackageManager());

    int ret = false;

    int error = 0;
    ret = testInstance->installSoftwareCenter("top.openkylin.Music", "", error, installCallbackTest);
}

int main(int argc, char **argv)
{
    testfunptr fptr = testInstall;
    fptr();
}
