# Path: alignak_app/alignakapp.py
# class AppProgressBar(QProgressBar):
#     """
#         AppProgressBar in busy mode with text displayed at the center.
#     """
# 
#     def __init__(self):
#         super(AppProgressBar, self).__init__()
#         self.setRange(0, 0)
#         self.setAlignment(Qt.AlignCenter)
#         self._text = None
# 
#     def set_text(self, text):
#         """
#         Set text of QProgressBar
# 
#         :param text: text of progress bar
#         :type text: str
#         """
# 
#         self._text = text
# 
#     def text(self):
#         """
#         Overload: text(self) -> str
# 
#         :return: text of progress bar
#         :rtype: str
#         """
# 
#         return self._text
# 
# class AppProgressQWidget(QWidget):
#     """
#         Class who create a small widget for App start progression
#     """
# 
#     def __init__(self, parent=None):
#         super(AppProgressQWidget, self).__init__(parent)
#         self.setWindowIcon(QIcon(settings.get_image('icon')))
#         self.setWindowFlags(Qt.FramelessWindowHint)
#         self.setAttribute(Qt.WA_TranslucentBackground)
#         self.setFixedSize(250, 80)
#         self.setStyleSheet(settings.css_style)
#         # Fields
#         self.progress_bar = AppProgressBar()
# 
#     def initialize(self):
#         """
#         Initialize the QWidget
# 
#         """
# 
#         layout = QVBoxLayout(self)
#         layout.setSpacing(0)
# 
#         title_lbl = QLabel('%s - %s' % (__application__, __version__))
#         title_lbl.setAlignment(Qt.AlignCenter)
#         title_lbl.setObjectName('start')
#         title_lbl.setFixedHeight(30)
#         layout.addWidget(title_lbl)
# 
#         self.progress_bar.setFixedHeight(30)
#         layout.addWidget(self.progress_bar)
# 
#         layout.setAlignment(Qt.AlignCenter)


import sys
import unittest2
from PyQt5.QtWidgets import QApplication
from alignak_app.alignakapp import AppProgressBar, AppProgressQWidget
        """Create QApplication"""

        try:
            cls.app = QApplication(sys.argv)
        except:
            pass

    def test_app_progressbar(self):
        """App Progress Bar"""

        under_test = AppProgressBar()

        self.assertEqual(under_test.minimum(), 0)
        self.assertEqual(under_test.maximum(), 0)

        under_test.set_text('test')

        self.assertEqual('test', under_test.text())

    def test_app_progress_Widget(self):
        """App Progress QWidget"""

        under_test = AppProgressQWidget()

        self.assertTrue(under_test.progress_bar)
        self.assertIsInstance(under_test.progress_bar, AppProgressBar)

        under_test.initialize()

        self.assertTrue(under_test.progress_bar)

# Path: alignak_app/alignakapp.py
# class AppProgressBar(QProgressBar):
#     """
#         AppProgressBar in busy mode with text displayed at the center.
#     """
# 
#     def __init__(self):
#         super(AppProgressBar, self).__init__()
#         self.setRange(0, 0)
#         self.setAlignment(Qt.AlignCenter)
#         self._text = None
# 
#     def set_text(self, text):
#         """
#         Set text of QProgressBar
# 
#         :param text: text of progress bar
#         :type text: str
#         """
# 
#         self._text = text
# 
#     def text(self):
#         """
#         Overload: text(self) -> str
# 
#         :return: text of progress bar
#         :rtype: str
#         """
# 
#         return self._text
# 
# class AppProgressQWidget(QWidget):
#     """
#         Class who create a small widget for App start progression
#     """
# 
#     def __init__(self, parent=None):
#         super(AppProgressQWidget, self).__init__(parent)
#         self.setWindowIcon(QIcon(settings.get_image('icon')))
#         self.setWindowFlags(Qt.FramelessWindowHint)
#         self.setAttribute(Qt.WA_TranslucentBackground)
#         self.setFixedSize(250, 80)
#         self.setStyleSheet(settings.css_style)
#         # Fields
#         self.progress_bar = AppProgressBar()
# 
#     def initialize(self):
#         """
#         Initialize the QWidget
# 
#         """
# 
#         layout = QVBoxLayout(self)
#         layout.setSpacing(0)
# 
#         title_lbl = QLabel('%s - %s' % (__application__, __version__))
#         title_lbl.setAlignment(Qt.AlignCenter)
#         title_lbl.setObjectName('start')
#         title_lbl.setFixedHeight(30)
#         layout.addWidget(title_lbl)
# 
#         self.progress_bar.setFixedHeight(30)
#         layout.addWidget(self.progress_bar)
# 
#         layout.setAlignment(Qt.AlignCenter)


# Path: test/test_alignakapp.py
import sys
import unittest2
from PyQt5.QtWidgets import QApplication
from alignak_app.alignakapp import AppProgressBar, AppProgressQWidget

        """Create QApplication"""

        try:
            cls.app = QApplication(sys.argv)
        except:
            pass

    def test_app_progressbar(self):
        """App Progress Bar"""

        under_test = AppProgressBar()

        self.assertEqual(under_test.minimum(), 0)
        self.assertEqual(under_test.maximum(), 0)

        under_test.set_text('test')

        self.assertEqual('test', under_test.text())

    def test_app_progress_Widget(self):
        """App Progress QWidget"""

        under_test = AppProgressQWidget()

        self.assertTrue(under_test.progress_bar)
        self.assertIsInstance(under_test.progress_bar, AppProgressBar)

        under_test.initialize()

        self.assertTrue(under_test.progress_bar)

        self.assertIsInstance(under_test.progress_bar, AppProgressBar)