forked from qt-creator/qt-creator
ClearCase: Fix tests
Partially reverts 1ccaafb93e
and moves the signal to its only user.
Change-Id: Ieb5c0d5ecc965d9a0a49f7938198f2c8f89b7009
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
This commit is contained in:
@@ -195,6 +195,11 @@ public:
|
|||||||
bool newActivity();
|
bool newActivity();
|
||||||
void updateStreamAndView();
|
void updateStreamAndView();
|
||||||
|
|
||||||
|
#ifdef WITH_TESTS
|
||||||
|
signals:
|
||||||
|
void reindexedDynamicFile();
|
||||||
|
void statusActionsUpdated();
|
||||||
|
#endif
|
||||||
protected:
|
protected:
|
||||||
void updateActions(VcsBase::VersionControlBase::ActionState) override;
|
void updateActions(VcsBase::VersionControlBase::ActionState) override;
|
||||||
bool activateCommit() override;
|
bool activateCommit() override;
|
||||||
@@ -848,8 +853,12 @@ void ClearCasePluginPrivate::checkAndReIndexUnknownFile(const FilePath &file)
|
|||||||
if (isDynamic()) {
|
if (isDynamic()) {
|
||||||
// reindex unknown files
|
// reindex unknown files
|
||||||
if (m_statusMap->value(file.path(), FileStatus(FileStatus::Unknown)).status
|
if (m_statusMap->value(file.path(), FileStatus(FileStatus::Unknown)).status
|
||||||
== FileStatus::Unknown)
|
== FileStatus::Unknown) {
|
||||||
updateStatusForFile(file);
|
updateStatusForFile(file);
|
||||||
|
#ifdef WITH_TESTS
|
||||||
|
emit reindexedDynamicFile();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -925,6 +934,10 @@ void ClearCasePluginPrivate::updateStatusActions()
|
|||||||
|
|
||||||
m_checkInActivityAction->setEnabled(m_viewData.isUcm);
|
m_checkInActivityAction->setEnabled(m_viewData.isUcm);
|
||||||
m_diffActivityAction->setEnabled(m_viewData.isUcm);
|
m_diffActivityAction->setEnabled(m_viewData.isUcm);
|
||||||
|
|
||||||
|
#ifdef WITH_TESTS
|
||||||
|
emit statusActionsUpdated();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClearCasePluginPrivate::updateActions(VersionControlBase::ActionState as)
|
void ClearCasePluginPrivate::updateActions(VersionControlBase::ActionState as)
|
||||||
@@ -2674,12 +2687,13 @@ void ClearCaseTest::testStatusActions()
|
|||||||
QFETCH(int, status);
|
QFETCH(int, status);
|
||||||
auto tempStatus = static_cast<FileStatus::Status>(status);
|
auto tempStatus = static_cast<FileStatus::Status>(status);
|
||||||
|
|
||||||
QSignalSpy spy(dd, &VcsBase::VersionControlBase::slotStateChangedDone);
|
QSignalSpy spy(dd, &ClearCasePluginPrivate::statusActionsUpdated);
|
||||||
// special case: file should appear as "Unknown" since there is no entry in the index
|
// special case: file should appear as "Unknown" since there is no entry in the index
|
||||||
// and we don't want to explicitly set the status for this test case
|
// and we don't want to explicitly set the status for this test case
|
||||||
if (tempStatus != FileStatus::Unknown)
|
if (tempStatus != FileStatus::Unknown) {
|
||||||
dd->setStatus(fileName, tempStatus, true);
|
dd->setStatus(fileName, tempStatus, true);
|
||||||
QVERIFY(spy.wait(1000));
|
QVERIFY(spy.wait(1000));
|
||||||
|
}
|
||||||
|
|
||||||
QFETCH(bool, checkOutAction);
|
QFETCH(bool, checkOutAction);
|
||||||
QFETCH(bool, undoCheckOutAction);
|
QFETCH(bool, undoCheckOutAction);
|
||||||
@@ -2702,6 +2716,7 @@ void ClearCaseTest::testVcsStatusDynamicReadonlyNotManaged()
|
|||||||
{
|
{
|
||||||
// File is not in map, and is read-only
|
// File is not in map, and is read-only
|
||||||
ClearCasePluginPrivate::instance();
|
ClearCasePluginPrivate::instance();
|
||||||
|
QSignalSpy spy(dd, &ClearCasePluginPrivate::reindexedDynamicFile);
|
||||||
dd->m_statusMap = std::shared_ptr<StatusMap>(new StatusMap);
|
dd->m_statusMap = std::shared_ptr<StatusMap>(new StatusMap);
|
||||||
|
|
||||||
const auto fileName = FilePath::currentWorkingPath().pathAppended(
|
const auto fileName = FilePath::currentWorkingPath().pathAppended(
|
||||||
@@ -2715,6 +2730,7 @@ void ClearCaseTest::testVcsStatusDynamicReadonlyNotManaged()
|
|||||||
|
|
||||||
dd->m_viewData = testCase.dummyViewData();
|
dd->m_viewData = testCase.dummyViewData();
|
||||||
dd->m_viewData.isDynamic = true;
|
dd->m_viewData.isDynamic = true;
|
||||||
|
QVERIFY(spy.wait(1500));
|
||||||
QCOMPARE(dd->vcsStatus(fileName).status, FileStatus::NotManaged);
|
QCOMPARE(dd->vcsStatus(fileName).status, FileStatus::NotManaged);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2722,6 +2738,7 @@ void ClearCaseTest::testVcsStatusDynamicReadonlyNotManaged()
|
|||||||
void ClearCaseTest::testVcsStatusDynamicNotManaged()
|
void ClearCaseTest::testVcsStatusDynamicNotManaged()
|
||||||
{
|
{
|
||||||
ClearCasePluginPrivate::instance();
|
ClearCasePluginPrivate::instance();
|
||||||
|
QSignalSpy spy(dd, &ClearCasePluginPrivate::reindexedDynamicFile);
|
||||||
dd->m_statusMap = std::shared_ptr<StatusMap>(new StatusMap);
|
dd->m_statusMap = std::shared_ptr<StatusMap>(new StatusMap);
|
||||||
|
|
||||||
const auto fileName = FilePath::currentWorkingPath().pathAppended("notmanaged_file.cpp");
|
const auto fileName = FilePath::currentWorkingPath().pathAppended("notmanaged_file.cpp");
|
||||||
@@ -2732,6 +2749,7 @@ void ClearCaseTest::testVcsStatusDynamicNotManaged()
|
|||||||
dd->m_viewData = testCase.dummyViewData();
|
dd->m_viewData = testCase.dummyViewData();
|
||||||
dd->m_viewData.isDynamic = true;
|
dd->m_viewData.isDynamic = true;
|
||||||
|
|
||||||
|
QVERIFY(spy.wait(1500));
|
||||||
QCOMPARE(dd->vcsStatus(fileName).status, FileStatus::NotManaged);
|
QCOMPARE(dd->vcsStatus(fileName).status, FileStatus::NotManaged);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@@ -552,9 +552,6 @@ void VersionControlBase::slotStateChanged(const Internal::State &newInternalStat
|
|||||||
}
|
}
|
||||||
ICore::removeAdditionalContext(m_context);
|
ICore::removeAdditionalContext(m_context);
|
||||||
}
|
}
|
||||||
#ifdef WITH_TESTS
|
|
||||||
emit slotStateChangedDone();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const VcsBasePluginState &VersionControlBase::currentState() const
|
const VcsBasePluginState &VersionControlBase::currentState() const
|
||||||
|
@@ -176,11 +176,6 @@ protected:
|
|||||||
// Returns whether actions should be set up further.
|
// Returns whether actions should be set up further.
|
||||||
bool enableMenuAction(ActionState as, QAction *in) const;
|
bool enableMenuAction(ActionState as, QAction *in) const;
|
||||||
|
|
||||||
#if WITH_TESTS
|
|
||||||
signals:
|
|
||||||
void slotStateChangedDone();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void slotStateChanged(const Internal::State &s, Core::IVersionControl *vc);
|
void slotStateChanged(const Internal::State &s, Core::IVersionControl *vc);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user