Skip to content

Commit 7e7a7b2

Browse files
committed
More tests
1 parent bd09d44 commit 7e7a7b2

File tree

8 files changed

+941
-17
lines changed

8 files changed

+941
-17
lines changed

examples/app/source/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ class Application : public yup::YUPApplication
2727
public:
2828
Application() = default;
2929

30-
const yup::String getApplicationName() override
30+
yup::String getApplicationName() override
3131
{
3232
return "yup app!";
3333
}
3434

35-
const yup::String getApplicationVersion() override
35+
yup::String getApplicationVersion() override
3636
{
3737
return "1.0";
3838
}

examples/graphics/source/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,12 +350,12 @@ struct Application : yup::YUPApplication
350350
{
351351
Application() = default;
352352

353-
const yup::String getApplicationName() override
353+
yup::String getApplicationName() override
354354
{
355355
return "yup! graphics";
356356
}
357357

358-
const yup::String getApplicationVersion() override
358+
yup::String getApplicationVersion() override
359359
{
360360
return "1.0";
361361
}

modules/yup_audio_plugin_client/standalone/yup_audio_plugin_client_Standalone.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ class AudioProcessorApplication
7575
{
7676
}
7777

78-
const String getApplicationName() override
78+
String getApplicationName() override
7979
{
8080
return processor->getName();
8181
}
8282

83-
const String getApplicationVersion() override
83+
String getApplicationVersion() override
8484
{
8585
return "1.0"; // processor->getVersion();
8686
}

modules/yup_events/messages/yup_ApplicationBase.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,12 @@ namespace yup
7676
myMainWindow = nullptr;
7777
}
7878
79-
const String getApplicationName() override
79+
String getApplicationName() override
8080
{
8181
return "Super YUP-o-matic";
8282
}
8383
84-
const String getApplicationVersion() override
84+
String getApplicationVersion() override
8585
{
8686
return "1.0";
8787
}
@@ -114,10 +114,10 @@ class YUP_API YUPApplicationBase
114114

115115
//==============================================================================
116116
/** Returns the application's name. */
117-
virtual const String getApplicationName() = 0;
117+
virtual String getApplicationName() = 0;
118118

119119
/** Returns the application's version number. */
120-
virtual const String getApplicationVersion() = 0;
120+
virtual String getApplicationVersion() = 0;
121121

122122
/** Checks whether multiple instances of the app are allowed.
123123

modules/yup_gui/component/yup_Component.cpp

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ void Component::setEnabled (bool shouldBeEnabled)
7575
//if (options.onDesktop && native != nullptr)
7676
// native->setEnabled (shouldBeEnabled);
7777

78-
if (options.isDisabled && hasKeyboardFocus())
79-
enablementChanged();
78+
enablementChanged();
8079
}
8180

8281
void Component::enablementChanged() {}
@@ -307,6 +306,11 @@ void Component::moved() {}
307306

308307
//==============================================================================
309308

309+
void Component::setSize (float width, float height)
310+
{
311+
setSize ({ width, height });
312+
}
313+
310314
void Component::setSize (const Size<float>& newSize)
311315
{
312316
boundsInParent = boundsInParent.withSize (newSize);
@@ -713,13 +717,27 @@ void Component::addChildComponent (Component* component, int index)
713717
{
714718
children.move (currentIndex, index);
715719

720+
auto bailOutChecker = BailOutChecker (this);
721+
722+
component->internalHierarchyChanged();
723+
724+
if (bailOutChecker.shouldBailOut())
725+
return;
726+
716727
childrenChanged();
717728
}
718729
}
719730
else
720731
{
721732
children.insert (index, component);
722733

734+
auto bailOutChecker = BailOutChecker (this);
735+
736+
component->internalHierarchyChanged();
737+
738+
if (bailOutChecker.shouldBailOut())
739+
return;
740+
723741
childrenChanged();
724742
}
725743
}

modules/yup_gui/component/yup_Component.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,14 @@ class YUP_API Component
288288
*/
289289
Size<float> getSize() const;
290290

291+
/**
292+
Set the size of the component.
293+
294+
@param width The new width of the component.
295+
@param height The new height of the component.
296+
*/
297+
void setSize (float width, float height);
298+
291299
/**
292300
Set the size of the component.
293301

tests/main.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,24 @@ struct TestApplication : yup::YUPApplication
3030
{
3131
TestApplication() = default;
3232

33-
const yup::String getApplicationName() override
33+
yup::String getApplicationName() override
3434
{
3535
return "yup! tests";
3636
}
3737

38-
const yup::String getApplicationVersion() override
38+
yup::String getApplicationVersion() override
3939
{
4040
return "1.0";
4141
}
4242

4343
void initialise (const yup::String& commandLineParameters) override
4444
{
45-
auto commandLineArgs = yup::StringArray::fromTokens (commandLineParameters, true);
46-
4745
yup::Array<char*> argv;
4846

47+
auto applicationName = yup::String ("yup_tests");
48+
argv.add (const_cast<char*> (applicationName.toRawUTF8()));
49+
50+
auto commandLineArgs = yup::StringArray::fromTokens (commandLineParameters, true);
4951
for (auto& arg : commandLineArgs)
5052
{
5153
if (arg.isNotEmpty())
@@ -54,7 +56,7 @@ struct TestApplication : yup::YUPApplication
5456

5557
argv.add (nullptr);
5658

57-
int argc = argv.size();
59+
int argc = argv.size() - 1;
5860
testing::InitGoogleMock (&argc, argv.data());
5961

6062
yup::MessageManager::callAsync ([this, commandLineParameters]

0 commit comments

Comments
 (0)