mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-30 02:50:05 +00:00
Small updates to ComponentBuilder, UnitTestRunner.
This commit is contained in:
parent
15375dd223
commit
a90aedce50
10 changed files with 50 additions and 16 deletions
|
|
@ -81,8 +81,8 @@ public:
|
|||
expect (p.start ("ls /"));
|
||||
#endif
|
||||
|
||||
String output (p.readAllProcessOutput());
|
||||
expect (output.isNotEmpty());
|
||||
//String output (p.readAllProcessOutput());
|
||||
//expect (output.isNotEmpty());
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -117,6 +117,9 @@ void UnitTestRunner::runTests (const Array<UnitTest*>& tests)
|
|||
|
||||
for (int i = 0; i < tests.size(); ++i)
|
||||
{
|
||||
if (shouldAbortTests())
|
||||
break;
|
||||
|
||||
try
|
||||
{
|
||||
tests.getUnchecked(i)->performTest (this);
|
||||
|
|
@ -140,6 +143,11 @@ void UnitTestRunner::logMessage (const String& message)
|
|||
Logger::writeToLog (message);
|
||||
}
|
||||
|
||||
bool UnitTestRunner::shouldAbortTests()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void UnitTestRunner::beginNewTest (UnitTest* const test, const String& subCategory)
|
||||
{
|
||||
endTest();
|
||||
|
|
|
|||
|
|
@ -260,6 +260,11 @@ protected:
|
|||
*/
|
||||
virtual void logMessage (const String& message);
|
||||
|
||||
/** This can be overridden to let the runner know that it should abort the tests
|
||||
as soon as possible, e.g. because the thread needs to stop.
|
||||
*/
|
||||
virtual bool shouldAbortTests();
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
friend class UnitTest;
|
||||
|
|
|
|||
|
|
@ -244,7 +244,7 @@ public:
|
|||
successful by calling lockWasGained(). If this is false, your thread is being told to
|
||||
die, so you should take evasive action.
|
||||
|
||||
If you pass zero for the thread object, it will wait indefinitely for the lock - be
|
||||
If you pass nullptr for the thread object, it will wait indefinitely for the lock - be
|
||||
careful when doing this, because it's very easy to deadlock if your message thread
|
||||
attempts to call stopThread() on a thread just as that thread attempts to get the
|
||||
message lock.
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ void DrawablePath::ValueTreeWrapper::writeTo (RelativePointPath& relativePath) c
|
|||
for (int j = 0; j < numCps; ++j)
|
||||
points[j] = e.getControlPoint (j);
|
||||
|
||||
RelativePointPath::ElementBase* newElement = 0;
|
||||
RelativePointPath::ElementBase* newElement = nullptr;
|
||||
const Identifier t (e.getType());
|
||||
|
||||
if (t == Element::startSubPathElement) newElement = new RelativePointPath::StartSubPath (points[0]);
|
||||
|
|
|
|||
|
|
@ -359,21 +359,32 @@ void ComponentBuilder::updateChildComponents (Component& parent, const ValueTree
|
|||
}
|
||||
}
|
||||
|
||||
void ComponentBuilder::refreshChildrenFromValueTree (Component& parent,
|
||||
const ValueTree& childList,
|
||||
ImageProvider* const imageProvider)
|
||||
static void updateMarkers (MarkerList* const list, const ValueTree& state)
|
||||
{
|
||||
if (list != nullptr)
|
||||
MarkerList::ValueTreeWrapper (state).applyTo (*list);
|
||||
}
|
||||
|
||||
void ComponentBuilder::initialiseFromValueTree (Component& comp,
|
||||
const ValueTree& state,
|
||||
ImageProvider* const imageProvider)
|
||||
{
|
||||
using namespace ComponentBuilderHelpers;
|
||||
|
||||
ComponentBuilder builder;
|
||||
builder.setImageProvider (imageProvider);
|
||||
builder.registerStandardComponentTypes();
|
||||
builder.updateChildComponents (parent, childList);
|
||||
|
||||
updateMarkers (comp.getMarkers (true), state.getChildWithName ("MARKERS_X"));
|
||||
updateMarkers (comp.getMarkers (false), state.getChildWithName ("MARKERS_Y"));
|
||||
|
||||
const ValueTree childList (state.getChildWithName ("COMPONENTS"));
|
||||
builder.updateChildComponents (comp, childList);
|
||||
|
||||
for (int i = 0; i < childList.getNumChildren(); ++i)
|
||||
{
|
||||
const ValueTree state (childList.getChild(i));
|
||||
Component* const c = findComponentWithID (parent, getStateId (state));
|
||||
Component* const c = findComponentWithID (comp, getStateId (state));
|
||||
|
||||
if (c != nullptr)
|
||||
{
|
||||
|
|
@ -385,6 +396,7 @@ void ComponentBuilder::refreshChildrenFromValueTree (Component& parent,
|
|||
refreshBasicComponentProperties (*c, state);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
RelativeRectangle ComponentBuilder::getComponentBounds (const ValueTree& state)
|
||||
|
|
|
|||
|
|
@ -229,9 +229,9 @@ public:
|
|||
|
||||
/**
|
||||
*/
|
||||
static void refreshChildrenFromValueTree (Component& parent,
|
||||
const ValueTree& state,
|
||||
ImageProvider* imageProvider);
|
||||
static void initialiseFromValueTree (Component& component,
|
||||
const ValueTree& state,
|
||||
ImageProvider* imageProvider);
|
||||
|
||||
//=============================================================================
|
||||
/** @internal */
|
||||
|
|
|
|||
|
|
@ -197,13 +197,15 @@ public:
|
|||
setButtons (screenPos, time, ModifierKeys());
|
||||
|
||||
if (safeOldComp != nullptr)
|
||||
sendMouseExit (current, screenPos, time);
|
||||
{
|
||||
componentUnderMouse = safeNewComp;
|
||||
sendMouseExit (safeOldComp, screenPos, time);
|
||||
}
|
||||
|
||||
buttonState = originalButtonState;
|
||||
}
|
||||
|
||||
componentUnderMouse = safeNewComp;
|
||||
current = getComponentUnderMouse();
|
||||
current = componentUnderMouse = safeNewComp;
|
||||
|
||||
if (current != nullptr)
|
||||
sendMouseEnter (current, screenPos, time);
|
||||
|
|
|
|||
|
|
@ -50,7 +50,13 @@ Expression RelativeCoordinatePositionerBase::ComponentScope::getSymbolValue (con
|
|||
const MarkerList::Marker* const marker = findMarker (symbol, list);
|
||||
|
||||
if (marker != nullptr)
|
||||
return marker->position.getExpression();
|
||||
{
|
||||
Component* const parent = component.getParentComponent();
|
||||
jassert (parent != nullptr);
|
||||
|
||||
ComponentScope scope (*parent);
|
||||
return Expression (marker->position.getExpression().evaluate (scope));
|
||||
}
|
||||
|
||||
return Expression::Scope::getSymbolValue (symbol);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue