--- /dev/null
+\r
+Microsoft Visual Studio Solution File, Format Version 12.00\r
+# Visual Studio 15\r
+VisualStudioVersion = 15.0.26730.10\r
+MinimumVisualStudioVersion = 10.0.40219.1\r
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WidgetAppInstChecker", "WidgetAppInstChecker\WidgetAppInstChecker.csproj", "{DE51BB9C-25EF-45B4-A0D1-035CFB94FAFE}"\r
+EndProject\r
+Global\r
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
+ Debug|Any CPU = Debug|Any CPU\r
+ Release|Any CPU = Release|Any CPU\r
+ EndGlobalSection\r
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
+ {DE51BB9C-25EF-45B4-A0D1-035CFB94FAFE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {DE51BB9C-25EF-45B4-A0D1-035CFB94FAFE}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {DE51BB9C-25EF-45B4-A0D1-035CFB94FAFE}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {DE51BB9C-25EF-45B4-A0D1-035CFB94FAFE}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ EndGlobalSection\r
+ GlobalSection(SolutionProperties) = preSolution\r
+ HideSolutionNode = FALSE\r
+ EndGlobalSection\r
+ GlobalSection(ExtensibilityGlobals) = postSolution\r
+ SolutionGuid = {378BEAC8-BE3D-498A-89E9-BB502CE5133F}\r
+ EndGlobalSection\r
+EndGlobal\r
--- /dev/null
+<Project>\r
+ <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />\r
+\r
+ <!-- Setting Tizen Extension Path -->\r
+ <PropertyGroup Label="Globals">\r
+ <TizenProjectExtensionsPath>$(MSBuildExtensionsPath)\Tizen\VisualStudio\</TizenProjectExtensionsPath>\r
+ </PropertyGroup>\r
+\r
+ <!-- Import Tizen property in Tizen.NET SDK -->\r
+ <Import Project="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props" Condition="Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props')" />\r
+\r
+ <!-- Property Group for .NET Core Project -->\r
+ <PropertyGroup>\r
+ <OutputType>Exe</OutputType>\r
+ <TargetFramework>netcoreapp2.0</TargetFramework>\r
+ </PropertyGroup>\r
+\r
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
+ <DebugType>portable</DebugType>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
+ <DebugType>None</DebugType>\r
+ </PropertyGroup>\r
+\r
+ <ItemGroup>\r
+ <Folder Include="lib\" />\r
+ <Folder Include="res\" />\r
+ </ItemGroup>\r
+\r
+ <ItemGroup>\r
+ <PackageReference Include="Tizen.NET" Version="6.0.0.14624" />\r
+ <PackageReference Include="Tizen.NET.Sdk" Version="1.0.1" />\r
+ </ItemGroup>\r
+\r
+ <!-- Include Nuget Package for Tizen Project building -->\r
+\r
+ <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />\r
+ <Import Project="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets" Condition="Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets')" />\r
+\r
+ <!-- Install Check 'Visual Studio for Tizen' for developing on Visual Studio -->\r
+ <Target Name="TizenVsixInstallCheck" BeforeTargets="CompileDesignTime">\r
+ <Warning Condition="!Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props')" Text="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props is not exist.
 you need to check if 'Visual Studio for Tizen' is installed" />\r
+ <Warning Condition="!Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets')" Text="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets is not exist.\
 you need to check if 'Visual Studio for Tizen' is installed" />\r
+ </Target>\r
+</Project>\r
--- /dev/null
+using System;\r
+using ElmSharp;\r
+using Tizen;\r
+using Tizen.Applications;\r
+\r
+namespace WidgetApp\r
+{\r
+ class MyWidget : WidgetBase\r
+ {\r
+ private static string _logTag = Application.Current.ApplicationInfo.ApplicationId;\r
+\r
+ public override void OnCreate(Bundle content, int w, int h)\r
+ {\r
+ Log.Warn(_logTag, "OnCreate - w(" + w + "), h(" + h + ")");\r
+\r
+ try\r
+ {\r
+ base.OnCreate(content, w, h);\r
+\r
+ Conformant conformant = new Conformant(Window);\r
+ conformant.Show();\r
+\r
+ Label label = new Label(Window);\r
+ label.Color = Color.White;\r
+ label.Text = "<align=center>WidgetApp</align>";\r
+ label.Resize(w, h);\r
+ label.Show();\r
+\r
+ Box box = new Box(Window)\r
+ {\r
+ AlignmentX = -1,\r
+ AlignmentY = -1,\r
+ WeightX = 1,\r
+ WeightY = 1\r
+ };\r
+ box.Show();\r
+\r
+ box.PackEnd(label);\r
+\r
+ conformant.SetContent(box);\r
+ }\r
+ catch (Exception e)\r
+ {\r
+ Log.Warn(_logTag, "exception " + e);\r
+ }\r
+\r
+ Log.Debug(_logTag, "ID:" + Id);\r
+ Bundle b = new Bundle();\r
+ b.AddItem("InstID", Id);\r
+ SetContent(b);\r
+ }\r
+\r
+ public override void OnPause()\r
+ {\r
+ base.OnPause();\r
+ Log.Debug(_logTag, "OnPause");\r
+ }\r
+\r
+ public override void OnResume()\r
+ {\r
+ base.OnResume();\r
+ Log.Debug(_logTag, "OnResume");\r
+ }\r
+\r
+ public override void OnResize(int w, int h)\r
+ {\r
+ base.OnResize(w, h);\r
+ Log.Debug(_logTag, "OnResize - w(" + w + "), h(" + h + ")");\r
+ }\r
+\r
+ public override void OnUpdate(Bundle content, bool isForce)\r
+ {\r
+ base.OnUpdate(content, isForce);\r
+ Log.Debug(_logTag, "OnUpdate - isForce(" + isForce + ")");\r
+ }\r
+\r
+ public override void OnDestroy(WidgetDestroyType reason, Bundle content)\r
+ {\r
+ base.OnDestroy(reason, content);\r
+ Log.Debug(_logTag, "OnDestroy");\r
+ }\r
+ }\r
+\r
+ class Program\r
+ {\r
+ static void Main(string[] args)\r
+ {\r
+ WidgetApplication app = new WidgetApplication(typeof(MyWidget));\r
+\r
+ app.Run(args);\r
+ }\r
+ }\r
+}\r
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>\r
+<manifest xmlns="http://tizen.org/ns/packages" api-version="5" package="WidgetAppInstChecker" version="1.0.0">\r
+ <profile name="common" />\r
+ <widget-application appid="org.tizen.WidgetAppInstChecker"\r
+ exec="WidgetAppInstChecker.dll"\r
+ type="dotnet"\r
+ main="true"\r
+ update-period="0" >\r
+ <label>WidgetAppInstChecker</label>\r
+ <icon>WidgetAppInstChecker.png</icon>\r
+ <support-size preview="WidgetAppInstChecker.png">4x2</support-size>\r
+ <widget-class classid="foo" update-period="0">\r
+ <icon>WidgetAppInstChecker.png</icon>\r
+ <label>foo@WidgetAppInstChecker</label>\r
+ <support-size preview="WidgetAppInstChecker.png">2x2</support-size>\r
+ </widget-class>\r
+ </widget-application>\r
+</manifest>\r
using NUnit.Framework;
using NUnit.Framework.TUnit;
+using ElmSharp;
using System;
using System.Collections.Generic;
+using System.Threading.Tasks;
namespace Tizen.Applications.Tests {
[TestFixture]
[Description("Testing Tizen.Applications.WidgetBase class")]
public class WidgetBaseTests {
+ private Tizen.Applications.WidgetControl _widgetControl;
+ private string _widgetId = "org.tizen.WidgetAppInstChecker";
+ private Window _window;
+ private Background _background;
+ private RemoteView _remoteView;
+ private bool _created;
+
+ private void LaunchWidget()
+ {
+ if (_window == null)
+ {
+ _window = new Window(Application.Current.ApplicationInfo.ApplicationId);
+ _window.Show();
+ _background = new Background(_window)
+ {
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1,
+ Color = Color.Black
+ };
+ _background.Show();
+ _window.AddResizeObject(_background);
+
+ RemoteViewFactory.Init(_window);
+ _remoteView = RemoteViewFactory.Create(_window, _widgetId, "", 0, true, true, true);
+ _remoteView.Layout.Resize(712, 712);
+ _remoteView.Layout.Show();
+ }
+ }
+
+ private void ShutdownWidget()
+ {
+ _window = null;
+ _background = null;
+ _remoteView = null;
+ _created = false;
+ }
+
+ private void OnCreated(object sender, Tizen.Applications.WidgetLifecycleEventArgs args)
+ {
+ _created = true;
+ }
[SetUp]
public static void Init()
Assert.NotNull(bWidget, "Should not return NULL");
Assert.IsInstanceOf<WidgetBase>(bWidget, "Should return WidgetBase instance.");
}
+
+ [Test]
+ [Category("P1")]
+ [Description("Create a widget with default value")]
+ [Property("SPEC", "Tizen.Applications.WidgetBase.Id A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public async Task Id_PROPERTY_GET()
+ {
+ /* PRECONDITION
+ * */
+ ShutdownWidget();
+ _widgetControl = new Tizen.Applications.WidgetControl(_widgetId);
+ _widgetControl.Created += OnCreated;
+ LaunchWidget();
+ await Task.Delay(4000);
+ Assert.True(_created);
+ string content = _remoteView.Content;
+ Assert.NotNull(content);
+
+ /* TEST CODE */
+ Bundle b = Bundle.Decode(content);
+ b.TryGetItem("InstID", out string val);
+ Assert.NotNull(val);
+ Assert.AreEqual(val, _widgetId);
+
+ /* POSTCONDITION
+ * */
+ b.Dispose();
+ ShutdownWidget();\r
+ _widgetControl.Created -= OnCreated;
+ _widgetControl.Dispose();
+ _widgetControl = null;
+ }
}
}
</ui-application>
<privileges>
<privilege>http://tizen.org/privilege/appmanager.launch</privilege>
+ <privilege>http://tizen.org/privilege/widget.viewer</privilege>
</privileges>
</manifest>